-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Use a custom sitecustomize.py
/ wrapper entry point to manipulate sys.path
#7959
Comments
Is there a roadmap for this feature? The import package precedence issues seems to cause a lot of non-trivial issues when using python3 for me. (Even when using the new python-toolchain flow). Update after 27.0 release:
|
@brandjon Do you think this is still a P2? If so, do you think we should turn it over to ask for help from the community? |
Hi there! We're doing a clean up of old issues and will be closing this one. Please reopen if you’d like to discuss anything further. We’ll respond as soon as we have the bandwidth/resources to do so. |
I think this is even more important now that bzlmod has been released. If you create a repo At the moment, to the best of my knowledge, there's no way to write |
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs. If you think this issue is still relevant and should stay open, please post any comment here and the issue will no longer be marked as stale. |
There are a few issues that relate to the initialization of
sys.path
./home/brandjon/.local/lib/python3.6/site-packages
)sys.path
We may be able to address some of this by generating a custom
sitecustomize.py
file, and ensuring it's given priority by manipulating thePYTHONPATH
in the stub script.Another alternative is to insert another level of indirection before the user's entry point, by creating a wrapper module that runs in the same Python interpreter process as the user code, and that initializes
sys.path
appropriately. This may affect thesys
environment as seen by user code, e.g.sys.argv[0]
, though maybe the wrapper module could cover some of that up.Then the question is, if we have an in-process wrapper module anyway, can we get rid of the stub script (which runs in a separate Python process) and thereby solve issues like #544? Or is there some initialization work that has to be done before the real Python process is launched, and that would be tedious to offload into a non-Python launcher script?
The text was updated successfully, but these errors were encountered: