Description
Within pyproject.toml
, we use the project.optional-dependencies
group to specify Python packages that we only need for testing, or for building documentation. Although it is OK to do by convention, it is no longer the technically-correct way to encode this information.
In October 2024, PEP 735 created Dependency Groups. The idea behind Dependency Groups is that Optional Dependencies are meant for enabling certain optional client-facing functionality. For example, if you write a text-parsing package, you might want to offer a pure-Python version and a Cython version; folks would specify the Cython version via something like pip install text-parser[cython]
: In this example, cython
is an optional dependency.
Most packages use optional dependencies for docs
and test
, even though this is not client-facing. Dependency groups provides a way for packages to specify dependencies that should not make it into distributed package metadata.
We do not have any properly-optional dependencies. So, this project should be switched over to using Dependency Groups