Skip to content

Use sitecustomize.py to implement environment layering - #5462

Merged
charliermarsh merged 1 commit into
mainfrom
charlie/rev
Jul 25, 2024
Merged

charliermarsh merged 1 commit into
mainfrom
charlie/rev

Conversation

@charliermarsh

Copy link
Copy Markdown
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
Comment thread crates/uv/tests/run.rs
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
Copy Markdown
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
@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