uv/crates
Chan Kang 76a39c76f5
add `sys_path` to `Interpreter` struct (#3500)
<!--
Thank you for contributing to uv! To help us out with reviewing, please
consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary
likely necessary to resolve https://github.com/astral-sh/uv/issues/2500

made this a separate PR in an attempt to make the changes as small as
possible; let me know if it's preferred to keep them as a single PR.
<!-- What's the purpose of the change? What does it do, and why? -->

## Test Plan
- edited the test in `interpreter.rs`
- tested manually via `println!` 

```
$ cargo run --quiet pip show test
["/Users/chankang/Library/Caches/uv/.tmpKzNEPN", "/Users/chankang/.pyenv/versions/3.12.2/lib/python312.zip", "/Users/chankang/.pyenv/versions/3.12.2/lib/python3.12", "/Users/chankang/.pyenv/versions/3.12.2/lib/python3.12/lib-dynload", "/Users/chankang/repos/uv/.venv/lib/python3.12/site-packages"]
warning: Package(s) not found for: test
chankang@chans-Air ~/repos/uv -  (syspath)
$ git diff
diff --git a/crates/uv-interpreter/src/environment.rs b/crates/uv-interpreter/src/environment.rs
index 33b785ce..8ebf0864 100644
--- a/crates/uv-interpreter/src/environment.rs
+++ b/crates/uv-interpreter/src/environment.rs
@@ -106,6 +106,7 @@ impl PythonEnvironment {
     /// Some distributions also create symbolic links from `purelib` to `platlib`; in such cases, we
     /// still deduplicate the entries, returning a single path.
     pub fn site_packages(&self) -> impl Iterator<Item = &Path> {
+        println!("{:?}", self.interpreter.sys_path());
         if let Some(target) = self.interpreter.target() {
             Either::Left(std::iter::once(target.root()))
         } else {
chankang@chans-Air ~/repos/uv -  (syspath)
$ python -c "import sys; print(sys.path)"
['', '/Users/chankang/.pyenv/versions/3.12.2/lib/python312.zip', '/Users/chankang/.pyenv/versions/3.12.2/lib/python3.12', '/Users/chankang/.pyenv/versions/3.12.2/lib/python3.12/lib-dynload', '/Users/chankang/.pyenv/versions/3.12.2/lib/python3.12/site-packages']
chankang@chans-Air ~/repos/uv -  (syspath)
```

<!-- How was it tested? -->
2024-05-10 08:41:32 +02:00
..
bench pep508: un-export fields for MarkerEnvironment 2024-05-09 10:06:02 -04:00
cache-key Avoid panic for file url (#3306) 2024-04-29 16:39:16 +02:00
distribution-filename require serde and rkyv everywhere; remove optional serde and rkyv features (#3345) 2024-05-03 10:21:03 -04:00
distribution-types Track origin for setup.py files and friends (#3481) 2024-05-09 09:30:40 -04:00
install-wheel-rs Apply normcase to line from easy-install.pth (#3451) 2024-05-08 10:40:21 +02:00
once-map once-map: avoid hard-coding `Arc` (#3242) 2024-04-24 11:11:46 -04:00
pep440-rs Improve trailing version string error message (#3453) 2024-05-08 14:50:29 +02:00
pep508-rs pep508: use Arc inside of MarkerEnvironment 2024-05-09 10:06:02 -04:00
platform-tags Update Rust to v1.78 (#3361) 2024-05-03 20:07:13 +00:00
pypi-types Use Metadata10 to parse PKG-INFO of legacy editable (#3450) 2024-05-08 10:58:18 +02:00
requirements-txt Remove `Optional` from `with_origin` API (#3482) 2024-05-09 13:40:51 +00:00
uv Read and write `uv.lock` based on project root (#3497) 2024-05-09 19:54:10 +00:00
uv-auth Update pre-commit dependencies (#3391) 2024-05-06 02:18:51 +00:00
uv-build Remove unnecessary uses of `DashMap` and `Arc` (#3413) 2024-05-06 22:30:43 -04:00
uv-cache Update Rust to v1.78 (#3361) 2024-05-03 20:07:13 +00:00
uv-client pep508: un-export fields for MarkerEnvironment 2024-05-09 10:06:02 -04:00
uv-configuration pep508: un-export fields for MarkerEnvironment 2024-05-09 10:06:02 -04:00
uv-dev Track origin for setup.py files and friends (#3481) 2024-05-09 09:30:40 -04:00
uv-dispatch uv-resolver: make MarkerEnvironment optional 2024-05-09 09:24:37 -04:00
uv-distribution Remove unnecessary uses of `DashMap` and `Arc` (#3413) 2024-05-06 22:30:43 -04:00
uv-extract Use `into_par_iter` instead of `par_bridge` (#3435) 2024-05-07 19:38:35 +00:00
uv-fs Annotate sources of requirements (#3269) 2024-05-08 23:19:22 -04:00
uv-git Add branch and tag variants to Git reference (#3374) 2024-05-04 21:13:11 +00:00
uv-installer Track origin for setup.py files and friends (#3481) 2024-05-09 09:30:40 -04:00
uv-interpreter add `sys_path` to `Interpreter` struct (#3500) 2024-05-10 08:41:32 +02:00
uv-normalize Improve JSON Schema and add export script (#3461) 2024-05-08 16:15:16 +00:00
uv-requirements Use defaults in `RequirementsSpecification` constructors (#3495) 2024-05-09 19:27:59 +00:00
uv-resolver uv-resolver: push resolver state to its own type (#3492) 2024-05-09 14:16:43 -04:00
uv-trampoline Use c-string literals and update trampolines (#2590) 2024-03-21 15:36:00 +00:00
uv-types uv-resolver: make MarkerEnvironment optional 2024-05-09 09:24:37 -04:00
uv-version Bump version to v0.1.42 (#3472) 2024-05-08 17:47:16 -04:00
uv-virtualenv pep508: un-export fields for MarkerEnvironment 2024-05-09 10:06:02 -04:00
uv-warnings Rename to `uv` (#1302) 2024-02-15 11:19:46 -06:00
uv-workspace Disallow `pyproject.toml` files for non-project configuration (#3463) 2024-05-08 14:49:52 -04:00
README.md Rename `uv-traits` and split into separate modules (#2674) 2024-03-26 15:39:43 -05:00

README.md

Crates

bench

Functionality for benchmarking uv.

cache-key

Generic functionality for caching paths, URLs, and other resources across platforms.

distribution-filename

Parse built distribution (wheel) and source distribution (sdist) filenames to extract structured metadata.

distribution-types

Abstractions for representing built distributions (wheels) and source distributions (sdists), and the sources from which they can be downloaded.

install-wheel-rs

Install built distributions (wheels) into a virtual environment.]

once-map

A waitmap-like concurrent hash map for executing tasks exactly once.

pep440-rs

Utilities for interacting with Python version numbers and specifiers.

pep508-rs

Utilities for interacting with PEP 508 dependency specifiers.

platform-host

Functionality for detecting the current platform (operating system, architecture, etc.).

platform-tags

Functionality for parsing and inferring Python platform tags as per PEP 425.

uv

Command-line interface for the uv package manager.

uv-build

A PEP 517-compatible build frontend for uv.

uv-cache

Functionality for caching Python packages and associated metadata.

uv-client

Client for interacting with PyPI-compatible HTTP APIs.

uv-dev

Development utilities for uv.

uv-dispatch

A centralized struct for resolving and building source distributions in isolated environments. Implements the traits defined in uv-types.

uv-distribution

Client for interacting with built distributions (wheels) and source distributions (sdists). Capable of fetching metadata, distribution contents, etc.

uv-extract

Utilities for extracting files from archives.

uv-fs

Utilities for interacting with the filesystem.

uv-git

Functionality for interacting with Git repositories.

uv-installer

Functionality for installing Python packages into a virtual environment.

uv-interpreter

Functionality for detecting and leveraging the current Python interpreter.

uv-normalize

Normalize package and extra names as per Python specifications.

uv-package

Types and functionality for working with Python packages, e.g., parsing wheel files.

uv-requirements

Utilities for reading package requirements from pyproject.toml and requirements.txt files.

uv-resolver

Functionality for resolving Python packages and their dependencies.

uv-types

Shared traits for uv, to avoid circular dependencies.

pypi-types

General-purpose type definitions for types used in PyPI-compatible APIs.

uv-virtualenv

A venv replacement to create virtual environments in Rust.

uv-warnings

User-facing warnings for uv.

requirements-txt

Functionality for parsing requirements.txt files.