uv/scripts
Zanie Blue 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="57bd3cf1-7477-4bb8-a8e9-802a00d772cb">
2024-04-10 11:22:41 -05:00
..
bench Expand documentation in scripts/bench/__main__.py (#2875) 2024-04-08 02:48:12 +00:00
benchmarks Rename to uv (#1302) 2024-02-15 11:19:46 -06:00
links Add backtracking tests for distribution incompatibilities (#2839) 2024-04-05 18:16:18 +00:00
packages Remove additional 'because' (#2849) 2024-04-06 10:58:23 -04:00
popular_packages Finish install-many with pypi 10k most dependents (#732) 2023-12-27 09:42:51 -05:00
release Move bump.sh to scripts/release.sh (#2787) 2024-04-02 23:25:27 +00:00
requirements DRY up local wheel path in distribution database (#2901) 2024-04-08 10:40:17 -04:00
scenarios Replace Python bootstrapping script with Rust implementation (#2842) 2024-04-10 11:22:41 -05:00
check_cache_compat.py fix typos (#2804) 2024-04-03 11:57:19 +00:00
check_system_python.py Don't install pydantic_core on Python 3.13 (#2595) 2024-03-21 14:15:43 -04:00
release.sh Fixups to release.sh and sync_scenarios.sh (#2790) 2024-04-03 01:59:58 +00:00
sync_scenarios.sh Fixups to release.sh and sync_scenarios.sh (#2790) 2024-04-03 01:59:58 +00:00
transform_readme.py Add top-level benchmark to the README (#2622) 2024-03-22 16:07:31 -04:00