pypa / cibuildwheel

🎡 Build Python wheels for all the platforms with minimal configuration.
https://cibuildwheel.pypa.io
Other
1.88k stars 239 forks source link

chore: use dependency-groups #2064

Closed henryiii closed 6 days ago

henryiii commented 3 weeks ago

Using dependency groups for cibuildwheel itself.

henryiii commented 3 weeks ago

Cirrus: Failed to start an instance: FAILED_PRECONDITION: Monthly compute limit exceeded!

Trying to restart now that it's next month. Also, saw this:

Only ghcr.io/cirruslabs/macos-runner:sonoma is allowed. Automatically upgraded
henryiii commented 3 weeks ago

Nox is just Python, and TOML support was added some time ago. So it's not required to wait for a nox release. I've updated the noxfile.

henryiii commented 1 week ago

Okay to go in?

henryiii commented 1 week ago

Using a tool to read the dependency groups doesn't seem too bad to me; pip won't support this until 25.1 at the earliest. But we can either put this in of the next release, or the 3.0 release, or wait, this doesn't affect end users, only developers.

joerick commented 1 week ago

Whats the proposed way to setup a dev environment with this? I still use pip install -e '.[dev]'. I'm not using uv habitually yet. Maybe the answer is uv, but it would be nice to have that documented somewhere. I know I can run tests with nox, but I still like to have a live venv I can point mypy/pyright to from my editor.

(I guess if we waited for pip to have support, that would take away this question)

henryiii commented 1 week ago

uv doesn't support this via pip install * yet. The uv way to set this up would be to run uv sync. That will make a .venv environment that has an editable install of the project and the dev group in it, and vscode, etc. will find it automatically. Also all uv run commands will do this for you too. uv run cibuildwheel, for example, will set up a venv as needed, install dev dependencies as needed, and then run the requested command inside that venv. I've really liked using that everywhere, as it's fast, doesn't require setup, and doesn't require much if any config.

The non-uv way to do this is to pip/pipx install dependency-groups, then use that to generate the list of items you want to install. It also provides a pip wrapper that installs dependency groups, though I like dependency-groups --group dev | xargs pip install -e. better. uvx dependency-groups --group dev | xargs pip install -e. is a one liner if you have uv. Or pipx run dependency-groups --group dev | xargs pip install -e. is a one liner if you have pipx.

We can also export this, as I mentioned... somewhere, with dependency-groups --group dev > requirements-dev.txt.

Pip PR here: https://github.com/pypa/pip/pull/13065

joerick commented 1 week ago

Thanks @henryiii, I've added that info into contributing.md.

henryiii commented 1 week ago

Okay, waiting for @mayeut to update review, then.

mayeut commented 6 days ago

Thanks @henryiii, all good now.

mayeut commented 6 days ago

we missed the gitlab update which only runs on branches in the repo.