Skip to content

usethis tool requirements.txt with uv and pre-commit should use URI repo #1130

Description

@nathanjmcdougall

Currently the command adds something like this

      - id: uv-export
        name: uv-export
        files: ^uv\.lock$
        entry: uv export --frozen --offline --quiet -o=requirements.txt
        language: system
        pass_filenames: false
        require_serial: true

But we can do better by:

  • Declaring uv as the name of its own dependency group, with uv as the dependency in the group
  • Not including this uv group as a declared default group so it doesn't get installed
  • Using the URI config:
  - repo: https://github.com/astral-sh/uv-pre-commit
    rev: 0.9.8
    hooks:
      - id: uv-export

Where 0.9.8 is just whatever the fallback version is

[tool.sync-with-uv.repo-to-package]
"https://github.com/astral-sh/uv-pre-commit" = "uv"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions