profile
viewpoint

karrtikr/code-bank 0

My day to day implementations in Data structures, Bash, Verilog, Octave, Latex and more..

karrtikr/depends 0

The script powering http://apps.himanshumishra.in/depends

karrtikr/documentation 0

Auto-generated documentation builds from the networkx/networkx/doc Sphinx sources.

karrtikr/ete 0

ETE is a Python programming toolkit for building, comparing, annotating, manipulating and visualising trees. It provides both a comprehensive API and a collection of command line tools, including utilities to work with the NCBI taxonomy tree.

karrtikr/fos-proposals 0

:gift_heart: :penguin: Expressing love for Open Source

issue closedmicrosoft/vscode-python

Change public API for execution to return an object and provide a callback which is called when interpreter setting changes

Old design: https://github.com/microsoft/vscode-python/issues/11294

Want to have a public API that returns an object which initially contains an array of strings for the command to execute a Python interpreter. The expectation is we may need to include environment variable details at some point. Update the API as follows,

export interface IExtensionApi {
    /**
     * Promise indicating whether all parts of the extension have completed loading or not.
     * @type {Promise<void>}
     * @memberof IExtensionApi
     */
    ready: Promise<void>;
    debug: {
        /**
         * Generate an array of strings for commands to pass to the Python executable to launch the debugger for remote debugging.
         * Users can append another array of strings of what they want to execute along with relevant arguments to Python.
         * E.g `['/Users/..../pythonVSCode/pythonFiles/lib/python/debugpy', '--listen', 'localhost:57039', '--wait-for-client']`
         * @param {string} host
         * @param {number} port
         * @param {boolean} [waitUntilDebuggerAttaches=true]
         * @returns {Promise<string[]>}
         */
        getRemoteLauncherCommand(host: string, port: number, waitUntilDebuggerAttaches: boolean): Promise<string[]>;

        /**
         * Gets the path to the debugger package used by the extension.
         * @returns {Promise<string>}
         */
        getDebuggerPackagePath(): Promise<string | undefined>;
    };
    /**
     * Return internal settings within the extension which are stored in VSCode storage
     */
    settings: {
        /**
         * An event that is emitted when execution details (for a resource) change. For instance, when interpreter configuration changes.
         */
        readonly onDidChangeExecutionDetails: Event<Uri | undefined>;
        /**
         * Returns all the details the consumer needs to execute code within the selected environment,
         * corresponding to the specified resource taking into account any workspace-specific settings
         * for the workspace to which this resource belongs.
         * @param {Resource} [resource] A resource for which the setting is asked for.
         * * When no resource is provided, the setting scoped to the first workspace folder is returned.
         * * If no folder is present, it returns the global setting.
         * @returns {({ execCommand: string[] | undefined })}
         */
        getExecutionDetails(
            resource?: Resource
        ): {
            /**
             * E.g of execution commands returned could be,
             * * `['<path to the interpreter set in settings>']`
             * * `['<path to the interpreter selected by the extension when setting is not set>']`
             * * `['conda', 'run', 'python']` which is used to run from within Conda environments.
             * or something similar for some other Python environments.
             *
             * @type {(string[] | undefined)} When return value is `undefined`, it means no interpreter is set.
             * Otherwise, join the items returned using space to construct the full execution command.
             */
            execCommand: string[] | undefined;
        };
    };
    datascience: {
        /**
         * Launches Data Viewer component.
         * @param {IDataViewerDataProvider} dataProvider Instance that will be used by the Data Viewer component to fetch data.
         * @param {string} title Data Viewer title
         */
        showDataViewer(dataProvider: IDataViewerDataProvider, title: string): Promise<void>;
    };
}

closed time in 3 hours

karrtikr

issue closedmicrosoft/vscode-python

Make the RMB Python popup menu more compact vertically. Repetitive Stress Hazard!

Bug: Notebook Editor, Interactive Window, Editor cells

Right now, the rmb Python popup menu takes up a LOT of vertical space on the screen. I have found that reaching up or down a significant distance on the screen to use it repeatedly while editing Python code makes my right wrist start to ache. Please make it vertically more compact! ...Bob

<!----------------------------------------------------------------------------------------------- PLEASE READ If this issue doesn't relate to Jupyter Notebooks, Python Interactive Window features or other notebook or "cell"-based features of the Python extension, please use the main Python bug template instead of this one. Thank you! ------------------------------------------------------------------------------------------------->

Steps to cause the bug to occur

Actual behavior

Expected behavior

<!----------------------------------------------------------------------------------------------- Animated GIFs can be effective means to describe a bug. Consider using a tool like https://github.com/phw/peek or https://www.screentogif.com/ to create one. ------------------------------------------------------------------------------------------------->

Your Jupyter and/or Python environment

Please provide as much info as you readily know

  • Jupyter server running: Local | Remote | N/A
  • Extension version: 20YY.MM.#####-xxx
  • VS Code version: #.##
  • Setting python.jediEnabled: true | false
  • Setting python.languageServer: Jedi | Microsoft | None
  • Python and/or Anaconda version: #.#.#
  • OS: Windows | Mac | Linux (distro):
  • Virtual environment: conda | venv | virtualenv | N/A | ...

Developer Tools Console Output

<!----------------------------------------------------------------------------------------------- Copy/paste the output in the "Console" tab in the "Developer Tools" panel (Help > Toggle Developer Tools). For better details, run the "Enable source map support for extension debugging" command in VS Code at least once beforehand. ------------------------------------------------------------------------------------------------->

Microsoft Data Science for VS Code Engineering Team: @rchiodo, @IanMatthewHuff, @DavidKutu, @DonJayamanne, @greazer, @joyceerhl

closed time in 3 hours

rbtyod

issue commentmicrosoft/vscode-python

Make the RMB Python popup menu more compact vertically. Repetitive Stress Hazard!

Closing in favor of https://github.com/microsoft/vscode-python/issues/10337 & https://github.com/microsoft/vscode-python/issues/9284

