From 82f0151375093b648ce386a52439d06ca0d618e3 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 # Conflicts: # .config/constraints.txt --- .config/constraints.txt | 197 +++++++++++++++++++--------------------- .pre-commit-config.yaml | 43 +++++---- pyproject.toml | 32 ++----- 3 files changed, 131 insertions(+), 141 deletions(-) diff --git a/.config/constraints.txt b/.config/constraints.txt index 41430ff..f188162 100644 --- a/.config/constraints.txt +++ b/.config/constraints.txt @@ -1,103 +1,96 @@ -# -# This file is autogenerated by pip-compile with Python 3.9 -# by the following command: -# -# pip-compile --all-extras --no-annotate --output-file=.config/constraints.txt --strip-extras --unsafe-package=backports-tarfile --unsafe-package=cryptography --unsafe-package=exceptiongroup --unsafe-package=jeepney --unsafe-package=secretstorage --unsafe-package=twine pyproject.toml -# -babel==2.16.0 -beautifulsoup4==4.12.3 -build==1.2.2.post1 -cachetools==5.5.0 -cairocffi==1.7.1 -cairosvg==2.7.1 -certifi==2024.12.14 -cffi==1.17.1 -chardet==5.2.0 -charset-normalizer==3.4.0 -click==8.1.8 -colorama==0.4.6 -coverage==7.6.9 -cssselect2==0.7.0 -defusedxml==0.7.1 -diskcache==5.6.3 -distlib==0.3.9 -docutils==0.21.2 -filelock==3.16.1 -ghp-import==2.1.0 -gitdb==4.0.11 -gitpython==3.1.43 -idna==3.10 -importlib-metadata==8.5.0 -iniconfig==2.0.0 -jaraco-classes==3.4.0 -jaraco-context==6.0.1 -jaraco-functools==4.1.0 -jinja2==3.1.5 -keyring==25.5.0 -markdown==3.7 -markdown-exec==1.10.0 -markdown-it-py==3.0.0 -markupsafe==3.0.2 -mdurl==0.1.2 -mergedeep==1.3.4 -mkdocs==1.6.1 -mkdocs-autorefs==1.2.0 -mkdocs-gen-files==0.5.0 -mkdocs-get-deps==0.2.0 -mkdocs-htmlproofer-plugin==1.3.0 -mkdocs-material==9.5.49 -mkdocs-material-extensions==1.3.1 -more-itertools==10.5.0 -nh3==0.2.20 -packaging==24.2 -paginate==0.5.7 -pathspec==0.12.1 -pillow==11.0.0 -pip==24.3.1 -pipdeptree==2.24.0 -pkginfo==1.12.0 -platformdirs==4.3.6 -pluggy==1.5.0 -py-cpuinfo==9.0.0 -pycparser==2.22 -pygments==2.18.0 -pymdown-extensions==10.12 -pyproject-api==1.8.0 -pyproject-hooks==1.2.0 -pytest==8.3.4 -pytest-benchmark==5.1.0 -pytest-plus==0.7.0 -python-dateutil==2.9.0.post0 -pyyaml==6.0.2 -pyyaml-env-tag==0.1 -readme-renderer==44.0 -regex==2024.11.6 -requests==2.32.3 -requests-toolbelt==1.0.0 -rfc3986==2.0.0 -rich==13.9.4 -setuptools==75.6.0 -shellingham==1.5.4 -six==1.17.0 -smmap==5.0.1 -soupsieve==2.6 -subprocess-tee==0.4.2 -tinycss2==1.4.0 -tomli==2.0.1 ; python_version < "3.11" -tox==4.23.2 -typer==0.15.1 -typer-config==1.4.2 -typing-extensions==4.12.2 -urllib3==2.2.3 -virtualenv==20.28.0 -watchdog==6.0.0 -webencodings==0.5.1 -zipp==3.21.0 +# This file was autogenerated by uv via the following command: +# tox run deps +babel==2.16.0 # via mkdocs-material +backports-tarfile==1.2.0 # via jaraco-context +beautifulsoup4==4.12.3 # via mkdocs-htmlproofer-plugin +build==1.2.2 # via mk (pyproject.toml) +cachetools==5.5.0 # via tox +cairocffi==1.7.1 # via cairosvg +cairosvg==2.7.1 # via mk (pyproject.toml) +certifi==2024.8.30 # via requests +cffi==1.17.1 # via cairocffi +chardet==5.2.0 # via tox +charset-normalizer==3.3.2 # via requests +click==8.1.7 # via mkdocs, typer +colorama==0.4.6 # via mkdocs-material, tox +coverage==7.6.1 # via mk (pyproject.toml) +cssselect2==0.7.0 # via cairosvg +defusedxml==0.7.1 # via cairosvg +diskcache==5.6.3 # via mk (pyproject.toml) +distlib==0.3.8 # via virtualenv +docutils==0.21.2 # via readme-renderer +exceptiongroup==1.2.2 # via pytest +filelock==3.16.1 # via tox, virtualenv +ghp-import==2.1.0 # via mkdocs +gitdb==4.0.11 # via gitpython +gitpython==3.1.43 # via mk (pyproject.toml) +idna==3.10 # via requests +importlib-metadata==8.5.0 # via keyring +iniconfig==2.0.0 # via pytest +jaraco-classes==3.4.0 # via keyring +jaraco-context==6.0.1 # via keyring +jaraco-functools==4.0.2 # via keyring +jinja2==3.1.4 # via mkdocs, mkdocs-material +keyring==25.4.1 # via twine +markdown==3.7 # via mkdocs, mkdocs-autorefs, mkdocs-htmlproofer-plugin, mkdocs-material, pymdown-extensions +markdown-exec==1.9.3 # via mk (pyproject.toml) +markdown-it-py==3.0.0 # via rich +markupsafe==2.1.5 # via jinja2, mkdocs, mkdocs-autorefs +mdurl==0.1.2 # via markdown-it-py +mergedeep==1.3.4 # via mkdocs, mkdocs-get-deps +mkdocs==1.6.1 # via mkdocs-autorefs, mkdocs-gen-files, mkdocs-htmlproofer-plugin, mkdocs-material, mk (pyproject.toml) +mkdocs-autorefs==1.2.0 # via mk (pyproject.toml) +mkdocs-gen-files==0.5.0 # via mk (pyproject.toml) +mkdocs-get-deps==0.2.0 # via mkdocs +mkdocs-htmlproofer-plugin==1.3.0 # via mk (pyproject.toml) +mkdocs-material==9.5.36 # via mk (pyproject.toml) +mkdocs-material-extensions==1.3.1 # via mkdocs-material, mk (pyproject.toml) +more-itertools==10.5.0 # via jaraco-classes, jaraco-functools +nh3==0.2.18 # via readme-renderer +packaging==24.1 # via build, mkdocs, pipdeptree, pyproject-api, pytest, tox, twine, mk (pyproject.toml) +paginate==0.5.7 # via mkdocs-material +pathspec==0.12.1 # via mkdocs +pillow==10.4.0 # via cairosvg, mk (pyproject.toml) +pipdeptree==2.23.4 # via mk (pyproject.toml) +pkginfo==1.11.1 # via twine +platformdirs==4.3.6 # via mkdocs-get-deps, tox, virtualenv +pluggy==1.5.0 # via pytest, tox, mk (pyproject.toml) +py-cpuinfo==9.0.0 # via pytest-benchmark +pycparser==2.22 # via cffi +pygments==2.18.0 # via mkdocs-material, readme-renderer, rich +pymdown-extensions==10.9 # via markdown-exec, mkdocs-material, mk (pyproject.toml) +pyproject-api==1.8.0 # via tox +pyproject-hooks==1.1.0 # via build +pytest==8.3.3 # via pytest-benchmark, pytest-plus, mk (pyproject.toml) +pytest-benchmark==4.0.0 # via mk (pyproject.toml) +pytest-plus==0.7.0 # via mk (pyproject.toml) +python-dateutil==2.9.0.post0 # via ghp-import +pyyaml==6.0.2 # via mkdocs, mkdocs-get-deps, pymdown-extensions, pyyaml-env-tag, mk (pyproject.toml) +pyyaml-env-tag==0.1 # via mkdocs +readme-renderer==44.0 # via twine +regex==2024.9.11 # via mkdocs-material +requests==2.32.3 # via mkdocs-htmlproofer-plugin, mkdocs-material, requests-toolbelt, twine +requests-toolbelt==1.0.0 # via twine +rfc3986==2.0.0 # via twine +rich==13.8.1 # via twine, typer, mk (pyproject.toml) +setuptools==75.1.0 # via mk (pyproject.toml) +shellingham==1.5.4 # via typer, mk (pyproject.toml) +six==1.16.0 # via python-dateutil +smmap==5.0.1 # via gitdb +soupsieve==2.6 # via beautifulsoup4 +subprocess-tee==0.4.2 # via mk (pyproject.toml) +tinycss2==1.3.0 # via cairosvg, cssselect2 +tomli==2.0.1 # via build, pyproject-api, pytest, tox, mk (pyproject.toml) +tox==4.20.0 # via mk (pyproject.toml) +twine==6.0.1 # via mk (pyproject.toml) +typer==0.12.5 # via typer-config, mk (pyproject.toml) +typer-config==1.4.0 # via mk (pyproject.toml) +urllib3==2.2.3 # via requests, twine +virtualenv==20.26.5 # via tox +watchdog==5.0.2 # via mkdocs +webencodings==0.5.1 # via cssselect2, tinycss2 +zipp==3.20.2 # via importlib-metadata -# The following packages are considered to be unsafe in a requirements file: -# backports-tarfile -# cryptography -# exceptiongroup -# jeepney -# secretstorage -# twine +# The following packages were excluded from the output: +# pip +# typing-extensions diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3bab1e8..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.9" # minimal we support officially + 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.9" # minimal we support officially + 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 2f922b2..0851df8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [build-system] requires = [ "setuptools >= 65.3.0", # required by pyproject+setuptools_scm integration and editable installs - "setuptools_scm[toml] >= 7.0.5", # required for "no-local-version" scheme + "setuptools_scm[toml] >= 7.0.5" # required for "no-local-version" scheme ] build-backend = "setuptools.build_meta" @@ -33,7 +33,7 @@ classifiers = [ "Programming Language :: Python", "Topic :: Software Development :: Quality Assurance", "Topic :: Software Development :: Testing", - "Topic :: Utilities", + "Topic :: Utilities" ] keywords = ["mk"] @@ -101,23 +101,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 @@ -133,7 +116,7 @@ disable = [ "missing-module-docstring", "no-value-for-parameter", "not-an-iterable", - "too-few-public-methods", + "too-few-public-methods" ] [tool.ruff] @@ -161,7 +144,7 @@ lint.ignore = [ "TCH", "PLR", "INP", - "RET", + "RET" ] lint.select = ["ALL"] @@ -191,5 +174,10 @@ git_describe_command = [ "--tags", "--long", "--match", - "v*.*", + "v*.*" ] + +[tool.uv.pip] +annotation-style = "line" +custom-compile-command = "tox run deps" +no-emit-package = ["pip", "resolvelib", "typing_extensions", "uv"]