From f565221d39e71f204f89693ca17f1d8454783e40 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Mon, 16 Dec 2024 12:53:39 +0000 Subject: [PATCH] Replace pip-compile with uv pip compile --- .config/constraints.txt | 33 ++++++++---------- .config/requirements-lock.txt | 39 ++++----------------- .pre-commit-config.yaml | 64 ++++++++++++++++++++--------------- pyproject.toml | 10 ++++++ 4 files changed, 67 insertions(+), 79 deletions(-) diff --git a/.config/constraints.txt b/.config/constraints.txt index f5fc0c87..c3b2bbe0 100644 --- a/.config/constraints.txt +++ b/.config/constraints.txt @@ -1,12 +1,7 @@ -# -# This file is autogenerated by pip-compile with Python 3.10 -# by the following command: -# -# pip-compile --all-extras --no-annotate --output-file=.config/constraints.txt --strip-extras --unsafe-package=ansible-dev-tools --unsafe-package=distribute --unsafe-package=pip --unsafe-package=setuptools .config/requirements.in pyproject.toml -# +# This file was autogenerated by uv via the following command: +# tox run deps ansible-builder==3.1.0 -ansible-compat>=24.10.0 -ansible-core==2.17.6 +ansible-compat==24.10.0 ansible-creator==24.12.0 ansible-dev-environment==24.12.0 ansible-lint==24.12.2 @@ -25,7 +20,7 @@ build==1.2.2.post1 cachetools==5.5.0 cairocffi==1.7.1 cairosvg==2.7.1 -certifi==2024.8.30 +certifi==2024.12.14 cffi==1.17.1 cfgv==3.4.0 chardet==5.2.0 @@ -46,7 +41,6 @@ django-stubs==5.1.1 django-stubs-ext==5.1.1 dnspython==2.7.0 docstring-parser-fork==0.0.9 -docutils==0.21.2 enrich==1.2.7 exceptiongroup==1.2.2 execnet==2.1.1 @@ -86,7 +80,7 @@ mkdocs-gen-files==0.5.0 mkdocs-get-deps==0.2.0 mkdocs-htmlproofer-plugin==1.3.0 mkdocs-macros-plugin==1.3.7 -mkdocs-material==9.5.48 +mkdocs-material==9.5.49 mkdocs-material-extensions==1.3.1 mkdocs-minify-plugin==0.8.0 mkdocs-monorepo-plugin==1.1.0 @@ -111,13 +105,12 @@ pbr==6.1.0 pexpect==4.9.0 pillow==11.0.0 pip-tools==7.4.1 -pipdeptree==2.24.0 platformdirs==4.3.6 pluggy==1.5.0 pre-commit==4.0.1 ptyprocess==0.7.0 pycparser==2.22 -pydoclint==0.5.10 +pydoclint==0.5.12 pygments==2.18.0 pylint==3.3.2 pymdown-extensions==10.12 @@ -125,6 +118,7 @@ pyproject-api==1.8.0 pyproject-hooks==1.2.0 pytest==8.3.4 pytest-ansible==24.12.0 +pytest-instafail==0.5.0 pytest-xdist==3.6.1 python-daemon==3.1.2 python-dateutil==2.9.0.post0 @@ -135,16 +129,15 @@ pyyaml-env-tag==0.1 referencing==0.31.1 regex==2024.11.6 requests==2.32.3 -resolvelib==1.0.1 rfc3339-validator==0.1.4 rich==13.9.4 rpds-py==0.22.3 ruamel-yaml==0.18.6 ruamel-yaml-clib==0.2.12 -ruff==0.8.2 +ruff==0.8.3 six==1.17.0 soupsieve==2.6 -sqlparse==0.5.2 +sqlparse==0.5.3 subprocess-tee==0.4.2 super-collections==0.5.3 termcolor==2.5.0 @@ -157,7 +150,6 @@ tox==4.23.2 tox-ansible==24.12.0 types-pyyaml==6.0.12.20240917 types-requests==2.32.0.20241016 -typing-extensions==4.12.2 tzdata==2024.2 urllib3==2.2.3 virtualenv==20.28.0 @@ -169,7 +161,10 @@ wheel==0.45.1 yamllint==1.35.1 zipp==3.21.0 -# The following packages are considered to be unsafe in a requirements file: -# ansible-dev-tools +# The following packages were excluded from the output: +# ansible-core +# pip +# resolvelib +# typing-extensions # pip # setuptools diff --git a/.config/requirements-lock.txt b/.config/requirements-lock.txt index c56f4813..11275969 100644 --- a/.config/requirements-lock.txt +++ b/.config/requirements-lock.txt @@ -1,64 +1,44 @@ -# -# This file is autogenerated by pip-compile with Python 3.10 -# by the following command: -# -# pip-compile --constraint=.config/constraints.txt --extra=server --no-annotate --output-file=.config/requirements-lock.txt --strip-extras --unsafe-package=distribute --unsafe-package=pip --unsafe-package=setuptools .config/requirements.in pyproject.toml -# +# This file was autogenerated by uv via the following command: +# tox run deps ansible-builder==3.1.0 -ansible-compat>=24.10.0 -ansible-core==2.17.6 +ansible-compat==24.10.0 ansible-creator==24.12.0 ansible-dev-environment==24.12.0 ansible-lint==24.12.2 ansible-navigator==24.12.0 ansible-runner==2.4.0 ansible-sign==0.1.1 -asgiref==3.8.1 attrs==24.2.0 bindep==2.11.0 black==24.10.0 bracex==2.5.post1 cachetools==5.5.0 -certifi==2024.8.30 cffi==1.17.1 chardet==5.2.0 -charset-normalizer==3.4.0 click==8.1.7 click-help-colors==0.9.4 colorama==0.4.6 cryptography==44.0.0 distlib==0.3.9 distro==1.9.0 -django==5.1.4 enrich==1.2.7 exceptiongroup==1.2.2 execnet==2.1.1 filelock==3.16.1 -gunicorn==23.0.0 -idna==3.10 importlib-metadata==8.5.0 iniconfig==2.0.0 -isodate==0.7.2 jinja2==3.1.4 jsonschema==4.23.0 -jsonschema-path==0.3.3 jsonschema-specifications==2023.12.1 -lazy-object-proxy==1.10.0 lockfile==0.12.2 markdown-it-py==3.0.0 markupsafe==3.0.2 mdurl==0.1.2 molecule==24.12.0 -more-itertools==10.5.0 mypy-extensions==1.0.0 onigurumacffi==1.3.0 -openapi-core==0.19.4 -openapi-schema-validator==0.6.2 -openapi-spec-validator==0.7.1 packaging==24.2 -parse==1.20.2 parsley==1.3 -pathable==0.4.3 pathspec==0.12.1 pbr==6.1.0 pexpect==4.9.0 @@ -75,27 +55,22 @@ python-daemon==3.1.2 python-gnupg==0.5.3 pyyaml==6.0.2 referencing==0.31.1 -requests==2.32.3 -resolvelib==1.0.1 -rfc3339-validator==0.1.4 rich==13.9.4 rpds-py==0.22.3 ruamel-yaml==0.18.6 ruamel-yaml-clib==0.2.12 -six==1.17.0 -sqlparse==0.5.2 subprocess-tee==0.4.2 tomli==2.2.1 tox==4.23.2 tox-ansible==24.12.0 -typing-extensions==4.12.2 tzdata==2024.2 -urllib3==2.2.3 virtualenv==20.28.0 wcmatch==10.0 -werkzeug==3.1.3 yamllint==1.35.1 zipp==3.21.0 -# The following packages are considered to be unsafe in a requirements file: +# The following packages were excluded from the output: +# ansible-core +# resolvelib +# typing-extensions # setuptools diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cd9c394f..84940033 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,6 +6,9 @@ ci: autofix_commit_msg: "chore: auto fixes from pre-commit.com hooks" skip: - shellcheck # no docker support on pre-commit.ci + - deps + - constraints + - lock default_language_version: # minimal version we support officially as this will impact mypy, pylint and # pip-tools in undesirable ways. @@ -48,7 +51,7 @@ repos: - id: shellcheck - repo: https://github.com/pycontribs/mirrors-prettier - rev: v3.3.3 + rev: v3.4.2 hooks: - id: prettier always_run: true @@ -68,7 +71,7 @@ repos: - id: tox-ini-fmt - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.1 + rev: v0.8.3 hooks: - id: ruff args: @@ -84,7 +87,7 @@ repos: - id: black - repo: https://github.com/streetsidesoftware/cspell-cli - rev: v8.16.0 + rev: v8.16.1 hooks: - id: cspell name: Spell check with cspell @@ -131,34 +134,39 @@ repos: # Override default pre-commit '--ignore-missing-imports' args: [--strict] - - 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: deps + - id: deps alias: deps - stages: [manual] - # The manual unsafe packages below are b/c of the test extras dep on the server extras - # which should not pull in the src pkg - entry: | - pip-compile .config/requirements.in -q --upgrade --all-extras --no-annotate --strip-extras - --unsafe-package ansible-dev-tools - --unsafe-package distribute - --unsafe-package pip - --unsafe-package setuptools - --output-file=.config/constraints.txt pyproject.toml - files: ^.config\/.*requirements.*$ + 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 + additional_dependencies: + - uv>=0.4.3 + - id: constraints + name: Check constraints files and requirements + # files: ^(pyproject\.toml|requirements\.txt)$ + language: python language_version: "3.10" # minimal we support officially - - id: pip-compile - name: lock + 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 - stages: [manual] - entry: | - pip-compile .config/requirements.in -q --upgrade --extra server --no-annotate --strip-extras - --constraint=.config/constraints.txt - --unsafe-package distribute - --unsafe-package pip - --unsafe-package setuptools - --output-file=.config/requirements-lock.txt pyproject.toml + always_run: true + 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: + - uv>=0.4.3 diff --git a/pyproject.toml b/pyproject.toml index 2cf59b7c..1de65d1e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -392,3 +392,13 @@ write_to = "src/ansible_dev_tools/_version.py" in_place = true sort_inline_tables = true sort_table_keys = true + +[tool.uv] +# incompatible with Windows +environments = ["platform_system != 'Windows'"] + +[tool.uv.pip] +# annotation-style = "line" +custom-compile-command = "tox run deps" +no-annotate = true +no-emit-package = ["ansible-core", "pip", "resolvelib", "typing_extensions", "uv", "pip", "distribute", "setuptools"]