From 4655240131ad44da6ec99165bf911d73420d9f39 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Wed, 25 Dec 2024 14:06:52 +0000 Subject: [PATCH] Replace pip-compile with uv --- .pre-commit-config.yaml | 39 ++++++++++++++++++++++++--------------- pyproject.toml | 22 +++++----------------- 2 files changed, 29 insertions(+), 32 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5bd3170..e5f40ef 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,6 +2,7 @@ ci: skip: - lock + - pip-compile - deps repos: - repo: https://github.com/astral-sh/ruff-pre-commit @@ -92,31 +93,39 @@ repos: - subprocess-tee - typer-config - typer>=0.12.2 - - repo: https://github.com/jazzband/pip-tools - rev: 7.4.1 + + # keep at bottom as these are slower + - repo: local hooks: - - id: pip-compile - name: lock - alias: lock - always_run: true - # keyring excluded in order to keep lockfile portable between linux and macos - entry: pip-compile pyproject.toml - files: ^.config\/.*requirements.*$ + - id: deps + name: Upgrade constraints files and requirements + files: ^(pyproject\.toml|requirements\.txt)$ language: python language_version: "3.10" # minimal we support officially + entry: python3 -m uv pip compile -q --all-extras --output-file=.config/constraints.txt pyproject.toml --upgrade pass_filenames: false - stages: [manual] + stages: + - manual additional_dependencies: - - pip>=22.3.1 + - uv>=0.4.3 - id: pip-compile - name: deps - alias: deps + name: Check constraints files and requirements + files: ^(pyproject\.toml|requirements\.txt)$ + language: python + language_version: "3.10" # minimal we support officially + entry: python3 -m uv pip compile -q --all-extras --output-file=.config/constraints.txt pyproject.toml + pass_filenames: false + additional_dependencies: + - uv>=0.4.3 + - id: lock + name: Update requirements-lock.txt + alias: lock always_run: true - entry: pip-compile pyproject.toml --upgrade + entry: python3 -m uv pip compile -q --upgrade --constraint=.config/constraints.txt --output-file=.config/requirements-lock.txt pyproject.toml --strip-extras files: ^.config\/.*requirements.*$ language: python language_version: "3.10" # minimal we support officially pass_filenames: false stages: [manual] additional_dependencies: - - pip>=22.3.1 + - uv>=0.4.3 diff --git a/pyproject.toml b/pyproject.toml index fd0a3fd..766cb21 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -100,23 +100,6 @@ color_output = true error_summary = true no_incremental = true -[tool.pip-tools] -no_annotate = true -quiet = true - -[tool.pip-tools.compile] -all_extras = true -output_file = ".config/constraints.txt" -strip_extras = true -unsafe_package = [ - "backports-tarfile", - "cryptography", - "exceptiongroup", - "jeepney", - "secretstorage", - "twine" -] - [tool.pylint."MESSAGES CONTROL"] # increase from default is 50 which is too aggressive max-statements = 60 @@ -192,3 +175,8 @@ git_describe_command = [ "--match", "v*.*" ] + +[tool.uv.pip] +annotation-style = "line" +custom-compile-command = "tox run deps" +no-emit-package = ["pip", "resolvelib", "typing_extensions", "uv"]