uv/crates/uv-python/src
Charlie Marsh 3398cb1902
Respect `include-system-site-packages` in layered environments (#11873)
## Summary

We use a similar strategy to the ephemeral overlay: set
`include-system-site-packages` in the `pyvenv.cfg`, and clear it
whenever we access a new environment.

Closes https://github.com/astral-sh/uv/issues/11829.

## Test Plan

Difficult to test because we don't really have support for system
packages in our test infrastructure. But...

```
> uv venv --system-site-packages
> ['', '/Users/crmarsh/.local/share/uv/python/cpython-3.13.0-macos-aarch64-none/lib/python313.zip', '/Users/crmarsh/.local/share/uv/python/cpython-3.13.0-macos-aarch64-none/lib/python3.13', '/Users/crmarsh/.local/share/uv/python/cpython-3.13.0-macos-aarch64-none/lib/python3.13/lib-dynload', '/Users/crmarsh/.cache/uv/archive-v0/AhKcORkaCdbBl31VweRtG/lib/python3.13/site-packages', '/Users/crmarsh/workspace/uv/foo/.venv/lib/python3.13/site-packages', '/Users/crmarsh/.local/share/uv/python/cpython-3.13.0-macos-aarch64-none/lib/python3.13/site-packages']
```

```
> uv venv
> ['', '/Users/crmarsh/.local/share/uv/python/cpython-3.13.0-macos-aarch64-none/lib/python313.zip', '/Users/crmarsh/.local/share/uv/python/cpython-3.13.0-macos-aarch64-none/lib/python3.13', '/Users/crmarsh/.local/share/uv/python/cpython-3.13.0-macos-aarch64-none/lib/python3.13/lib-dynload', '/Users/crmarsh/.cache/uv/archive-v0/AhKcORkaCdbBl31VweRtG/lib/python3.13/site-packages', '/Users/crmarsh/workspace/uv/foo/.venv/lib/python3.13/site-packages']
```
2025-02-28 22:22:37 -05:00
..
sysconfig Patch pkg-config files to be relocatable (#11291) 2025-02-07 17:03:55 -06:00
cpuinfo.rs Fix hard and soft float libc detection for managed Python distributions on ARM (#8498) 2024-10-29 23:46:21 +00:00
discovery.rs Upgrade Rust toolchain to 1.85 (#11720) 2025-02-23 16:52:34 +01:00
downloads.inc Make fetch python downloads deterministic (#11572) 2025-02-17 08:36:38 -06:00
downloads.inc.mustache Allow download of Python distribution variants with newer CPU instruction sets (#9781) 2024-12-10 14:26:45 -06:00
downloads.rs Allow use of x86-64 Python on ARM Windows (#11625) 2025-02-19 12:01:46 -06:00
environment.rs Respect `include-system-site-packages` in layered environments (#11873) 2025-02-28 22:22:37 -05:00
implementation.rs Prefer Python executable names that match the request over default names (#9066) 2024-11-13 10:00:23 -06:00
installation.rs Allow fallback to Python download on non-critical discovery errors (#10908) 2025-01-23 22:37:02 +00:00
interpreter.rs Revert: Include environment variables in interpreter info caching (#11622) 2025-02-19 10:10:21 -06:00
lib.rs uv-python tests: Use #!/bin/sh instead of #!/bin/bash (#11292) 2025-02-07 09:42:33 -06:00
libc.rs Consistently write log messages with capitalized first word (#11111) 2025-01-30 18:56:46 +00:00
macos_dylib.rs Install and remove managed Python to and from the Windows Registry (PEP 514) (#10634) 2025-01-23 14:13:41 +00:00
managed.rs Allow use of x86-64 Python on ARM Windows (#11625) 2025-02-19 12:01:46 -06:00
microsoft_store.rs Install and remove managed Python to and from the Windows Registry (PEP 514) (#10634) 2025-01-23 14:13:41 +00:00
platform.rs Allow use of x86-64 Python on ARM Windows (#11625) 2025-02-19 12:01:46 -06:00
pointer_size.rs Change "toolchain" to "python" (#4735) 2024-07-03 07:44:29 -05:00
prefix.rs Add `uv-` prefix to all internal crates (#7853) 2024-10-01 20:15:32 -04:00
python_version.rs Avoid using owned `String` in deserializers (#11764) 2025-02-25 14:28:16 +00:00
target.rs Add `uv-` prefix to all internal crates (#7853) 2024-10-01 20:15:32 -04:00
version_files.rs Discover and respect `.python-version` files in parent directories (#6370) 2024-11-07 14:29:54 -06:00
virtualenv.rs Respect `include-system-site-packages` in layered environments (#11873) 2025-02-28 22:22:37 -05:00
windows_registry.rs Update windows registry to 0.5 (#11799) 2025-02-26 16:33:31 +01:00