Refactor find-downloads.py
Changes in this PR
- Removed the old
rye/find-downloads.pyafter #644. - Instroduces a
Finderbase class, and implement logic inCPythonFinderandPyPyFindersubclasses. - Instead of fetching
xxx.sha256for each file, fetch a singleSHA256SUMSfile which contains checksums for all files in the release.
Before:
❯ time rye run find-downloads > rye/src/downloads.inc
Rye download creator started.
Fetching indygreg downloads...
Fetching page 1
Fetching page 2
Fetching page 3
fetching 25 sha256s: 0/356 completed
fetching 25 sha256s: 25/356 completed
fetching 25 sha256s: 50/356 completed
fetching 25 sha256s: 75/356 completed
fetching 25 sha256s: 100/356 completed
fetching 25 sha256s: 125/356 completed
fetching 25 sha256s: 150/356 completed
fetching 25 sha256s: 175/356 completed
fetching 25 sha256s: 200/356 completed
fetching 25 sha256s: 225/356 completed
fetching 25 sha256s: 250/356 completed
fetching 25 sha256s: 275/356 completed
fetching 25 sha256s: 300/356 completed
fetching 25 sha256s: 325/356 completed
fetching 25 sha256s: 350/356 completed
Generating code and fetching sha256 of all cpython downloads.
This can be slow......
________________________________________________________
Executed in 45.78 secs fish external
usr time 3.20 secs 0.15 millis 3.20 secs
sys time 0.43 secs 1.29 millis 0.43 secs
After:
❯ time rye run find-downloads > rye/src/downloads.inc
Fetching all Python downloads and generating code.
Finding cpython downloads...
Fetching indygreg release page 1
Fetching indygreg release page 2
Fetching indygreg release page 3
Fetching indygreg checksums: 0/29
Fetching indygreg checksums: 10/29
Fetching indygreg checksums: 20/29
Finding pypy downloads...
________________________________________________________
Executed in 8.39 secs fish external
usr time 575.98 millis 136.00 micros 575.85 millis
sys time 124.18 millis 963.00 micros 123.22 millis
Planned for Future PRs
- [ ] Regenerate the latest
downloads.inc#683 - [ ] Implement the
PyPyFinder#683 - [ ] Add an GitHub Action to run
find-downloads.pydaily and create PR automatically - [ ] ~Add more Python implementaion build, like IronPython/Jython/Anaconda/MiniAnaconda?~
Thanks @dsp for the previous work. Your review of these changes would be greatly appreciated!
I'm watching this as we copied the script over to uv with some small changes (https://github.com/astral-sh/uv/blob/b317e6fc56d3f03d0a68a45784aac8936c2fbc9a/scripts/bootstrap/fetch-version-metadata.py)
We'll probably just copy over the latest one once we actually have Python toolchain management though.
@dsp Thanks for your review! I have fixed the test, and reorganized the commits to be more meaningful, hope it make the review easier.
Looks good to me. Thank you for the changes. It's a really nice improvement.
/cc @mitsuhiko
lgtm!