18d229e2bb1667f8fd9cd8a7669aecfe025801bc
5 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
630d3fde5c |
Merge uv-toolchain and uv-interpreter (#3265)
Moves all of `uv-toolchain` into `uv-interpreter`. We may split these out in the future, but the refactoring I want to do for interpreter discovery is easier if I don't have to deal with entanglement. Includes some restructuring of `uv-interpreter`. Part of #2386 |
||
|
|
44e39bdca3 |
Replace Python bootstrapping script with Rust implementation (#2842)
See https://github.com/astral-sh/uv/issues/2617 Note this also includes: - #2918 - #2931 (pending) A first step towards Python toolchain management in Rust. First, we add a new crate to manage Python download metadata: - Adds a new `uv-toolchain` crate - Adds Rust structs for Python version download metadata - Duplicates the script which downloads Python version metadata - Adds a script to generate Rust code from the JSON metadata - Adds a utility to download and extract the Python version I explored some alternatives like a build script using things like `serde` and `uneval` to automatically construct the code from our structs but deemed it to heavy. Unlike Rye, I don't generate the Rust directly from the web requests and have an intermediate JSON layer to speed up iteration on the Rust types. Next, we add add a `uv-dev` command `fetch-python` to download Python versions per the bootstrapping script. - Downloads a requested version or reads from `.python-versions` - Extracts to `UV_BOOTSTRAP_DIR` - Links executables for path extension This command is not really intended to be user facing, but it's a good PoC for the `uv-toolchain` API. Hash checking (via the sha256) isn't implemented yet, we can do that in a follow-up. Finally, we remove the `scripts/bootstrap` directory, update CI to use the new command, and update the CONTRIBUTING docs. <img width="1023" alt="Screenshot 2024-04-08 at 17 12 15" src="https://github.com/astral-sh/uv/assets/2586601/57bd3cf1-7477-4bb8-a8e9-802a00d772cb"> |
||
|
|
3799862f5d |
Trim injected python_version marker to (major, minor) (#2395)
## Summary Per [PEP 508](https://peps.python.org/pep-0508/), `python_version` is just major and minor:  Right now, we're using the provided version directly, so if it's, e.g., `-p 3.11.8`, we'll inject the wrong marker. This was causing `pandas` to omit `numpy` when `-p 3.11.8` was provided, since its markers look like: ``` Requires-Dist: numpy<2,>=1.22.4; python_version < "3.11" Requires-Dist: numpy<2,>=1.23.2; python_version == "3.11" Requires-Dist: numpy<2,>=1.26.0; python_version >= "3.12" ``` Closes https://github.com/astral-sh/uv/issues/2392. |
||
|
|
9cf7d113bc |
Improve interpreter discovery logging (#1909)
We had several cases where interpreter discovery fails. This PR improves
the verbose output to ensure interpreter discovery is debuggable for a
user.
In the process, i removed the custom gourgeist logic for the
uv_interpreter logic.
**venv creation**
```
$ uv venv -v -p 3.10
uv_interpreter::python_query::find_requested_python request=3.10
0.002389s 0ms DEBUG uv_interpreter::python_query Starting interpreter discovery for Python 3.10
uv_interpreter::python_query::windows::py_list_paths
0.016288s 14ms DEBUG uv_interpreter::interpreter Probing interpreter info for: C:\Users\Ferris\AppData\Local\Programs\Python\Python312\python.exe
0.072860s 70ms DEBUG uv_interpreter::interpreter Found Python 3.12.1 for: C:\Users\Ferris\AppData\Local\Programs\Python\Python312\python.exe
0.074303s 72ms DEBUG uv_interpreter::interpreter Probing interpreter info for: C:\Users\Ferris\AppData\Local\Programs\Python\Python38\python.exe
0.134311s 132ms DEBUG uv_interpreter::interpreter Found Python 3.8.10 for: C:\Users\Ferris\AppData\Local\Programs\Python\Python38\python.exe
x No Python 3.10 found through `py --list-paths` or in `PATH`. Is Python 3.10 installed?
error: process didn't exit successfully: `target\debug\uv.exe venv -v -p 3.10` (exit code: 1)
```
```
$ uv venv -v -p 3.10
uv_interpreter::python_query::find_requested_python request=3.10
0.001889s 0ms DEBUG uv_interpreter::python_query Starting interpreter discovery for Python 3.10
uv_interpreter::python_query::windows::py_list_paths
0.021488s 19ms DEBUG uv_interpreter::interpreter Cached interpreter info for Python 3.12.1, skipping probing: C:\Users\Ferris\AppData\Local\Programs\Python\Python312\python.exe
0.021945s 20ms DEBUG uv_interpreter::interpreter Cached interpreter info for Python 3.8.10, skipping probing: C:\Users\Ferris\AppData\Local\Programs\Python\Python38\python.exe
x No Python 3.10 found through `py --list-paths` or in `PATH`. Is Python 3.10 installed?
error: process didn't exit successfully: `target\debug\uv.exe venv -v -p 3.10` (exit code: 1)
```
```
$ uv venv -v -p 3.8
uv_interpreter::python_query::find_requested_python request=3.8
0.001896s 0ms DEBUG uv_interpreter::python_query Starting interpreter discovery for Python 3.8
uv_interpreter::python_query::windows::py_list_paths
0.013541s 11ms DEBUG uv_interpreter::interpreter Cached interpreter info for Python 3.8.10, skipping probing: C:\Users\Ferris\AppData\Local\Programs\Python\Python38\python.exe
Using Python 3.8.10 interpreter at C:\Users\Ferris\AppData\Local\Programs\Python\Python38\python.exe
Creating virtualenv at: .venv
Activate with: .venv\Scripts\activate
```
```
$ uv venv -v -p 3.12
uv_interpreter::python_query::find_requested_python request=3.12
0.001741s 0ms DEBUG uv_interpreter::python_query Starting interpreter discovery for Python 3.12
uv_interpreter::python_query::windows::py_list_paths
0.012807s 11ms DEBUG uv_interpreter::interpreter Cached interpreter info for Python 3.12.1, skipping probing: C:\Users\Ferris\AppData\Local\Programs\Python\Python312\python.exe
Using Python 3.12.1 interpreter at C:\Users\Ferris\AppData\Local\Programs\Python\Python312\python.exe
Creating virtualenv at: .venv
Activate with: .venv\Scripts\activate
```
**pip compile**
```
$ uv pip compile -v .\scripts\requirements\black.in
uv::requirements::from_source source=.\scripts\requirements\black.in
uv_interpreter::interpreter::find_best python_version=None
0.002071s 0ms DEBUG uv_interpreter::interpreter Starting interpreter discovery for active Python
0.002220s 0ms DEBUG uv_interpreter::virtual_env Found a virtualenv named .venv at: C:\Users\Ferris\projects\uv\.venv
0.002483s 0ms DEBUG uv_interpreter::interpreter Cached interpreter info for Python 3.12.1, skipping probing: C:\Users\Ferris\projects\uv\.venv\Scripts\python.exe
0.002581s DEBUG uv::commands::pip_compile Using Python 3.12.1 interpreter at C:\Users\Ferris\projects\uv\.venv\Scripts\python.exe for builds
```
```
$ uv pip compile -p 3.8 -v .\scripts\requirements\black.in
uv::requirements::from_source source=.\scripts\requirements\black.in
uv_interpreter::interpreter::find_best python_version=Some(PythonVersion(StringVersion { string: "3.8", version: "3.8" }))
0.002001s 0ms DEBUG uv_interpreter::interpreter Starting interpreter discovery for Python 3.8
0.002146s 0ms DEBUG uv_interpreter::virtual_env Found a virtualenv named .venv at: C:\Users\Ferris\projects\uv\.venv
0.002378s 0ms DEBUG uv_interpreter::interpreter Cached interpreter info for Python 3.12.1, skipping probing: C:\Users\Ferris\projects\uv\.venv\Scripts\python.exe
uv_interpreter::python_query::find_requested_python request=3.8
0.002509s 0ms DEBUG uv_interpreter::python_query Starting interpreter discovery for Python 3.8
uv_interpreter::python_query::windows::py_list_paths
0.015989s 13ms DEBUG uv_interpreter::interpreter Cached interpreter info for Python 3.8.10, skipping probing: C:\Users\Ferris\AppData\Local\Programs\Python\Python38\python.exe
0.016144s DEBUG uv::commands::pip_compile Using Python 3.8.10 interpreter at C:\Users\Ferris\AppData\Local\Programs\Python\Python38\python.exe for builds
```
```
$ uv pip compile -p 3.10 -v .\scripts\requirements\black.in
uv::requirements::from_source source=.\scripts\requirements\black.in
uv_interpreter::interpreter::find_best python_version=Some(PythonVersion(StringVersion { string: "3.10", version: "3.10" }))
0.002086s 0ms DEBUG uv_interpreter::interpreter Starting interpreter discovery for Python 3.10
0.002234s 0ms DEBUG uv_interpreter::virtual_env Found a virtualenv named .venv at: C:\Users\Ferris\projects\uv\.venv
0.002462s 0ms DEBUG uv_interpreter::interpreter Cached interpreter info for Python 3.12.1, skipping probing: C:\Users\Ferris\projects\uv\.venv\Scripts\python.exe
uv_interpreter::python_query::find_requested_python request=3.10
0.002589s 0ms DEBUG uv_interpreter::python_query Starting interpreter discovery for Python 3.10
uv_interpreter::python_query::windows::py_list_paths
0.017299s 14ms DEBUG uv_interpreter::interpreter Cached interpreter info for Python 3.12.1, skipping probing: C:\Users\Ferris\AppData\Local\Programs\Python\Python312\python.exe
0.018135s 15ms DEBUG uv_interpreter::interpreter Cached interpreter info for Python 3.8.10, skipping probing: C:\Users\Ferris\AppData\Local\Programs\Python\Python38\python.exe
0.020176s 18ms DEBUG uv_interpreter::virtual_env Found a virtualenv named .venv at: C:\Users\Ferris\projects\uv\.venv
0.020873s 18ms DEBUG uv_interpreter::interpreter Cached interpreter info for Python 3.12.1, skipping probing: C:\Users\Ferris\projects\uv\.venv\Scripts\python.exe
0.021116s DEBUG uv::commands::pip_compile Using Python 3.12.1 interpreter at C:\Users\Ferris\projects\uv\.venv\Scripts\python.exe for builds
warning: The requested Python version 3.10 is not available; 3.12.1 will be used to build dependencies instead.
```
|
||
|
|
2586f655bb |
Rename to uv (#1302)
First, replace all usages in files in-place. I used my editor for this. If someone wants to add a one-liner that'd be fun. Then, update directory and file names: ``` # Run twice for nested directories find . -type d -print0 | xargs -0 rename s/puffin/uv/g find . -type d -print0 | xargs -0 rename s/puffin/uv/g # Update files find . -type f -print0 | xargs -0 rename s/puffin/uv/g ``` Then add all the files again ``` # Add all the files again git add crates git add python/uv # This one needs a force-add git add -f crates/uv-trampoline ``` |