Skip to content

getpath: Add comments highlighing details of the pyvenv.cfg detection #127966

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

Merged
merged 1 commit into from
Dec 15, 2024

Conversation

FFY00
Copy link
Member

@FFY00 FFY00 commented Dec 15, 2024

No description provided.

@FFY00 FFY00 enabled auto-merge (squash) December 15, 2024 15:17
@FFY00 FFY00 merged commit 3683b2f into python:main Dec 15, 2024
42 checks passed
# Search for the 'home' key in pyvenv.cfg. Currently, we don't consider the
# presence of a pyvenv.cfg file without a 'home' key to signify the
# existence of a virtual environment — we quietly ignore them.
# XXX: If we don't find a 'home' key, we don't look for another pyvenv.cfg!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is a bit confusing - there is only one searched path for pyvenv.cfg. Are you suggesting that there should be multiple places being looked at for pyvenv.cfg?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay getting back to you.

No, there are two paths, {executable_dir} and {executable_dir}/... Using the venv install scheme, pyvenv.cfg will be at {executable_dir}/.., but implementation also allows it to be alongside the executable.

See https://docs.python.org/3.14/c-api/init_config.html#init-path-config

If home is not set and a pyvenv.cfg file is present in the same directory as executable, or its parent, (...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants