Skip to content

ninoseki/uv-sort

Repository files navigation

uv-sort

PyPI version

Sort uv's dependencies alphabetically.

Installation

pip install uv-sort
# or
uv add uv-sort

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

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.

pre-commit

repos:
  - repo: https://github.com/ninoseki/uv-sort
    rev: "" # Use the sha / tag you want to point at
    hooks:
      - id: uv-sort

lefthook

pre-commit:
  commands:
    uv-sort:
      run: uv-sort {staged_files}
      glob: "pyproject.toml"