chore: add PEP 723 metadata for various bin/ scripts, drop bin dependency group#2819
chore: add PEP 723 metadata for various bin/ scripts, drop bin dependency group#2819agriyakhetarpal wants to merge 12 commits intopypa:mainfrom
bin/ scripts, drop bin dependency group#2819Conversation
joerick
left a comment
There was a problem hiding this comment.
Some of the nox sessions install script deps themselves too, for example update_constraints installs click, that can probably also be DRY'd up with a call to install_and_run_script. Maybe that's the only example actually...
Co-Authored-By: Henry Schreiner <HenrySchreinerIII@gmail.com>
Co-Authored-By: Henry Schreiner <HenrySchreinerIII@gmail.com>
Co-Authored-By: Joe Rickerby <1244307+joerick@users.noreply.github.com>
|
Locally, the session went from 50 seconds to 6 seconds (nice!): nox > Running session update_how_it_works_image
nox > Creating virtual environment (uv) using python in .nox/update_how_it_works_image
nox > uv pip install playwright
nox > python bin/update_how_it_works_image.py
nox > Session update_how_it_works_image was successful in 6 seconds.I restored the image with what we have on |
noxfile.py
Outdated
|
|
||
| nox.needs_version = ">=2025.2.9" | ||
| nox.options.default_venv_backend = "uv|virtualenv" | ||
| nox.options.default_venv_backend = "uv" |
There was a problem hiding this comment.
I suppose it's okay to make uv the default, since it's the runner that we are going to use for PEP 723 going forward. Also, we're at 0.9.18 now, so 0.1.23 was pretty old!
There was a problem hiding this comment.
This means that a user running our noxfile must have uv installed. And we don't use uv to run it, we use nox (install_and_run_script)? <any PEP 723 runner> script.py works, the shabang is only for what is needed for ./script.py.
There was a problem hiding this comment.
Oh, I thought nox was delegating to uv for its PEP 723 runner implementation, instead of having its own. Thanks for the correction!
There was a problem hiding this comment.
I'd prefer that people use uv for the bin scripts, though, or run them through nox. Unless you feel otherwise, or if there's a better way.
There was a problem hiding this comment.
If they use ./script.py, sure, but they can use whatever they want if they run it themselves.
bin/ scripts, drop bin dependency group
|
FWIW, I generally keep setup-python, as it's faster than uv on non-EoL Pythons since python is already installed on the runners, and not installing (<1 second) is faster than installing, even if uv is fast at installing (8 seconds on Windows). |
|
Also setup-python installs universal macOS binaries, while uv doesn't. |
This reverts commit 663db5c.
|
Thanks, I didn't know about that. Reverted! |
See #2816 (comment). This PR adds inline script metadata for all our scripts. Some scripts import cibuildwheel, and not all of these scripts need such metadata because they run within a
noxsession that installs thebindependency group. Still, it's nice to see all the dependencies up top from a quick look :)I had to move the Playwright Chromium installation to a subprocess, which is a bit hacky, but it works all well. I regenerated the image, wherein I realised that Playwright does the exact same thing I did in #2815 (capture a screenshot of the node), except the difference is the font. My macOS machine uses Helvetica Neue, while this one looks like a different one (DejaVu Sans? Not sure). I kinda like this one better!
Edit: I restored the image with what we have on
main, as suggested.