astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
19.87k stars 585 forks source link

FR: uv init --build-backend #6299

Open henryiii opened 3 weeks ago

henryiii commented 3 weeks ago

I think it would be nice to support several common backends with uv init. Current hatchling is the default (which is a great default), but it would be nice to be able to support compiled backends (maturin, scikit-build-core, and meson-python), and maybe a few other popular PEP 621 pure-python backends like setuptools, flit-core, and pdm-backend. This could also have a "none"-like option for packages that don't have a library component at all, and are just an application like a website.

If implemented, there would be an optional argument like --build-backend (or --backend if you'd rather shorter names) that would default to hatchling. But it would take other options. Selecting one of these would generate from a slightly different template, providing at least a different build-system.build-backend and build-system.requires. Ideally, especially for the compiled backends, the example file would be adjusted a bit as well.

https://github.com/scientific-python/cookie is an example of a cookiecutter that supports lots of backends. I'd keep the template simple, but this is example of something supporting this without too much effort.

charliermarsh commented 3 weeks ago

This makes sense to me.