Option to exclude `site-packages` from python path
See original GitHub issuePEP 582, as it is today only adds __pypackages__
to the list of discovery paths. This might lead to the usage of globally installed packages by mistake.
I think it would be very useful if it were possible to remove global python paths on a per project basis. Maybe a flag on the pyproject.toml file.
Assuming a project in /Users/foo/projects/bar on macOS using python3.8 installed using official installers:
-
Current path list
['', '/Users/foo/projects/bar/pdm/__pypackages__/3.8/lib', '/Users/foo/projects/bar/pdm', '/Library/Frameworks/Python.framework/Versions/3.8/lib/python38.zip', '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8', '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/lib-dynload', '/Users/foo/Library/Python/3.8/lib/python/site-packages', '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages' ]
-
Suggested path list
['', '/Users/foo/projects/bar/pdm/__pypackages__/3.8/lib', '/Users/foo/projects/bar/pdm', '/Library/Frameworks/Python.framework/Versions/3.8/lib/python38.zip', '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8', '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/lib-dynload', ]
Is this something that you are open to?
Issue Analytics
- State:
- Created 3 years ago
- Comments:14
Top Results From Across the Web
How do I remove my system's 'site-packages' from the search ...
The easiest option is to pass -S to python on the command line, as described in the documentation.
Read more >Understanding site-packages directories
Launching Python with the -S option will disable importing site , which means this directory will be excluded.
Read more >add an option to exclude site-packages - Launchpad Bugs
We need an option in buildout that can be used to run the buildout without including site-packages. With the Grok project we now...
Read more >Excluded folders are included in Python path
PyCharm simply ignores Excluded folders, it doesn't remove them from PYTHONPATH. >When running without the Python Console, source roots are NOT ...
Read more >How to Exclude Folders in PyCharm - mothergeo
PyCharm allows you to exclude directories from consideration when searching and refactoring. You can exclude a directory by right-clicking on it and ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mgzenitech it turns out to be a corner case that the running env overrides the preset ones. It is handled in #1211
Still waiting for the CI to pass(something is going wrong with GitHub actions), the next release should come out in the next 2 days after the PR is merged.