From 90670b3d6336c3414604add1847d99e7c3b48fc3 Mon Sep 17 00:00:00 2001 From: Joshua Bronson Date: Fri, 23 Dec 2022 20:04:00 -0500 Subject: [PATCH] Upgrade dev deps + deps/upgrade script refactor. --- dev-deps/dev.txt | 49 ------------------------------------- dev-deps/test.txt | 13 ++-------- pyproject.toml | 9 +++---- upgrade-dev-dependencies.sh | 11 +++++---- 4 files changed, 11 insertions(+), 71 deletions(-) delete mode 100644 dev-deps/dev.txt diff --git a/dev-deps/dev.txt b/dev-deps/dev.txt deleted file mode 100644 index 0eeacaa..0000000 --- a/dev-deps/dev.txt +++ /dev/null @@ -1,49 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.11 -# by the following command: -# -# pip-compile --allow-unsafe --extra=dev --output-file=dev-deps/dev.txt --resolver=backtracking pyproject.toml -# -build==0.9.0 - # via pip-tools -cachetools==5.2.0 - # via tox -chardet==5.1.0 - # via tox -click==8.1.3 - # via pip-tools -colorama==0.4.6 - # via tox -distlib==0.3.6 - # via virtualenv -filelock==3.8.2 - # via - # tox - # virtualenv -packaging==22.0 - # via - # build - # pyproject-api - # tox -pep517==0.13.0 - # via build -pip==22.3.1 - # via pip-tools -pip-tools==6.12.1 - # via bidict (pyproject.toml) -platformdirs==2.6.0 - # via - # tox - # virtualenv -pluggy==1.0.0 - # via tox -pyproject-api==1.2.1 - # via tox -setuptools==65.6.3 - # via pip-tools -tox==4.0.16 - # via bidict (pyproject.toml) -virtualenv==20.17.1 - # via tox -wheel==0.38.4 - # via pip-tools diff --git a/dev-deps/test.txt b/dev-deps/test.txt index b87f553..a110400 100644 --- a/dev-deps/test.txt +++ b/dev-deps/test.txt @@ -16,18 +16,14 @@ certifi==2022.12.7 # via requests charset-normalizer==2.1.1 # via requests -coverage[toml]==7.0.0 - # via - # bidict (pyproject.toml) - # pytest-cov +coverage[toml]==7.0.1 + # via pytest-cov docutils==0.19 # via sphinx execnet==1.9.0 # via pytest-xdist hypothesis==6.61.0 # via bidict (pyproject.toml) -icdiff==2.0.6 - # via pytest-icdiff idna==3.4 # via requests imagesize==1.4.1 @@ -44,8 +40,6 @@ packaging==22.0 # sphinx pluggy==1.0.0 # via pytest -pprintpp==0.4.0 - # via pytest-icdiff py-cpuinfo==9.0.0 # via pytest-benchmark pygal==3.0.0 @@ -59,14 +53,11 @@ pytest==7.2.0 # bidict (pyproject.toml) # pytest-benchmark # pytest-cov - # pytest-icdiff # pytest-xdist pytest-benchmark[histogram]==4.0.0 # via bidict (pyproject.toml) pytest-cov==4.0.0 # via bidict (pyproject.toml) -pytest-icdiff==0.6 - # via bidict (pyproject.toml) pytest-xdist==3.1.0 # via bidict (pyproject.toml) pytz==2022.7 diff --git a/pyproject.toml b/pyproject.toml index 7380378..77f0772 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,6 +44,7 @@ build-backend = "setuptools.build_meta" packages = ["bidict"] [project.optional-dependencies] +lint = ["pre-commit"] docs = [ "sphinx", "sphinx-copybutton", @@ -51,21 +52,17 @@ docs = [ ] test = [ "hypothesis", - "coverage", "pytest", - "pytest-benchmark[histogram]", "pytest-cov", - "pytest-icdiff", + "pytest-benchmark[histogram]", "pytest-xdist", "sortedcollections", "sortedcontainers", # run_tests.py depends on Sphinx to run doctests (see note in run_tests.py) "sphinx", ] -lint = [ - "pre-commit", -] dev = [ + "pytest-icdiff", "pip-tools", "tox", ] diff --git a/upgrade-dev-dependencies.sh b/upgrade-dev-dependencies.sh index e6d3b35..20568c0 100755 --- a/upgrade-dev-dependencies.sh +++ b/upgrade-dev-dependencies.sh @@ -13,6 +13,8 @@ log() { } main() { + pip install -e .[dev,lint] + if ! type pre-commit || ! type pip-compile; then log "Error: pre-commit or pip-compile not found." exit 1 @@ -30,11 +32,10 @@ main() { # Not adding --generate-hashes due to https://github.com/jazzband/pip-tools/issues/1326 local -r pip_compile="pip-compile pyproject.toml --upgrade --resolver=backtracking --allow-unsafe" - ${pip_compile} --extra=test -o dev-deps/test.txt - ${pip_compile} --extra=docs -o dev-deps/docs.txt - ${pip_compile} --extra=lint -o dev-deps/lint.txt - ${pip_compile} --extra=dev -o dev-deps/dev.txt - pip install -U -r dev-deps/test.txt -r dev-deps/docs.txt -r dev-deps/lint.txt -r dev-deps/dev.txt + echo docs test lint dev | tr " " "\n" | xargs -P 0 -I{} ${pip_compile} --extra={} -o dev-deps/{}.txt + pip uninstall -y -r <(pip freeze) + ls dev-deps/*.txt | xargs -I{} pip install -r {} + pip install -e .[dev,lint] pre-commit autoupdate pre-commit clean