Note some of options you see in the menu come from VSCode itself, so we can't do anything about them. The issues above will remove these actions from the menu.

The command palette (Ctrl+Shift+P) contains all these commands. You can attach keyboard shortcuts to commands to use them quickly.

rbtyod

comment created time in 3 hours

issue closedmicrosoft/vscode-python

Considering dropping "Sort Imports" from the right-click context menu in favour of "Source Action"

Issue Type: <b>Bug</b>

When I right click the editor on a python file, this is what I get: Snipaste_2019-11-03_17-16-53

"Format Document" and "Format Document with..." seems like they can be configured to do the exact same thing. Stretching out a little bit, so can "Format Selection" when the whole file is selected.

When clicking "source actions", I get another menu open with "Sort Imports" image

However, Sort Imports is already present in the context menu. Dos this option do anything else other than "provide another way to sort imports" as of right now?

The "Run Current Test file" does not work, as I do not have any test file configured. The "Run python file in terminal" is another option which might be frustrating, and could have the same behavior as "Run Selection/Line in terminal".

Extension version: 2019.10.44104 VS Code version: Code 1.39.2 (6ab598523be7a800d7f3eb4d92d7ab9a66069390, 2019-10-15T15:35:18.241Z) OS version: Windows_NT x64 10.0.18362

<details> <summary>System Info</summary>

Item Value
CPUs Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz (8 x 1800)
GPU Status 2d_canvas: enabled<br>flash_3d: enabled<br>flash_stage3d: enabled<br>flash_stage3d_baseline: enabled<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>native_gpu_memory_buffers: disabled_software<br>oop_rasterization: disabled_off<br>protected_video_decode: enabled<br>rasterization: enabled<br>skia_deferred_display_list: disabled_off<br>skia_renderer: disabled_off<br>surface_synchronization: enabled_on<br>video_decode: enabled<br>viz_display_compositor: disabled_off<br>webgl: enabled<br>webgl2: enabled
Load (avg) undefined
Memory (System) 7.89GB (1.81GB free)
Process Argv C:\xxx_lab_07.py
Screen Reader no
VM 0%

</details> <!-- generated by issue reporter -->

closed time in 3 hours

phgmacedo

issue commentmicrosoft/vscode-python

Considering dropping "Sort Imports" from the right-click context menu in favour of "Source Action"

Closing in favor of https://github.com/microsoft/vscode-python/issues/10337

phgmacedo

comment created time in 3 hours

issue openedmicrosoft/vscode

Horizontal scrolling in quickpick

<!-- ⚠️⚠️ Do Not Delete This! feature_request_template ⚠️⚠️ --> <!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ --> <!-- Please search existing issues to avoid creating duplicates. -->

<!-- Describe the feature you'd like. -->

