Open judej opened 9 months ago
we just converted this back to an issue to add it to our roadmap
Any ETA on this?
As has been explained in other threads, I don't think it will work to add globs for extraPaths. The problem is that extraPaths is order dependent. The order affects import resolution behavior. Globs is an order-independent mechanism. If you want to add extra paths to your project, you should specify them one at a time in the order you intend for imports to be resolved.
We could make it deterministic by saying globs resolve alphabetically.
@itsdani @dpar39 it has been a while but can you guys provide us more detail on the scenario? and we have add extra path
code action to help these kinds of situation and wonder why that didn't work?
We have given up on using Bazel and I work on very different things since I requested it 3 years ago, I'm not even using Pylance anymore. Maybe someone currently experiencing this issue could provide more detail. I can only repeat what I already said in the other thread: https://github.com/microsoft/pylance-release/discussions/2712#discussioncomment-6799676
Bazel puts each Python dependency in its own directory for sandboxing reasons. Our extraPaths is 601 lines long, and we have to manually update it when our Python dependency tree changes.
Here's a small snippet so you can see what it looks like:
"external/rules_python~~pip~pip_310_google_re2/site-packages",
"external/rules_python~~pip~pip_310_google_resumable_media/site-packages",
"external/rules_python~~pip~pip_310_googleapis_common_protos/site-packages",
"external/rules_python~~pip~pip_310_graphviz/site-packages",
"external/rules_python~~pip~pip_310_greenlet/site-packages",
"external/rules_python~~pip~pip_310_grpcio/site-packages",
"external/rules_python~~pip~pip_310_grpcio_status/site-packages",
"external/rules_python~~pip~pip_310_grpcio_tools/site-packages",
It's that for 600 packages.
Instead if we could do something like "external/rules_python~~pip~pip_310_*/site-packages",
, we would be all set and wouldn't have to keep the list in sync with Bazel.
Thanks!
@adzenith a few questions.
PYTHONPATH
? or Bazel
provide some special import
logic for this?external/rules_python....
?I am not sure we want to support glob
on extraPath
, but we might add support for Bazel
env directly if it has some common patterns, we can add support for.
pyproject.toml
file.external
, to the Bazel build output tree where the Python libs are stored.I don't need a glob specifically; I just assumed that would be the easiest to implement. If Bazel's output tree if directly supported that would also suit my needs just fine. Thanks!
Discussed in https://github.com/microsoft/pylance-release/discussions/2712