How do I add a dependency to a group like dev using uv add?
- User
How do I add a dependency to a group like dev using uv add?
Assistant
You can add a dependency to a development group using the
--groupflag:uv add --group dev package-nameFor example, to add pytest as a development dependency:
uv add --group dev pytestThis will add the package to the
[dependency-groups.dev]section in yourpyproject.tomlfile rather than the main[project.dependencies]section.You can also add multiple packages at once:
uv add --group dev pytest black mypyIf you need to specify version constraints, you can do that as well:
uv add --group dev "pytest>=7.0" "black>=22.0"
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.