Using Dependency Groups with uv
I've slowly been getting more familiar with uv and the broader new school of python packaging ecosystems (sorry, I used virtualenv
for a long time, it does the job fine), and one of the most exciting things to me is its use of dependency groups in a pyproject.toml
file: finally, a non-janky way to use different packages in different environments. However, I think its documentation leaves a bit to be desired on this front, so:
To add a package to a specific group:
uv add --group dev python-dotenv
Which should appear in your pyproject.toml
as:
[dependency-groups]
dev = [
"python-dotenv"