Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Expose client creation API for pylance #1804

Closed
wants to merge 265 commits into from

Conversation

heejaechang
Copy link
Contributor

This is basically reviving microsoft#19912 with new client creation APIs.

opened WIP PR to get feedback

paulacamargo25 and others added 30 commits July 25, 2022 09:04
* Add get flask path function

* Add flask provider

* Make filter function async
…ized (#19543)

* Set searchLocation for environments as the location of environment folder for rooted envs

* Fix tests

* Modify comment
* Source the conda activation script when using Gitbash

* Fix tests
… installing python (#19582)

* Implement

* Code reviews

Co-authored-by: Raymond Zhao <7199958+rzhao271@users.noreply.github.com>

Co-authored-by: Raymond Zhao <7199958+rzhao271@users.noreply.github.com>
…in quickpicker (#19579)

* Ensure a refresh is only triggered after all handlers are registered for the quickpick

* Do not show install python item until we're sure no python is installed

* Fix tests
* Look one more level deep the fastaPi file

* Fix Django debug configuration
* Update version, and changelog.

* Pin setuptools.

* move for tighter pinning.

* Force setoptconf
…dow after it finishes (#19599)

* Rename command to clear internal cache and ensure it also reloads window after it finishes

* Add tests
* Adding execution fixes.

* add map of runIDToTestItem for workspaceTestAdapter instance

* update UI accordingly using new execution method

* attempt to fix invalid argument

* fix invalid argument

* add traceback to the message

* attempt to fix runID

* remove import Codetypes

* change runtest pattern to non optional

* remove unnecessary import comments

* add code for unittest execution debugger

* add noop,traceError to solve mergeConflict

* fix malfunctioning execution, skipped and expected failure outcome

* allow cherry pick test runs for efficiency

* add subtest update and directory search

* leave new debugLauncher dormant and try to fix python type

* ignore type for runner.run as in the past

* cleanup execution.py

* typescript side cleanup

* move the runInstance starting up before executing

* remove unnecessary debugLauncher check

* get rid of TypeAlias

* move uuid to header instead of inside payload

* fix python test and look server unittest

* test out timeout

* try adding requestuuid to avoid timeout

* try using rawHeaders.push

* try inserting uuid inside option command

* fix all server.unit.test.ts problem caused by moving uuid to header

* get rid of unused variable warning

* windows python test server

* pass in debuglauncher to new python test server in all of server.unit.test.ts instances

* make debugLauncher non optional on server.ts

* fix unnecessary comments on discovery

* rename requestuuid to request-uuid

* rename parse_unittest_discovery_args and move to utils

* attempt to fix the moduleNotFound for utils

* attempt to fix moduleNotFound2

* rearrange os.path

* undo rearrange os.path

* test that were not found mark as skipped

* fix set subtraction

* remove unnecessary not found which is handled earlier by tailor run and result

* fix broken discovery refresh

* fix warnings regarding unused

* remove unused variable

* fix testData doesnt exist error

* remove unused methods

* comment new unittest
Bumps [setuptools](https://github.com/pypa/setuptools) from 63.2.0 to 63.3.0.
- [Release notes](https://github.com/pypa/setuptools/releases)
- [Changelog](https://github.com/pypa/setuptools/blob/main/CHANGES.rst)
- [Commits](pypa/setuptools@v63.2.0...v63.3.0)

---
updated-dependencies:
- dependency-name: setuptools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…elated utilities (#19612)

Use 'Microsoft Store' instead of 'Windows Store' to represent store related utilities
The rest of the name is redundant because it's nested under the un-parameterized test name.
* Change refresh icon when interpreter list is refreshing

* Add tests

* Minor tweaks

* Fix situation if dialog box is cancelled

* Fix tests

* Improve ignoreErrors() typing

* Update to not use custom svg, instead use built VSCode icon

* Add vscode mock
* Change refresh icon when interpreter list is refreshing

* Add tests

* Minor tweaks

* Fix situation if dialog box is cancelled

* Fix tests

* Improve ignoreErrors() typing

* Update to not use custom svg, instead use built VSCode icon

* Add vscode mock

* Add button to clear interpreters list and refresh in quickpick
…sues to `vscode-python` (#19656)

* Ensure any labels or assignees do not carry over when transferring issues to  repo

* Fix indent

* Make list of envs global

* Minor edit

* Run prettier

* Add Eleanor to triage flow

Co-authored-by: Karthik Nadig <kanadig@microsoft.com>

Co-authored-by: Karthik Nadig <kanadig@microsoft.com>
eleanorjboyd and others added 27 commits February 14, 2023 09:06
Here the new flow is created but kept inactive for the pytest execution
Closes #20274


### Usage

This change allows callers of the Create Environment command to handle
`Back` and `Cancel`:
``` typescript
let result: CreateEnvironmentResult | undefined;
try {
    const result = await commands.executeCommand("python.createEnvironment", {showBackButton: true});
} catch(e) {
   // error while creating environment
}

if (result?.action === 'Back') {
    // user clicked Back
}

if (result?.action === 'Cancel') {
    // user pressed escape or Cancel
}
```
I decided to go with `result?.action` because we don't have a npm
package for python extension API so catching particular exception might
be error prone with `ex instanceof <error>`. We will provide a proper
interface via `api.environments` for create environment, and
contribution to create environment. Until that point this command will
provide the stop gap.

### Notes

1. I did not use the multi-step input that is used in the rest of the
extension because, the existing implementation does not have context.
Consider the following scenario: venv -> workspace select -> python
select -> packages. Assume that there is only one workspace, and we
don't show the workspace selection UI, that decision is done inside the
workspace step. So, if there is only 1 workspace it is a short circuit
to next step. User is on python selection and clicks `back`, workspace
selection short circuits to next step which is python selection. So,
from user perspective, back does not work. This can be fixed by sending
context that the reason control moved to previous step was because user
clicked on back.
2. This makes a change to old multi step API to rethrow the exception,
if user hits `back` and the current step has no steps to go back to.
Bumps [typing-extensions](https://github.com/python/typing_extensions)
from 4.4.0 to 4.5.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/python/typing_extensions/blob/main/CHANGELOG.md">typing-extensions's
changelog</a>.</em></p>
<blockquote>
<h1>Release 4.5.0 (February 14, 2023)</h1>
<ul>
<li>Runtime support for PEP 702, adding
<code>typing_extensions.deprecated</code>. Patch
by Jelle Zijlstra.</li>
<li>Add better default value for TypeVar <code>default</code> parameter,
PEP 696. Enables
runtime check if <code>None</code> was passed as default. Patch by Marc
Mueller (<a
href="https://github.com/cdce8p"><code>@​cdce8p</code></a>).</li>
<li>The <code>@typing_extensions.override</code> decorator now sets the
<code>.__override__</code>
attribute. Patch by Steven Troxler.</li>
<li>Fix <code>get_type_hints()</code> on cross-module inherited
<code>TypedDict</code> in 3.9 and 3.10.
Patch by Carl Meyer.</li>
<li>Add <code>frozen_default</code> parameter on
<code>dataclass_transform</code>. Patch by Erik De Bonte.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/python/typing_extensions/commit/8dcd89993c3926d6c704232b9c56160447fa81fe"><code>8dcd899</code></a>
Prepare release 4.5.0 (<a
href="https://github-redirect.dependabot.com/python/typing_extensions/issues/116">#116</a>)</li>
<li><a
href="https://github.com/python/typing_extensions/commit/e81cb8289874d6a6715675d77df88db033824e0d"><code>e81cb82</code></a>
PEP 702: Runtime warnings (<a
href="https://github-redirect.dependabot.com/python/typing_extensions/issues/112">#112</a>)</li>
<li><a
href="https://github.com/python/typing_extensions/commit/1039bb2730e62e9763b8fd1d6a19ddd6bb0b6fe4"><code>1039bb2</code></a>
fix PEP 702 link in the <code>README.md</code> (<a
href="https://github-redirect.dependabot.com/python/typing_extensions/issues/108">#108</a>)</li>
<li><a
href="https://github.com/python/typing_extensions/commit/673e5ceea32f77d90531d4d5e77a7694edba7fba"><code>673e5ce</code></a>
Add <a
href="https://github.com/typing"><code>@​typing</code></a>_extensions.deprecated
(<a
href="https://github-redirect.dependabot.com/python/typing_extensions/issues/105">#105</a>)</li>
<li><a
href="https://github.com/python/typing_extensions/commit/27646ecba87fe518566db3d6b970574ad8df2490"><code>27646ec</code></a>
Fix tests on Python 3.11 (<a
href="https://github-redirect.dependabot.com/python/typing_extensions/issues/106">#106</a>)</li>
<li><a
href="https://github.com/python/typing_extensions/commit/57226b4fb64a5d9f4788e74fe3799d98fe02026b"><code>57226b4</code></a>
Add <code>frozen_default</code> parameter on
<code>dataclass_transform</code> (<a
href="https://github-redirect.dependabot.com/python/typing_extensions/issues/101">#101</a>)</li>
<li><a
href="https://github.com/python/typing_extensions/commit/0ea104bc37bd8f85246d48c7f6c7642f25771498"><code>0ea104b</code></a>
Expand the pyproject.toml sdist include expression to include
src/_typed_dict...</li>
<li><a
href="https://github.com/python/typing_extensions/commit/93ac93b58f23a2b7e4450cbe8819f5a36d319af7"><code>93ac93b</code></a>
CI: test on Ubuntu-20.04, not Ubuntu-2004 (<a
href="https://github-redirect.dependabot.com/python/typing_extensions/issues/100">#100</a>)</li>
<li><a
href="https://github.com/python/typing_extensions/commit/5f9258d1efd5d8e4900ffc23ba2486240f2a2f35"><code>5f9258d</code></a>
Test on Ubuntu 20.04</li>
<li><a
href="https://github.com/python/typing_extensions/commit/ad3966ddabe9adcbf2e76d88a7cf984fa9cb4237"><code>ad3966d</code></a>
Replace type comments with annotations (<a
href="https://github-redirect.dependabot.com/python/typing_extensions/issues/98">#98</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/python/typing_extensions/compare/4.4.0...4.5.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=typing-extensions&package-manager=pip&previous-version=4.4.0&new-version=4.5.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Possible fix for #16921

Closes #16921

BTW you folks should probably ask GitHub support to eject this repo from
their original repository (so it stops being a fork and has its own
network on GH)
Updating the README to reflect isort not being installed by default
…0789)

Closes #20635

- Suggest to install from `python.org` if brew is not available
- Do not suggest irrelevant prompts
)

Follow up from #20222.

Apparently `setTimeout` changed the stack in such a way that we were
unable to recognize which extension called the API:
```
[DEBUG 2023-2-2 16:21:9.641]: Extension unknown accessed getActiveEnvironmentPath with args: undefined
```
Reverting the change.
For: #20270

@DonJayamanne This PR adds a field to the options that should allow you
to skip environment selection.
@heejaechang
Copy link
Contributor Author

heejaechang commented Mar 8, 2023

wrong repo. sorry.

@heejaechang heejaechang closed this Mar 8, 2023
@heejaechang heejaechang deleted the pylanceClient branch March 8, 2023 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.