Skip to content

Sorting of dependency-groups is non-alphabetical #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ddeepwell opened this issue May 2, 2025 · 2 comments
Open

Sorting of dependency-groups is non-alphabetical #53

ddeepwell opened this issue May 2, 2025 · 2 comments

Comments

@ddeepwell
Copy link

I am adding dependency-groups (see this and this) to my pyproject.toml file and find that the sorting of the groups within the dependency-groups section is non-alphabetical.

Given the following pyproject.toml file:

[project]
name = "example"
version = "0.1.0"
requires-python = ">=3.11"
classifiers = [
  "Programming Language :: Python",
  "Programming Language :: Python :: 3 :: Only",
  "Programming Language :: Python :: 3.11",
  "Programming Language :: Python :: 3.12",
]
dependencies = [  ]

[dependency-groups]
coverage = [ "coverage>=7", { include-group = "test" } ]
dev = [
  { include-group = "lint" },
  { include-group = "test" },
  { include-group = "type" },
]
docs = [ "furo==2024.8.6", "sphinx>=8" ]
lint = [ "flake8>=6.1" ]
sast = [ "bandit>=1.7" ]
test = [ "pytest>=8.2" ]
type = [ "mypy>=1.5" ]

[tool.pyproject-fmt]
max_supported_python = "3.12"

executing pyproject-fmt pyproject.toml converts the pyproject.toml file into:

[project]
name = "example"
version = "0.1.0"
requires-python = ">=3.11"
classifiers = [
  "Programming Language :: Python",
  "Programming Language :: Python :: 3 :: Only",
  "Programming Language :: Python :: 3.11",
  "Programming Language :: Python :: 3.12",
]
dependencies = [  ]

[dependency-groups]
dev = [
  { include-group = "lint" },
  { include-group = "test" },
  { include-group = "type" },
]
test = [ "pytest>=8.2" ]
type = [ "mypy>=1.5" ]

docs = [ "furo==2024.8.6", "sphinx>=8" ]
coverage = [ "coverage>=7", { include-group = "test" } ]
lint = [ "flake8>=6.1" ]
sast = [ "bandit>=1.7" ]

[tool.pyproject-fmt]
max_supported_python = "3.12"

This sorting also introduced a single empty line which breaks up the visual connection of all dependency groups.

I had expected the sorting to be alphabetical by the dependency group name and to not create new spaces.

@ddeepwell
Copy link
Author

Is there still ongoing development and maintenance of this project? The last commit that was not a dependency update was nearly 3 months ago.

@gaborbernat
Copy link
Member

I'm currently on a holiday, and PyCon US timing caused me to miss this. I'll be back next week and we can talk about it then 👍

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

No branches or pull requests

2 participants