-
Notifications
You must be signed in to change notification settings - Fork 767
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Globs in extra paths #973
Comments
Thanks for the request @itsdani, we will review the request and look at what it would take to get this functionality |
Copying my info here from microsoft/pyright#1684 (comment)
|
This is pretty critical for supporting monorepos with multiple python services. Support for this feature would also resolve many of the open issues related to My teams currently address this challenge with a bash script that is run whenever a new python service or library is added. #!/bin/bash
shopt -s dotglob
shopt -s nullglob
VENV_PATHS_ARR=(*/*/.venv/lib/*/site-packages/)
VENV_PATHS=$(printf ",\"%s\"" "${VENV_PATHS_ARR[@]}")
EXTRA_PATHS=${VENV_PATHS:1}
jq ".\"python.analysis.extraPaths\" = [${EXTRA_PATHS}]" .vscode/settings.json > .vscode/settings.tmp
mv .vscode/settings.tmp .vscode/settings.json |
Can you clarify what you mean? I wouldn't expect anyone to use extraPaths to add paths that point to an interpreter. |
We found If there's a better approach than With
Using
|
You may be interested in https://github.com/microsoft/pyright/blob/main/docs/configuration.md#execution-environment-options, though I don't know to what extent it will have the behavior you're seeking. Execution environments are what @erictraut's team uses to manage their monorepo. |
Execution environments are indeed helpful, in that it resolves the issue of resolving imports from outside the project path. This does require switching from Unfortunately, since it doesn't allow setting So I guess, if we can't get |
The execution environment model is not suited to have separate interpreters, unfortunately. There used to be support, but it was broken as it was never intended to work. Multi-root runs separate analyzers, so they are able to have separate interpreters. Execution environments are within an analyzer, and can only have one. We need to come up with a spec to better reconcile the idea of execution environments and multiroot into something that can capture how people are using. I think details on how your monorepo is laid out and what you're expecting would be helpful for that (though, this issue was about globbing, not that redesign 🙂) |
@jakebailey I'd be happy to support that effort in any way; we can move the interpreters/monorepo discussion. Here's an example of what I'm currently testing wtih. https://github.com/dermidgen/python-monorepo I yield the thread back to globbing 😁 |
any updates? |
Moving this issue to discussion as an enhancement request for comments and upvotes. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
I'm trying to setup a python monorepo build with bazel, and I'm struggling to make pylance recognize the library imports. I have managed to make it work by adding e.g.
<bazel-myproject>/external/<my-pip-dependencies>/pypi__numpy
topython.analysis.extraPaths
, but adding a line for each dependency on every computer we use doesn't seem to be right.My idea/request is that if we could add something like
dependencies/*/
ordependencies/pypi__*/
to the extra paths, it would solve this problem entirely. The expected behavior would be to add every (matching) directory underdependencies/
to the extra paths.The text was updated successfully, but these errors were encountered: