Skip to content

use dependency groups instead of extras for dev dependencies#2543

Draft
artpelling wants to merge 2 commits into
mainfrom
dependency-groups
Draft

use dependency groups instead of extras for dev dependencies#2543
artpelling wants to merge 2 commits into
mainfrom
dependency-groups

Conversation

@artpelling

Copy link
Copy Markdown
Member

I would suggest to use dependency-groups instead of project.optional-dependencies for all development dependencies.

The change is pretty minor but is the recommended way of handling dev dependencies. The main difference is that dependency-groups are not included when packaging, making the package smaller whereas project.optional-dependencies are meant for package extras with optional features.

The other (minor) benefit is that it makes the dev workflow a bit cleaner, especially with uv, where dev is activated by default. The linting command is then uv run ruff check instead of uv run --with ".[dev]" ruff check. Also, it removes the problem with the [] characters in some shells like zsh. The pip command becomes pip install --group dev . .

I just changed the pyproject.toml for demonstration, I briefly looked at CI but got scared quickly. Migration might not be worth the headache...

@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

This pull request modifies pyproject.toml or requirements-ci-oldest-pins.in.
In case dependencies were changed, make sure to call

make ci_requirements

and commit the changed files to ensure that CI runs with the updated dependencies.

@artpelling

Copy link
Copy Markdown
Member Author

I've updated the CI requirements. Of course, conda does not support optional-dependencies so I had to repeat the tests dependencies which is not ideal. Maybe there is an elegant solution (dropping conda support 🤔)

@codecov

codecov Bot commented Apr 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.19%. Comparing base (648a321) to head (bf05d65).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
Flag Coverage Δ
github_actions 78.61% <ø> (ø)
gitlab_ci 88.12% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sdrave

sdrave commented Apr 13, 2026

Copy link
Copy Markdown
Member

Hi @artpelling! I fully agree that we should use dependency groups at some point. However, conda-lock not supporting them (conda/conda-lock#857) is kind of a showstopper. Getting rid of the conda tests is not an option, since there are some dependency/platform combinations, for which there is no alternative (at least slycot on windows). Pixi might be an alternative to conda-lock at some point, but last time I checked there were issues as well. For now, I would prefer waiting a little longer and hoping that conda-lock gains dependency group at some point. (A workaround might be to write a script which extracts the data from the dependency group and feeds it to conda-lock.)

@artpelling

Copy link
Copy Markdown
Member Author

Hi @artpelling! I fully agree that we should use dependency groups at some point. However, conda-lock not supporting them (conda/conda-lock#857) is kind of a showstopper. Getting rid of the conda tests is not an option, since there are some dependency/platform combinations, for which there is no alternative (at least slycot on windows). Pixi might be an alternative to conda-lock at some point, but last time I checked there were issues as well. For now, I would prefer waiting a little longer and hoping that conda-lock gains dependency group at some point. (A workaround might be to write a script which extracts the data from the dependency group and feeds it to conda-lock.)

I agree, I thought I quickly take a stab at it. Feel free to close the PR :)

@sdrave

sdrave commented Apr 13, 2026

Copy link
Copy Markdown
Member

I'll keep the PR open, but make it a draft, since we'll want to use dependency groups eventually.

@sdrave sdrave marked this pull request as draft April 13, 2026 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants