-
-
Notifications
You must be signed in to change notification settings - Fork 420
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
Seek for other sitecustomize.py to import #422
Seek for other sitecustomize.py to import #422
Conversation
Codecov Report
@@ Coverage Diff @@
## master #422 +/- ##
==========================================
+ Coverage 83.36% 83.48% +0.11%
==========================================
Files 68 68
Lines 5289 5309 +20
Branches 937 944 +7
==========================================
+ Hits 4409 4432 +23
+ Misses 609 602 -7
- Partials 271 275 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
os.environ.pop("PEP582_PACKAGES", None) | ||
pythonpath = os.environ.pop("PYTHONPATH", "") | ||
pythonpath = remove_pep582_path_from_pythonpath(pythonpath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could make this simpler for testing, just clean the PYTHONPATH
here. No need to keep the old value. Test case can provide its value when running
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could not assume the development environment of others not taking PYTHONPATH in usage. Some may use nix to do development. And nix is using PYTHONPATH to import packages that may essential to pdm testings. For example, the pip package of python3.9 for downloading wheel files for testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know the approach used by nix.
9395b8e
to
4409b82
Compare
Pull Request Check List
news/
describing what is new.Describe what you have changed in this PR.
Try to use nix to build an isolating environment for PDM development. But pdm can not co-exist with Python packages in nix due to the import mechanism that Python only imports module once by name.
The Python in nix using sitecustomize.py to import packages and PDM also using it to enable PEP582 globally.
Hence, we need to make sure that another sitecustomize.py gets imported if it exists. So PDM can make PEP582 enabling globally, and Python in nix also can import its packages.