Packages within the optional extras_requires "features" are not sorted
Closed this issue · 2 comments
Currently the packages listed within an optional extra is not sorted but the identifers themselves are.
If we start with the following snippet contained within a setup.cfg
. Where dev
and ci
are not sorted, as well as the packages within dev
are not sorted.
[options.extras_require]
dev =
pytest
hypothesis
ci =
hypothesis
pytest
Running pre-commit fails as expected.
$ pre-commit run setup-cfg-fmt --all-files
setup-cfg-fmt............................................................Failed
- hook id: setup-cfg-fmt
- files were modified by this hook
Rewriting setup.cfg
However, it only returns the following:
[options.extras_require]
ci =
hypothesis
pytest
dev =
pytest
hypothesis
While the ci
feature is sorted and placed above dev
correctly, currently the packages contained within dev
are not sorted similarly to how install_requires
and setup_requires
I'm thinking there should be consistent behaviour, with the extra_require
packages being sorted as well, therefore resulting in the following when checked:
[options.extras_require]
ci =
hypothesis
pytest
dev =
hypothesis
pytest
Is this something that you'd like to support and are you happy to accept a PR on this change in behaviour?
yep! sounds great -- can probably factor out / reuse the same sorting logic that is done for the normal sets of packages
Put in a PR under #43.