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

Use sitecustomize.py to implement environment layering #5462

Merged
merged 1 commit into from
Jul 25, 2024

Conversation

charliermarsh
Copy link
Member

Summary

After consultation with @carljm, we learned that modifying PYTHONPATH is insufficient, because Python won't resolve .pth files (editables) in the base environment. We also saw in #5459 that continuously appending to PYTHONPATH can have some unintended effects.

This PR instead uses a sitecustomize.py in the ephemeral environment to add the base environment's site-packages.

Closes #5459.

@charliermarsh charliermarsh added the bug Something isn't working label Jul 25, 2024
@charliermarsh charliermarsh marked this pull request as ready for review July 25, 2024 23:19
@charliermarsh charliermarsh added the preview Experimental behavior label Jul 25, 2024
Resolved 1 package in [TIME]
Prepared 1 package in [TIME]
Installed 1 package in [TIME]
+ foo==1.0.0 (from file://[TEMP_DIR]/)
Copy link
Member Author

Choose a reason for hiding this comment

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

Amazingly, this test fails on main. Can't believe we hadn't tried this yet.

@charliermarsh charliermarsh merged commit e4d1039 into main Jul 25, 2024
55 checks passed
@charliermarsh charliermarsh deleted the charlie/rev branch July 25, 2024 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working preview Experimental behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Python environment "layering" Rye vs Uv
1 participant