Skip to content

chore: use dependency groups (PEP 735) - #106

Merged
wpbonelli merged 1 commit into
MODFLOW-ORG:developfrom
mwtoews:pep-735
Aug 12, 2026
Merged

chore: use dependency groups (PEP 735)#106
wpbonelli merged 1 commit into
MODFLOW-ORG:developfrom
mwtoews:pep-735

Conversation

@mwtoews

@mwtoews mwtoews commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Use dependency groups, which is a standard Python feature introduced in PEP 735 to group a list of project dependencies, usually for internal development. This is preferred instead of creating optional dependencies, which is a user-facing option to install package extras.

Note that uv sync will include the "dev" group by default.

@wpbonelli wpbonelli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mwtoews, is compatibility with older versions of pip not sufficient reason to have both dependency-groups and optional-dependencies? It's a bit of a pain to keep them in sync but we already do so in devtools. The main motivation there is not pip compatibility, it's that the groups are user-facing, not just internal. But I wonder if it's worth supporting older pip for a while, since PEP 735 support came only last year.

@mwtoews

mwtoews commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

I don't think that duplication of lists of dependencies for both dependency-groups and optional-dependencies is necessary for pip compatibility for a few reasons:

  • These groups (test, lint, and docs) are only useful for developers, and most developers should normally use recent pip versions that support --group, usually in virtual environments.
  • These changes don't impact users with older versions of pip. For example pip install --dry-run modflowapi[nonexisting] would just show "warning: The package modflowapi==0.2.0 does not have an extra named nonexisting", but will still install the package.
  • Furthermore, I haven't seen any other modern Python project duplicate lists of dependencies, except for modflow-devtools (which confused me initially).

@wpbonelli

Copy link
Copy Markdown
Member

Is it atypical for projects to have both internal and user-facing groups? What do you suggest doing for e.g. devtools and flopy?

@wpbonelli
wpbonelli merged commit e784932 into MODFLOW-ORG:develop Aug 12, 2026
34 checks passed
@mwtoews
mwtoews deleted the pep-735 branch August 12, 2026 02:52
@mwtoews

mwtoews commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

I think extras are pretty useful user-facing options, but they are limited to pip-users (conda just introduced a similar concept via CEP 44 implemented in rattler). But I consider dependency groups (test, lint, docs, etc.) to be internal/developer features, and they are not published in the metadata to PyPI, e.g. flopy==3.10.0 shows on the side-bar:
image
whereas I'd expect the only user-facing extras to be optional and codegen.

I'll look into a PR to implement this for flopy.

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