Sort uv's dependencies alphabetically
Maintained. Last release 3 months ago, commits in 3 of the last 26 weeks. Weaker on commit activity and contributor spread.
$
pip install uv-sortuv-sort
Sort uv's dependencies alphabetically.
The following sections are supported:
build-system.requiresdependency-groupsproject.dependenciesproject.optional-dependenciestool.uv.build-constraint-dependenciestool.uv.constraint-dependenciestool.uv.dev-dependenciestool.uv.exclude-dependenciestool.uv.extra-build-dependenciestool.uv.override-dependenciestool.uv.sources
Installation
pip install uv-sort
# or
uv add uv-sort
[!Note]
uvusers do not need to installuv-sortand can instead useuv tools. See usage examples.
Usage
# sort dependencies in pyproject.toml in the current working directory
$ uv-sort
# or you can specify the path
$ uv-sort /path/to/pyproject.toml
# or using uv tools (no install)
$ uvx uv-sort
Options
--check: Check if dependencies are sorted and exit with a non-zero status code when they are not.--dry-run: Output the modified file to stdout without modifying the file.
With pre-commit
repos:
- repo: https://github.com/ninoseki/uv-sort
rev: "" # Use the sha / tag you want to point at
hooks:
- id: uv-sort
With Lefthook
pre-commit:
commands:
uv-sort:
run: uv-sort {staged_files}
glob: "pyproject.toml"