Support Bazel sandboxs for imports #2923
Replies: 5 comments
-
Just to check if this is different than #275, does this work as expected if you use MPLS (languageServer set to Microsoft), which does support PYTHONPATH? |
Beta Was this translation helpful? Give feedback.
-
I have not be able to get feature from MPLS, which is not to say it is not possible. I do not believe supporting From a user perspective it would be having the ability to specify an extraPath with variable substitution, such as "bazel-bin/${relativeFileDirname}/${fileBasenameNoExtension}.runfiles/main", and disable other search paths other than the python environment search paths. I imagine that would be hard to handle efficiently on the language server side. |
Beta Was this translation helpful? Give feedback.
-
We also have this issue where I work. If full support of the variable expansion in
This is assuming that extraPaths is able to correctly follow symlinks. |
Beta Was this translation helpful? Give feedback.
-
Moving this issue to discussion as an enhancement request for comments and upvotes. |
Beta Was this translation helpful? Give feedback.
-
It's been almost five years since this issue was raised, and I wonder how you manage it today. Has any official support been implemented, or any known gotchas? Thanks. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Pylance by default assumes that your entire source tree is visible to every python file, which may not be true in production. Integration of build systems and pylance may be out of scrobe, but perhaps this request will introduce functionality that would enable a build system aware extension to do the right thing.
If you are using the Bazel build system for each python build target it will create a directory that looks like the declared runtime environment. Specifically, it creates symlinks to all of the files declared as build dependencies. You can use vscode to test if the built python program using a
launch.json
file like:If there was a way to tell pylance to use a relative path like the one specified as the PYTHONPATH above as the root directory import lookup it would really amazing.
Beta Was this translation helpful? Give feedback.
All reactions