-
-
Notifications
You must be signed in to change notification settings - Fork 422
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
Option to exclude site-packages
from python path
#100
Comments
The behavior should affect two places:
While we can provide an option in the first situation, we can't make this behavior as optional in the second situation. |
@frostming it works for me. I do think that having system wide packages available with locally installed packages is a recipe for disaster. |
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. |
Just tested this and still get site-packages in
[tool.pdm]
version = { use_scm = true }
[[tool.pdm.source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[tool.pdm.scripts]
_.env_file = ".env"
cli = { call = "lib.python.__pdm.commands.cli:cli()" }
import sys
def cli() -> None:
print(sys.path)
|
@mgzenitech If you use |
Hi @frostming ! |
@mgzenitech The PYTHONPATH looks super weird to me. I never have to set it like that. for example |
@frostming |
@mgzenitech > is added only if you are not using any additional paths That is not correct, why do you think so? |
@frostming because I have tried it and it didn't add
And no packages from result from ['', '/home/mariusg/Documents/Projects/infra-terraform/lib/python', '/home/mariusg/.pyenv/versions/3.9.9/lib/python39.zip', '/home/mariusg/.pyenv/versions/3.9.9/lib/python3.9', '/home/mariusg/.pyenv/versions/3.9.9/lib/python3.9/lib-dynload', '/home/mariusg/.local/lib/python3.9/site-packages', '/home/mariusg/.pyenv/versions/3.9.9/lib/python3.9/site-packages'] |
i might know why, you are using a venv Python. check it by 'pdm info', the packages path shouldnt be empty @mgzenitech |
|
@mgzenitech it turns out to be a corner case that the running env overrides the preset ones. It is handled in #1211 |
@frostming superb! |
PEP 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
Suggested path list
Is this something that you are open to?
The text was updated successfully, but these errors were encountered: