uv/crates/uv-python
Jo 0a6efe4d26
Refactor fetch-download-metadata.py script (#4853)
## Summary

Similiar to https://github.com/astral-sh/rye/pull/680, I have made a
major refactor to the `fetch-download-metadata.py` script.

Some notable changes:

- Use PEP 723 inline scripts
- Fully type annotated the script
- Implemented async HTTP fetching
- Introduced a `Finder` base class and move finder logic under
`CPythonFinder` subclass, which will make it easier to add a
`PyPyFinder` later.
- Instead of fetching `xxx.sha256` for each file, the script now fetches
a single `SHA256SUMS` file containing checksums for all files in the
release.

As a result, the script now takes around 10 seconds instead of 10+
minutes.

## Plan for Future PRs

- [ ] Implement the `PyPyFinder`
- [ ] Add an GitHub Action to run `fetch-download-metadata.py` daily and
create PR automatically

## Test Plan

```sh
cargo run -- run --isolated -- ./crates/uv-python/fetch-download-metadata.py
```
2024-07-23 03:06:25 +00:00
..
python Change "toolchain" to "python" (#4735) 2024-07-03 07:44:29 -05:00
src Add color to python pin CLI (#5215) 2024-07-19 13:19:28 -04:00
Cargo.toml Search for all python3.x in PATH (#5148) 2024-07-18 17:00:01 +02:00
download-metadata.json Update standalone Pythons to include 3.12.4 (#5042) 2024-07-14 01:51:47 +00:00
fetch-download-metadata.py Refactor fetch-download-metadata.py script (#4853) 2024-07-23 03:06:25 +00:00
template-download-metadata.py Refactor fetch-download-metadata.py script (#4853) 2024-07-23 03:06:25 +00:00