Hi, Is there a way to enable horizontally scrolling inside the quickpick? (I have looked at quickpick options but wasn't able to find any) Sometimes the text may exceed the horizontal length.

image

created time in 3 hours

pull request commentmicrosoft/vscode-python

Show a prompt asking user to upgrade Code runner to new version to keep using it when in Deprecate PythonPath experiment

@ericsnowcurrently I had mentioned the original intent here if you dig down the link in #12764, please have a read. I should have mentioned this again in the PR. Allow me to clarify things again,

This prompt is show to make Case 4 work - Old version of Code Runner + New version of the extension. We decided to show a prompt in the new version of the extension asking users to upgrade code runner.

how does that value get added to package.json?

I asked the code runner to add the flag featureFlags.usingNewPythonInterpreterPathApiV2 in their package.json, so we can detect if it's the new version of Code runner which uses the API, or the old version.

how does the "DeprecatePythonPath" experiment relate to the featureFlags.usingNewPythonInterpreterPathApiV2 value in package.json?

When users are in experiment, the only way to access interpreter path setting is through the API, so we need a code runner extension which uses the API. If featureFlags.usingNewPythonInterpreterPathApiV2 in code runner is not set to true, it means the user needs to upgrade their code runner to a version which uses the API.

why does featureFlags.usingNewPythonInterpreterPathApi no longer apply?

Having only featureFlags.usingNewPythonInterpreterPathApi set to true denotes the code runner is using the older version of our API (https://github.com/microsoft/vscode-python/issues/11294), which has been removed in the latest version of the extension.

So if users wanna use code runner with the latest version of the extension, they have to use the latest code runner which is using the latest extension API. (the one which has featureFlags.usingNewPythonInterpreterPathApi2 flag set)

Hope that make things clearer.

karrtikr

comment created time in 4 hours

issue commentmicrosoft/vscode-python

DLL load failes after update

Unfortunately I am unable to reproduce this issue, can you provide small reproducible example project, which I can try to reproduce this?

Also,

  • Does debugging the file using,
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal"
        },

configuration work?

  • Does running the file in terminal works? (Using the green button on the top right corner, or try using Run python file in terminal command from command palette)
Muerio

comment created time in 6 hours

delete branch karrtikr/vscode-python

delete branch : isort

delete time in 6 hours

push eventmicrosoft/vscode-python

Kartik Raj

commit sha e5e5417f391d362334a86839e676937e25b9cd9b

Ensure we only have a single isort process running on a single file (#12728) * Ensure we only have a single isort process running on a single file * Code reviews * Fix compile errors * Added tests * Add more tests * Code reviews * Remove internal tests and test the outcome instead * Fix hygiene errors * Oops

view details

push time in 6 hours

PR merged microsoft/vscode-python

Reviewers
Ensure we only have a single isort process running on a single file

For #10579

<!-- If an item below does not apply to you, then go ahead and check it off as "done" and strikethrough the text, e.g.: - [x] ~Has unit tests & system/integration tests~ -->

  • [x] Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR).
  • [x] Title summarizes what is changing.
  • [x] Has a news entry file (remember to thank yourself!).
  • [ ] Appropriate comments and documentation strings in the code.
  • [ ] Has sufficient logging.
  • [ ] Has telemetry for enhancements.
  • [x] Unit tests & system/integration tests are added/updated.
  • [ ] Test plan is updated as appropriate.
  • [ ] package-lock.json has been regenerated by running npm install (if dependencies have changed).
  • [ ] The wiki is updated with any design decisions/details.
+135 -7

4 comments

3 changed files

karrtikr

pr closed time in 6 hours

Pull request review commentmicrosoft/vscode-python

Log experiments run via ExP in the output panel

 export class ExperimentService implements IExperimentService {          return this.experimentationService.isCachedFlightEnabled(experiment);     }++    private logExperiments() {+        const experiments = this.globalState.get<{ features: string[] }>(EXP_MEMENTO_KEY, { features: [] });

Great, I also recommend adding a doc comment in the method logExperiments(), which says it logs the experiment the user belongs to.

kimadeline

comment created time in 7 hours

Pull request review commentmicrosoft/vscode-python

Log experiments run via ExP in the output panel

 export class ExperimentService implements IExperimentService {          return this.experimentationService.isCachedFlightEnabled(experiment);     }++    private logExperiments() {+        const experiments = this.globalState.get<{ features: string[] }>(EXP_MEMENTO_KEY, { features: [] });

we're logging experiments inside the Python extension, why would we log experiments that are not from the Python extension

What I was trying to say is, by looking at the news entry which says Log experiments run via ExP in the output panel It seems we're registering all experiments registered in the Python extension - whether the user is in it or not.

kimadeline

comment created time in 7 hours

push eventkarrtikr/vscode-python

Kartik Raj

commit sha 8c818db106f3d108ca53fc2cf2946819ce862d0d

Oops

view details

push time in 10 hours

push eventkarrtikr/vscode-python

Kartik Raj

commit sha 32cec2f8825e0f74e4cf5be16c39b85b6ffc86cb

Fix hygiene errors

view details

push time in 10 hours

Pull request review commentmicrosoft/vscode-python

Ensure we only have a single isort process running on a single file

 export class SortImportsEditingProvider implements ISortImportsEditingProvider {     public async provideDocumentSortImportsEdits(         uri: Uri,         token?: CancellationToken+    ): Promise<WorkspaceEdit | undefined> {+        if (this.isortPromises.has(uri.fsPath)) {+            if (!this.isortPromises.get(uri.fsPath)!.completed) {+                return;+            }+        }

It's outside the scope of this PR anyways, so resolving this.

karrtikr

comment created time in 10 hours

Pull request review commentmicrosoft/vscode-python

Ensure we only have a single isort process running on a single file

 suite('Import Sort Provider', () => {         shell.verifyAll();         documentManager.verifyAll();     });++    test('If no previous isort promise for the file exists, register the isort promise for the file and return it', async () => {+        const uri = Uri.file('TestDoc');+        const _provideDocumentSortImportsEdits = sinon.stub(+            SortImportsEditingProvider.prototype,+            '_provideDocumentSortImportsEdits'+        );++        _provideDocumentSortImportsEdits.resolves(undefined);++        await sortProvider.provideDocumentSortImportsEdits(uri);++        assert.ok(sortProvider._isortPromises.has(uri.fsPath));+        assert.ok(_provideDocumentSortImportsEdits.calledOnce);+    });++    test("If previous isort promise for the file has completed, don't cancel any token and return new promise", async () => {

Removed the test

karrtikr

comment created time in 10 hours

push eventkarrtikr/vscode-python

Kartik Raj

commit sha c6a7bfb2238be62a269adc7c768b0bf860390b9c

Remove internal tests and test the outcome instead

view details

push time in 10 hours

push eventkarrtikr/vscode-python

Kartik Raj

commit sha 5136a76836f2f7b92d81471482cfc886220c4cf1

Remove internal tests and test the outcome instead

view details

push time in 11 hours

Pull request review commentmicrosoft/vscode-python

Log experiments run via ExP in the output panel

 export class ExperimentService implements IExperimentService {          return this.experimentationService.isCachedFlightEnabled(experiment);     }++    private logExperiments() {+        const experiments = this.globalState.get<{ features: string[] }>(EXP_MEMENTO_KEY, { features: [] });

Does this return all experiments the user belongs to? Or all experiments running on behalf of the Python extension.

We should be logging the prior one, right? The news entry and naming is making it seem like we're logging all the experiments, and not just the one the user belongs to.

kimadeline

comment created time in 14 hours

Pull request review commentmicrosoft/vscode-python

Log experiments run via ExP in the output panel

 export class ExperimentService implements IExperimentService {          return this.experimentationService.isCachedFlightEnabled(experiment);     }++    private logExperiments() {+        const experiments = this.globalState.get<{ features: string[] }>(EXP_MEMENTO_KEY, { features: [] });++        experiments.features.forEach((exp) => {

Does this return all experiments the user belongs to? Or all experiments running on behalf of the Python extension.

We should be logging the prior one, right? If so, please update the news entry and add a comment to that effect.

kimadeline

comment created time in 16 hours

issue commentmicrosoft/vscode-python

DLL load failes after update

Hi @Muerio 👋

Can you send a screenshot for the terminal, in case it works, and in the other case where it doesn't? I am suspecting the commands sent by the extension might have been changed which is leading to this error?

previous version 2020.6.2

There's no such version. Are you sure that's the correct one?

Muerio

comment created time in a day

issue commentmicrosoft/vscode-python

Creating a new terminal does not automatically activate the chosen conda interpreter

Hi @rahul003 , I would need additional info for this. Please provide the logs as mentioned in the issue template, and also, the extension version.

Logs

<details>

<summary>Output for <code>Python</code> in the <code>Output</code> panel (<code>View</code>→<code>Output</code>, change the drop-down the upper-right of the <code>Output</code> panel to <code>Python</code>) </summary>

<p>

XXX

</p> </details>

<br />

<details>

<summary> Output from <code>Console</code> under the <code>Developer Tools</code> panel (toggle Developer Tools on under <code>Help</code>; turn on source maps to make any tracebacks be useful by running <code>Enable source map support for extension debugging</code>) </summary>

<p>

XXXX

</p> </details>

Does having this in user setting work?

  "python.experiments.optOutFrom": ["DeprecatePythonPath - experiment"]
rahul003

comment created time in a day

Pull request review commentmicrosoft/vscode-python

Ensure we only have a single isort process running on a single file

 suite('Import Sort Provider', () => {         shell.verifyAll();         documentManager.verifyAll();     });++    test('If no previous isort promise for the file exists, register the isort promise for the file and return it', async () => {+        const uri = Uri.file('TestDoc');+        const _provideDocumentSortImportsEdits = sinon.stub(+            SortImportsEditingProvider.prototype,+            '_provideDocumentSortImportsEdits'+        );++        _provideDocumentSortImportsEdits.resolves(undefined);++        await sortProvider.provideDocumentSortImportsEdits(uri);++        assert.ok(sortProvider._isortPromises.has(uri.fsPath));+        assert.ok(_provideDocumentSortImportsEdits.calledOnce);+    });++    test("If previous isort promise for the file has completed, don't cancel any token and return new promise", async () => {+        const uri = Uri.file('TestDoc');+        const _provideDocumentSortImportsEdits = sinon.stub(+            SortImportsEditingProvider.prototype,+            '_provideDocumentSortImportsEdits'+        );+        _provideDocumentSortImportsEdits.resolves(undefined);++        const deferred = createDeferred<WorkspaceEdit | undefined>();+        deferred.resolve();+        const tokenSource = TypeMoq.Mock.ofType<CancellationTokenSource>();+        tokenSource+            .setup((t) => t.cancel())+            .returns(() => undefined)+            .verifiable(TypeMoq.Times.never());+        sortProvider._isortPromises.set(uri.fsPath, { deferred, tokenSource: tokenSource.object });++        await sortProvider.provideDocumentSortImportsEdits(uri);++        tokenSource.verifyAll();+        assert.ok(_provideDocumentSortImportsEdits.calledOnce);+    });++    test("If previous isort promise for the file hasn't been completed yet, cancel the previous token and resume", async () => {

Run tool twice, and ensure the last once wins.

This would be an integration test, right? Ideas on how to ensure the last one wins??

karrtikr

comment created time in a day

push eventkarrtikr/vscode-python

Kartik Raj

commit sha 8f4f2cad00d5711421fba9f7899b761bbf8cf586

Code reviews

view details

push time in a day

Pull request review commentmicrosoft/vscode-python

Ensure we only have a single isort process running on a single file

 export class SortImportsEditingProvider implements ISortImportsEditingProvider {         }          const execIsort = await this.getExecIsort(document, uri, token);-        if (token && token.isCancellationRequested) {

I'll put that back in just to be sure.

karrtikr

comment created time in a day

Pull request review commentmicrosoft/vscode-python

Ensure we only have a single isort process running on a single file

 export class SortImportsEditingProvider implements ISortImportsEditingProvider {         }          const execIsort = await this.getExecIsort(document, uri, token);-        if (token && token.isCancellationRequested) {

The stuff before that does not take time, it seems unlikely that the user will be able to cancel the sort before a process is spinned.

karrtikr

comment created time in a day

PR opened microsoft/vscode-python

Show a prompt asking user to upgrade Code runner to new version to keep using it when in Deprecate PythonPath experiment

For #12764

<!-- If an item below does not apply to you, then go ahead and check it off as "done" and strikethrough the text, e.g.: - [x] ~Has unit tests & system/integration tests~ -->

  • [ ] Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR).
  • [ ] Title summarizes what is changing.
  • [ ] Has a news entry file (remember to thank yourself!).
  • [ ] Appropriate comments and documentation strings in the code.
  • [ ] Has sufficient logging.
  • [ ] Has telemetry for enhancements.
  • [ ] Unit tests & system/integration tests are added/updated.
  • [ ] Test plan is updated as appropriate.
  • [ ] package-lock.json has been regenerated by running npm install (if dependencies have changed).
  • [ ] The wiki is updated with any design decisions/details.
+4 -2

0 comment

3 changed files

pr created time in a day

create barnchkarrtikr/vscode-python

branch : upgradecoderu

created branch time in a day

issue openedmicrosoft/vscode-python

Show a prompt asking user to upgrade Code runner to new version to keep using it

Prompt: https://github.com/microsoft/vscode-python/issues/11327

The latest extension is not compatible with old versions of Code runner, ask users to upgrade it.

created time in a day

issue commentformulahendry/vscode-code-runner

Update the API usage to fetch interpreter path

Looks good to me👍 please proceed.

karrtikr

comment created time in a day

issue commentgoanpeca/setup-miniconda

Example described in Setup miniconda doesn't work

I don't see the correction made, why was this closed?

karrtikr

comment created time in 3 days

push eventkarrtikr/vscode-python

Kartik Raj

commit sha 80f0af1cdf78b76909f49bbcc23bb81844f28bff

Add more tests

view details

push time in 4 days

push eventkarrtikr/vscode-python

Kartik Raj

commit sha 9937048cbca2be19e353032ce5ab1fe1693040ab

Added tests

view details

push time in 4 days

Pull request review commentmicrosoft/vscode-python

Ensure we only have a single isort process running on a single file

 export class SortImportsEditingProvider implements ISortImportsEditingProvider {     public async provideDocumentSortImportsEdits(         uri: Uri,         token?: CancellationToken+    ): Promise<WorkspaceEdit | undefined> {+        if (this.isortPromises.has(uri.fsPath)) {+            if (!this.isortPromises.get(uri.fsPath)!.completed) {+                return;+            }+        }

@DonJayamanne Even if isort is not called for the second time, when the first isort edits are applied, the user will loose any changes he made between that execution time. i.e Whatever user types until the isort execution is completed will potentially be lost. Thoughts?

@int19h We can also see if the result is outdated or not using the cancellation token, and then discard it, so versioning does not seem to be necessary. Please have a look at the new change and let me know what you think.

karrtikr

comment created time in 4 days

issue commentmicrosoft/pylance-release

Sort imports is severely bugged with Pylance language server

Although this is similar to https://github.com/microsoft/vscode-python/issues/10579, this isn't a dup.

The cause here was that both Pylance and the extension initialized the isort process to get the diff. The result (which is the diff/workspace edit) from both the processes is then applied almost simultaneously, leading to this configuration.

So the correct solution would be to ensure we're using either the extension, or Pylance for import sorting, but not both.

ErwanDL

comment created time in 4 days

Pull request review commentmicrosoft/vscode-python

Ensure we only have a single isort process running on a single file

 export class SortImportsEditingProvider implements ISortImportsEditingProvider {     public async provideDocumentSortImportsEdits(         uri: Uri,         token?: CancellationToken+    ): Promise<WorkspaceEdit | undefined> {+        if (this.isortPromises.has(uri.fsPath)) {+            if (!this.isortPromises.get(uri.fsPath)!.completed) {+                return;+            }+        }

@DonJayamanne Thanks for the suggestion!

@int19h We can also see if the result is outdated or not using the cancellation token, so versioning does not seem to be necessary. Please have a look at the new change and let me know what you think.

karrtikr

comment created time in 4 days

push eventkarrtikr/vscode-python

Kartik Raj

commit sha 3759c1db1f84b89a288b0e197363fabe94ec0bb2

Fix compile errors

view details

push time in 4 days

push eventkarrtikr/vscode-python

Kartik Raj

commit sha d4d73eeab229a5ba38ebb562299da94ce01c31de

Code reviews

view details

push time in 4 days

pull request commentmicrosoft/vscode-python

Ensure we only have a single isort process running on a single file

@kimadeline @jakebailey As @DonJayamanne suggested, I have changed the code to kill the previous isort process and continue with the new one. This should take care of your scenario as well.

karrtikr

comment created time in 4 days

Pull request review commentmicrosoft/vscode-python

Ensure we only have a single isort process running on a single file

 export class SortImportsEditingProvider implements ISortImportsEditingProvider {     public async provideDocumentSortImportsEdits(         uri: Uri,         token?: CancellationToken+    ): Promise<WorkspaceEdit | undefined> {+        if (this.isortPromises.has(uri.fsPath)) {+            if (!this.isortPromises.get(uri.fsPath)!.completed) {+                return;+            }+        }

@int19h We can also see if the result is outdated or not using the cancellation token, so versioning is probably not necessary. Please have a look at the new change.

karrtikr

comment created time in 4 days

push eventkarrtikr/vscode-python

Kartik Raj

commit sha 2e80cb723d5309b820d0263bd16905e7a69bfa08

Code reviews

view details

push time in 4 days

issue commentmicrosoft/pylance-release

Sort imports is severely bugged with Pylance language server

Although this is similar to https://github.com/microsoft/vscode-python/issues/10579, this isn't a dup.

The cause here was that both Pylance and the extension initialized the isort process to get the diff. The result (which is the diff/workspace edit) from both the processes is then applied almost simultaneously, leading to this configuration.

So the correct solution would be ensure we're using either the extension, or Pylance for import sorting.

ErwanDL

comment created time in 4 days

Pull request review commentmicrosoft/vscode-python

Ensure we only have a single isort process running on a single file

 export class SortImportsEditingProvider implements ISortImportsEditingProvider {     public async provideDocumentSortImportsEdits(         uri: Uri,         token?: CancellationToken+    ): Promise<WorkspaceEdit | undefined> {+        if (this.isortPromises.has(uri.fsPath)) {+            if (!this.isortPromises.get(uri.fsPath)!.completed) {+                return;

Thanks @jakebailey , that's my understanding as well.

@int19h So in other words, as we're not using await anywhere, any invocation would complete method execution before yielding control. So the scenario you described won't occur.

karrtikr

comment created time in 5 days

startedmicrosoft/pylance-release

started time in 5 days

issue commentmicrosoft/vscode-python

python.defaultInterpreterPath doesn't always work (plus feedback/concerns about DeprecatePythonPath experiment)

Yes... Granted, part of this is confusion around the experiment info page I was sent to when vscode notified me

Yes, apologies for the confusion. The previous wiki wasn't clear enough about the details, I recently mended it.

But you keep answering me as if I'm not specifically reporting it as a bug

I wanted to first clear up the first part where you mentioned you "believe there is buggy behavior in how python.defaultInterpreterPath is implemented", and then get to your other thoughts section (which is a very valuable feedback, thanks for that).

We realize that the new experiment would take away the ability to share interpreter paths in workspace settings, which is why I wasn't talking about it like it's a bug because the behavior you see is expected from dev-perspective. If interested, you can have a look at the few issues which motivated this solution.

We have marked this issue as "needs decision" to make sure we have a conversation about your idea, after which we'll get back to you.

ex-nerd

comment created time in 5 days

Pull request review commentmicrosoft/vscode-python

Ensure we only have a single isort process running on a single file

 export class SortImportsEditingProvider implements ISortImportsEditingProvider {     public async provideDocumentSortImportsEdits(         uri: Uri,         token?: CancellationToken+    ): Promise<WorkspaceEdit | undefined> {+        if (this.isortPromises.has(uri.fsPath)) {+            if (!this.isortPromises.get(uri.fsPath)!.completed) {+                return;

IOW consecutive back to back runs on the same file won't make a difference.

karrtikr

comment created time in 5 days

Pull request review commentmicrosoft/vscode-python

Ensure we only have a single isort process running on a single file

 export class SortImportsEditingProvider implements ISortImportsEditingProvider {     public async provideDocumentSortImportsEdits(         uri: Uri,         token?: CancellationToken+    ): Promise<WorkspaceEdit | undefined> {+        if (this.isortPromises.has(uri.fsPath)) {+            if (!this.isortPromises.get(uri.fsPath)!.completed) {+                return;

Even if it's queued, it won't make a difference as sorting the same the file which has been sorted just now would result in the same configuration.

karrtikr

comment created time in 5 days

delete branch karrtikr/vscode-python

delete branch : inttelem

delete time in 5 days

push eventmicrosoft/vscode-python

Kartik Raj

commit sha 7de0f0f448f00819bc46e00b5cd642d1f0101b0d

Add telemetry for 'Select Interpreter' command (#12723) * Add telemetry for 'Select Interpreter' command * Apply suggestions from code review Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com> * Code reviews Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>

view details

push time in 5 days

PR merged microsoft/vscode-python

Reviewers
Add telemetry for 'Select Interpreter' command

For #12722

  • when select interpreter command is run
  • when "enter interpreter path" is clicked
  • when users enter path to executable vs path to the folder
+28 -0

2 comments

4 changed files

karrtikr

pr closed time in 5 days

delete branch karrtikr/vscode-python

delete branch : flky

delete time in 5 days

push eventmicrosoft/vscode-python

Kartik Raj

commit sha e76070ea2187c73c566b9d3d654f4609dcaf5e78

Increase timeout for flaky tests & hooks (#12721)

view details

push time in 5 days

PR merged microsoft/vscode-python

Reviewers
Log diagnosis info and Increase timeout for flaky tests & hooks skip news

Details provided in the comments. Until we figure out the root cause, I choose to increase timeouts rather than disabling these useful tests.

+19 -3

2 comments

4 changed files

karrtikr

pr closed time in 5 days

PR opened microsoft/vscode-python

Ensure we only have a single isort process running on a single file

For #10579

<!-- If an item below does not apply to you, then go ahead and check it off as "done" and strikethrough the text, e.g.: - [x] ~Has unit tests & system/integration tests~ -->

  • [ ] Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR).
  • [ ] Title summarizes what is changing.
  • [ ] Has a news entry file (remember to thank yourself!).
  • [ ] Appropriate comments and documentation strings in the code.
  • [ ] Has sufficient logging.
  • [ ] Has telemetry for enhancements.
  • [ ] Unit tests & system/integration tests are added/updated.
  • [ ] Test plan is updated as appropriate.
  • [ ] package-lock.json has been regenerated by running npm install (if dependencies have changed).
  • [ ] The wiki is updated with any design decisions/details.
+49 -2

0 comment

3 changed files

pr created time in 5 days

create barnchkarrtikr/vscode-python

branch : isort

created branch time in 5 days

pull request commentmicrosoft/vscode-python

Log diagnosis info and Increase timeout for flaky tests & hooks

@kimadeline In cases where the timeout is because of that method being used, increasing timeout almost definitely works. But if it doesn't I'll just skip the test 🤷‍♂️

karrtikr

comment created time in 5 days

push eventkarrtikr/vscode-python

Kartik Raj

commit sha 39ad9f363d8f6919d480755d35c2e2774d02a512

Code reviews

view details

push time in 5 days

pull request commentmicrosoft/vscode-python

Add telemetry for 'Select Interpreter' command

@luabud will look into this telemetry to validate it, that's how it was always done. I have notified her about the event names.

karrtikr

comment created time in 5 days

push eventkarrtikr/vscode-python

Kartik Raj

commit sha e0f453b971a528c64c6d025fc3ababffff02137b

Apply suggestions from code review Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>

view details

push time in 5 days

Pull request review commentmicrosoft/vscode-python

Add telemetry for 'Select Interpreter' command

 export interface IEventNamePropertyMapping {          */         disabled: boolean;     };+    /**+     * Telemetry event sent when 'Select Interpreter' command is invoked+     */+    [EventName.SELECT_INTERPRETER]: never | undefined;+    /**+     * Telemetry event sent when 'Enter interpreter path' button is clicked+     */+    [EventName.ENTER_INTERPRETER_PATH_BUTTON]: never | undefined;+    /**+     * Telemetry event sent with details about what choice user made to input the interpreter path+     */+    [EventName.INPUT_INTERPRETER_PATH_CHOICES]: {+        /**+         * Carries 'enter' if user chose to enter the path to executable+         * Carries 'browse' if user chose to browse for the path to the executable

It wasn't done in any of the places in that file, but we can start now.

karrtikr

comment created time in 5 days

PR opened microsoft/vscode-python

Add telemetry for 'Select Interpreter' command

For #12722

+28 -0

0 comment

4 changed files

pr created time in 5 days

create barnchkarrtikr/vscode-python

branch : inttelem

created branch time in 5 days

issue openedmicrosoft/vscode-python

Add telemetry for "Select Interpreter" command

Things to add:

  • When select interpreter command is run
  • When "enter interpreter path" is clicked
  • When users enter path to executable vs path to the folder

created time in 5 days

PR opened microsoft/vscode-python

Log diagnosis info and Increase timeout for flaky tests & hooks skip news

Details provided in the comments. I choose to increase timeouts rather than disabling these useful tests.

+19 -3

0 comment

4 changed files

pr created time in 5 days

push eventkarrtikr/vscode-python

Kartik Raj

commit sha aa337ffa4d635a2073c3f78ce4ec868509d03751

Increase timeout for flaky tests & hooks

view details

push time in 5 days

create barnchkarrtikr/vscode-python

branch : flky

created branch time in 5 days

issue commentmicrosoft/vscode-python

python.defaultInterpreterPath doesn't always work (plus feedback/concerns about DeprecatePythonPath experiment)

I'm trying to use python.defaultInterpreterPath in a workspace scope.

You cannot use a user setting in workspace scope.

Like the wiki mentions, if you want to configure workspace-specific interpreters, use the Python: Select Interpreter command instead of python.defaultInterpreterPath.

Please try the solution I mentioned earlier with clearing workspace settings and then get back to me.

ex-nerd

comment created time in 6 days

GollumEvent

issue commentmicrosoft/vscode-python

python.defaultInterpreterPath doesn't always work (plus feedback/concerns about DeprecatePythonPath experiment)

I'm trying to use python.defaultInterpreterPath in a workspace scope.

You cannot use a user setting in workspace scope.

Like the wiki mentions, if you want to configure workspace-specific interpreters, use the Python: Select Interpreter command instead of python.defaultInterpreterPath.

Try the solution I mentioned earlier with clearing workspace settings and then get back to me.

ex-nerd

comment created time in 6 days

GollumEvent

issue commentmicrosoft/vscode-python

python.defaultInterpreterPath doesn't always work (plus feedback/concerns about DeprecatePythonPath experiment)

No I don't mean that at all. Please have a look at the wiki I linked earlier. And try the steps I mentioned.

ex-nerd

comment created time in 6 days

GollumEvent

issue commentmicrosoft/vscode-python

python.defaultInterpreterPath doesn't always work (plus feedback/concerns about DeprecatePythonPath experiment)

@ex-nerd The steps to reproduce you mentioned didn't do it for me. For me the new interpreter was picked up correctly. What I did was,

  • Selected a installed pyenv interpreter 3.5.2 using python.defaultInterpreterPath setting.
  • Closed VSCode. Uninstalled the interpreter. Installed a new one 3.7.4
  • Set python.defaultInterpreterPath to the new one
  • Opened a python file to activate the extension again. The new one was picked up directly and no prompt was shown.

Note we do not cache interpreter setting values, and look up the settings everytime.

Set python.defaultInterpreterPath to your preferred python path (e.g. a local pyenv installation of 3.7.2)

I suspect you have this interpreter set in workspace settings (which are now stored in VSCode internal storage) instead of user setting python.defaultInterpreterPath, which is why it is being picked up. Please see wiki for more details on how interpreters are stored in the experiment.

Try to clear the value stored in workspace settings using Python: Clear Workspace Interpreter Setting command, and then your user setting python.defaultInterpreterPath value should be picked up correctly.

ex-nerd

comment created time in 6 days

GollumEvent

PR opened microsoft/vscode-python

Skip flaky daemon tests skip news

For https://github.com/microsoft/vscode-python/issues/12690

+8 -2

0 comment

1 changed file

pr created time in 6 days

create barnchkarrtikr/vscode-python

branch : deamon

created branch time in 7 days

issue openedmicrosoft/vscode-python

Flaky Python Daemon Pool tests

1) Daemon - Python Daemon Pool
       If executing python code takes too long (> 1s), then return standard PythonExecutionService:
     Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (d:\a\1\s\src\test\common\process\pythonDaemonPool.unit.test.ts)
  

  2) Daemon - Python Daemon Pool
       If executing python is fast, then use the daemon (for observables):
     Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (d:\a\1\s\src\test\common\process\pythonDaemonPool.unit.test.ts)

https://dev.azure.com/ms/vscode-python/_build/results?buildId=91577&view=logs&j=c988df44-9d9a-569e-48be-286abc0c9c8f&t=db0c4314-4299-5ca4-38c1-ea5ee094ec67&l=14886

cc @DonJayamanne

created time in 7 days

issue commentformulahendry/vscode-code-runner

Update the API usage to fetch interpreter path

Yes it is. New flag name works for me, but please don't replace the old flag, just add a new one.

karrtikr

comment created time in 7 days

delete branch karrtikr/vscode-python

delete branch : timeout

delete time in 7 days

push eventmicrosoft/vscode-python

Kartik Raj

commit sha 678e016c86079abc557e6a1a6daab20ba05295ed

Log time taken by pytest hook and increase timeout (#12682)

view details

push time in 7 days

PR merged microsoft/vscode-python

Log time taken by pytest hook skip news

I have seen certain hooks which update settings using this method often times out. We should probably log this info for a while to get a better idea of how much time these hooks take.

+10 -1

2 comments

1 changed file

karrtikr

pr closed time in 7 days

pull request commentmicrosoft/vscode-python

Log time taken by pytest hook

@kimadeline All your concerns are valid, but I am planning to have this just for a 8-10 builds at max, after which I will make sure to remove it. I don't mean for others to use this log, this will mainly help me to get more info about these flaky hooks.

karrtikr

comment created time in 7 days

PR opened microsoft/vscode-python

Log time taken by pytest hook skip news

I have seen certain hooks which update settings using this method often times out. We should probably log this info for a while to get a better idea of how much time these hooks take.

+10 -1

0 comment

1 changed file

pr created time in 7 days

create barnchkarrtikr/vscode-python

branch : timeout

created branch time in 7 days

GollumEvent

issue closedmicrosoft/vscode-python

Different python.defaultInterpreterPath by workspace not being saved

Environment data

  • VS Code version: 1.46.1
  • OS and version: macOS Catalina 10.15.5
  • Python version (& distribution if applicable, e.g. Anaconda): Multiple 3.x versions
  • Type of virtual environment used: virtualenv / pipenv
  • Extension version: v2020.6.90262

Expected behaviour

According to https://github.com/microsoft/vscode-python/wiki/AB-Experiments workspace specific settings for the default Python interpreter should be possible via a new python.defaultInterpreterPath user setting.

Actual behaviour

python.defaultInterpreterPath is shared between multiple workspaces.

Steps to reproduce:

  1. Start a new virtualenv and VS code for project1, e.g.

user@MacBook-pro project1 % pipenv shell Launching subshell in virtual environment… . /Users/user/.local/share/virtualenvs/project1-Vn51bfDI/bin/activate user@MacBook-Pro project1 % . /Users/user/.local/share/virtualenvs/project1-Vn51bfDI/bin/activate (project1) user@MacBook-Pro project1 % code .

  1. Start a new virtualenv and VS code for project2, e.g.

user@MacBook-pro project2 % pipenv shell Launching subshell in virtual environment… . /Users/user/.local/share/virtualenvs/project2-y-K1Kf4d/bin/activate user@MacBook-Pro project2 % . /Users/user/.local/share/virtualenvs/project2-y-K1Kf4d/bin/activate (project2) user@MacBook-Pro project2 % code .

  1. In project 1, set python.defaultInterpreterPath in project1 to /Users/user/.local/share/virtualenvs/stdapplib-Vn51bfDI/bin/python

  2. In project 2, bring up Preferences to see that python.defaultInterpreterPath is already set to the virtualenv path for project1.

Comments

Maybe I'm misunderstanding how this is supposed to work, but a being able to reference a different virtualenv interpreter for each project seems to be a requirement based on the need to not lose prior functionality.

closed time in 7 days

jamie-burks

issue commentmicrosoft/vscode-python

Different python.defaultInterpreterPath by workspace not being saved

@jamie-burks I have edited https://github.com/microsoft/vscode-python/wiki/AB-Experiments to reflect the same, hopefully that'll make things clearer for everyone. Closing this issue now.

jamie-burks

comment created time in 7 days

GollumEvent
GollumEvent
GollumEvent

issue commentmicrosoft/vscode-python

Queries about moving workspace pythonPath setting into VSCode storage

@jraygauthier Maybe, although that seems like much more work. Please take these discussions to #12665

@zor-el I found one of the security concerns which motivated this solution https://github.com/microsoft/vscode-python/issues/7805 for your reference. This was brought to us by the security team at Microsoft and independently by external people.

karrtikr

comment created time in 7 days

issue commentmicrosoft/vscode-python

Different python.defaultInterpreterPath by workspace not being saved

Sorry, what I meant was python.defaultInterpreterPath only works for user setting, whereas python.pythonPath worked for all 3 - user, workspace, and workspace folder setting. So python.defaultInterpreterPath is not a replacement for the python.pythonPath.

but where is that stored?

It's stored in an internal VSCode storage like I said above.

To sum it up,

  • python.pythonPath setting is being removed from all 3 scopes - User, workspace, workspace folder.
  • A new user setting python.defaultInterpreterPath is introduced which is meant as a replacement for python.pythonPath in user scope, but not in workspace scope.
  • An internal storage is introduced which will now store the settings in the workspace & workspace folder scope. i.e settings are no longer stored in settings.json, but an internal storage.

Hope this make things clearer.

jamie-burks

comment created time in 7 days

issue commentmicrosoft/vscode-python

Different python.defaultInterpreterPath by workspace not being saved

The setting python.pythonPath is no longer valid. We don't store interpreter path for workspaces in settings.json like we did before. Instead it's being stored in a internal VSCode storage, and you can change the value stored using Python: Select Interpreter command. The current value is printed in the Python output channel.

jamie-burks

comment created time in 7 days

issue commentmicrosoft/vscode-python

Different python.defaultInterpreterPath by workspace not being saved

https://github.com/microsoft/vscode-python/wiki/AB-Experiments can be misleading. python.defaultInterpreterPath is not meant to be a replacement to python.pythonPath setting. python.defaultInterpreterPath is a user setting, which means it'll be shared between all workspaces.

You can separately use Python: Select Interpreter command from the command palette to select workspace specific python interpreters.

jamie-burks

comment created time in 7 days

issue commentmicrosoft/vscode-python

Queries about moving workspace pythonPath setting into VSCode storage

Would it be possible to have a versionable setting

For now, no. The general solution has to come from VSCode https://github.com/microsoft/vscode/issues/40233.

or a sequence of fallbacks that would be traversed in order to pick the default interpreter

We do have a sequence of fallbacks we follow to select the interpreter,

1. First check user settings.json
        If we have user settings, then always use that, do not proceed.
2. Check workspace virtual environments (pipenv, etc).
        If we have some, then use those as preferred workspace environments.
3. Check list of cached interpreters (previously cachced from all the rules).
        If we find a good one, use that as preferred global env.
        Provided its better than what we have already cached as globally preffered interpreter (globallyPreferredInterpreter).
4. Check current path.
        If we find a good one, use that as preferred global env.
        Provided its better than what we have already cached as globally preffered interpreter (globallyPreferredInterpreter).
5. Check windows registry.
        If we find a good one, use that as preferred global env.
        Provided its better than what we have already cached as globally preffered interpreter (globallyPreferredInterpreter).
6. Check the entire system.
        If we find a good one, use that as preferred global env.
        Provided its better than what we have already cached as globally preffered interpreter (globallyPreferredInterpreter).
karrtikr

comment created time in 7 days

issue commentmicrosoft/vscode-python

Change public API for execution to return an object and provide a callback which is called when interpreter setting changes

Also, the default VSCode setting change event API do not include the new info, so we are just keeping up with the trend 🙂

karrtikr

comment created time in 7 days

issue commentmicrosoft/vscode-python

Change public API for execution to return an object and provide a callback which is called when interpreter setting changes

@jakebailey We can send just pythonPath for now but as Brett pointed out, as the API begins to include more details, all of the execution details won't be readily available when firing the events. So we'll have to query these ourselves to send these along with events, which seems rather unnecessary as users can do that themselves if needed.

karrtikr

comment created time in 7 days

issue commentmicrosoft/vscode-python

Queries about moving workspace pythonPath setting into VSCode storage

Oh I see. The original comment wasn't clear enough, I get the context now. I have removed it as off-topic.

karrtikr

comment created time in 7 days

issue commentmicrosoft/vscode-python

Change public API for execution to return an object and provide a callback which is called when interpreter setting changes

but maybe it's too expensive and users should just requery if needed.

Yes, the execution details aren't readily available when firing the events. We'll have to query these ourselves to send these along with events, which seems rather unnecessary as users can do that themselves if needed.

karrtikr

comment created time in 8 days

more