Skip to content
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

Remove current directory from PATH in PEP 517 hooks #1975

Merged
merged 1 commit into from
Feb 26, 2024
Merged

Conversation

charliermarsh
Copy link
Member

Summary

When you invoke python -c, an empty string is prepended to sys.path, which allows loading modules in the current directory (https://docs.python.org/3/using/cmdline.html#cmdoption-P). However, in PEP 517 builds, the current directory should not be part of the path. There's a flag we can use to disable this behavior (-P), but it's only available in Python 3.11 and later, so instead, I'm doing something similar to pip's __main__.py, which avoids this for python -m pip invocations.

Closes #1972.

@charliermarsh charliermarsh added the bug Something isn't working label Feb 26, 2024
@charliermarsh charliermarsh enabled auto-merge (squash) February 26, 2024 01:05
@charliermarsh charliermarsh merged commit 088fa97 into main Feb 26, 2024
7 checks passed
@charliermarsh charliermarsh deleted the charlie/cwd branch February 26, 2024 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Workspace package name clash with builtins - when uv is enabled
1 participant