From 54c887df7c68ce0fabfa8c8950f65f41cf6cbcf2 Mon Sep 17 00:00:00 2001 From: Preocts Date: Sat, 1 Jul 2023 13:00:59 -0400 Subject: [PATCH 01/75] Remove unused requires definition --- tox.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/tox.ini b/tox.ini index 653e173..224b7f6 100644 --- a/tox.ini +++ b/tox.ini @@ -10,7 +10,6 @@ commands = coverage run -p -m pytest tests/ [testenv:coverage] -depends = py38,py39,py310,py311,py312 commands = python -m coverage combine python -m coverage report -m --fail-under=50 From f4410a7e894d256bf6d44476b18ec76102aac4b0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 4 Jul 2023 03:16:08 +0000 Subject: [PATCH 02/75] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/asottile/pyupgrade: v3.7.0 → v3.8.0](https://github.com/asottile/pyupgrade/compare/v3.7.0...v3.8.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index db46f5d..fa09e70 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,7 +25,7 @@ repos: # Automatically upgrade syntax to newer versions - repo: https://github.com/asottile/pyupgrade - rev: v3.7.0 + rev: v3.8.0 hooks: - id: pyupgrade args: From ff3551a4785da965b7b506004423af539ca14b62 Mon Sep 17 00:00:00 2001 From: Preocts Date: Thu, 6 Jul 2023 21:29:21 -0400 Subject: [PATCH 03/75] Remove override of flake8 config from pre-commit config --- .flake8 | 4 +++- .pre-commit-config.yaml | 5 ----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.flake8 b/.flake8 index b8d3c6d..d9b0b18 100644 --- a/.flake8 +++ b/.flake8 @@ -1,5 +1,7 @@ [flake8] +# E501: Allow lines to be too long (black will take care of it) +# E203: Allow whitespace before ':' extend-ignore = - W503 + E501 E203 max-line-length = 88 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fa09e70..e8fa6fa 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -52,11 +52,6 @@ repos: additional_dependencies: - flake8-builtins - flake8-pep585 - args: - - "--ignore" - - "W503,E203" - - "--max-line-length" - - "88" # Type enforcement for Python - repo: https://github.com/pre-commit/mirrors-mypy From f6694b797d168a7328112d8d5fece7deb739aa3c Mon Sep 17 00:00:00 2001 From: Preocts Date: Fri, 7 Jul 2023 22:26:16 -0400 Subject: [PATCH 04/75] Enforce lf line endings --- .pre-commit-config.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e8fa6fa..04db535 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,6 +10,9 @@ repos: - id: end-of-file-fixer - id: check-docstring-first - id: debug-statements + - id: mixed-line-ending + args: + - "--fix=lf" # Adds a standard feel to import segments, adds future annotations - repo: https://github.com/asottile/reorder-python-imports From c06be3147c2afc39086227dad3efd3abadfdec74 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 11 Jul 2023 03:21:28 +0000 Subject: [PATCH 05/75] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/asottile/pyupgrade: v3.8.0 → v3.9.0](https://github.com/asottile/pyupgrade/compare/v3.8.0...v3.9.0) - [github.com/psf/black: 23.3.0 → 23.7.0](https://github.com/psf/black/compare/23.3.0...23.7.0) - [github.com/asottile/blacken-docs: 1.14.0 → 1.15.0](https://github.com/asottile/blacken-docs/compare/1.14.0...1.15.0) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 04db535..ef89ed5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: # Automatically upgrade syntax to newer versions - repo: https://github.com/asottile/pyupgrade - rev: v3.8.0 + rev: v3.9.0 hooks: - id: pyupgrade args: @@ -36,13 +36,13 @@ repos: # Format code. No, I don't like everything black does either. - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 23.7.0 hooks: - id: black # Format docs. - repo: https://github.com/asottile/blacken-docs - rev: 1.14.0 + rev: 1.15.0 hooks: - id: blacken-docs additional_dependencies: [black>=23.3.0] From 2ff4917d3eedcbc44ccdcdc74f21708f1b09fc88 Mon Sep 17 00:00:00 2001 From: Preocts Date: Thu, 20 Jul 2023 19:18:15 -0400 Subject: [PATCH 06/75] allow line endings to be auto detected --- .pre-commit-config.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ef89ed5..7aadc23 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,8 +11,6 @@ repos: - id: check-docstring-first - id: debug-statements - id: mixed-line-ending - args: - - "--fix=lf" # Adds a standard feel to import segments, adds future annotations - repo: https://github.com/asottile/reorder-python-imports From 71e99601b8db8680ace520e4420926657c6c53ce Mon Sep 17 00:00:00 2001 From: Preocts Date: Thu, 20 Jul 2023 19:18:42 -0400 Subject: [PATCH 07/75] bump black version for blacken-docs --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7aadc23..c4619e9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -43,7 +43,7 @@ repos: rev: 1.15.0 hooks: - id: blacken-docs - additional_dependencies: [black>=23.3.0] + additional_dependencies: [black>=23.7.0] # Flake8 for linting, line-length adjusted to match Black default - repo: https://github.com/PyCQA/flake8 From 2b3caa892be461e752fa58681085bfc9ca9026b2 Mon Sep 17 00:00:00 2001 From: Preocts Date: Thu, 20 Jul 2023 19:25:18 -0400 Subject: [PATCH 08/75] Allow python pre-release to run in CI --- .github/workflows/python-tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 2a1e031..260cbd5 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -24,6 +24,7 @@ jobs: - "3.9" - "3.10" - "3.11" + - "3.12" steps: - name: "Repo checkout" @@ -33,6 +34,7 @@ jobs: uses: "actions/setup-python@v4" with: python-version: "${{ matrix.python-version }}" + allow-prereleases: true - name: "Install tox" run: | From aad8162d5da00f3cf3b113730596f39d0015fd6d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 1 Aug 2023 04:53:55 +0000 Subject: [PATCH 09/75] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/asottile/pyupgrade: v3.9.0 → v3.10.1](https://github.com/asottile/pyupgrade/compare/v3.9.0...v3.10.1) - [github.com/PyCQA/flake8: 6.0.0 → 6.1.0](https://github.com/PyCQA/flake8/compare/6.0.0...6.1.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c4619e9..cccd01c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,7 +26,7 @@ repos: # Automatically upgrade syntax to newer versions - repo: https://github.com/asottile/pyupgrade - rev: v3.9.0 + rev: v3.10.1 hooks: - id: pyupgrade args: @@ -47,7 +47,7 @@ repos: # Flake8 for linting, line-length adjusted to match Black default - repo: https://github.com/PyCQA/flake8 - rev: 6.0.0 + rev: 6.1.0 hooks: - id: flake8 additional_dependencies: From 99c712475d4f3195b039433b0e2f39ac84072013 Mon Sep 17 00:00:00 2001 From: Preocts Date: Tue, 1 Aug 2023 22:06:16 -0400 Subject: [PATCH 10/75] Remove --resolver parameter --- Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 22d3721..0cfa8d8 100644 --- a/Makefile +++ b/Makefile @@ -6,16 +6,16 @@ install-dev: .PHONY: update-dev update-dev: python -m pip install --upgrade pip-tools - pip-compile --resolver=backtracking --no-emit-index-url requirements/requirements.in - pip-compile --resolver=backtracking --no-emit-index-url requirements/requirements-dev.in - pip-compile --resolver=backtracking --no-emit-index-url requirements/requirements-test.in + pip-compile --no-emit-index-url requirements/requirements.in + pip-compile --no-emit-index-url requirements/requirements-dev.in + pip-compile --no-emit-index-url requirements/requirements-test.in .PHONY: upgrade-dev upgrade-dev: python -m pip install --upgrade pip-tools - pip-compile --resolver=backtracking --upgrade --no-emit-index-url requirements/requirements.in - pip-compile --resolver=backtracking --upgrade --no-emit-index-url requirements/requirements-dev.in - pip-compile --resolver=backtracking --upgrade --no-emit-index-url requirements/requirements-test.in + pip-compile --upgrade --no-emit-index-url requirements/requirements.in + pip-compile --upgrade --no-emit-index-url requirements/requirements-dev.in + pip-compile --upgrade --no-emit-index-url requirements/requirements-test.in .PHONY: coverage From bc63ab7607f5bcf3e0d41f9811b9d23e7dfdfbad Mon Sep 17 00:00:00 2001 From: Preocts Date: Tue, 1 Aug 2023 22:08:18 -0400 Subject: [PATCH 11/75] Regenerate requirements --- requirements/requirements-dev.txt | 26 +++++++++++++------------- requirements/requirements-test.txt | 22 +++++++++++----------- requirements/requirements.txt | 2 +- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/requirements/requirements-dev.txt b/requirements/requirements-dev.txt index 50da1dc..5ef6410 100644 --- a/requirements/requirements-dev.txt +++ b/requirements/requirements-dev.txt @@ -2,19 +2,19 @@ # This file is autogenerated by pip-compile with Python 3.8 # by the following command: # -# pip-compile --no-emit-index-url --resolver=backtracking requirements/requirements-dev.in +# pip-compile --config=pyproject.toml --no-emit-index-url requirements/requirements-dev.in # -black==23.3.0 +black==23.7.0 # via -r requirements/requirements-dev.in cfgv==3.3.1 # via pre-commit -click==8.1.3 +click==8.1.6 # via black -distlib==0.3.6 +distlib==0.3.7 # via virtualenv filelock==3.12.2 # via virtualenv -flake8==6.0.0 +flake8==6.1.0 # via # -r requirements/requirements-dev.in # flake8-builtins @@ -22,7 +22,7 @@ flake8-builtins==2.1.0 # via -r requirements/requirements-dev.in flake8-pep585==0.1.7 # via -r requirements/requirements-dev.in -identify==2.5.24 +identify==2.5.26 # via pre-commit mccabe==0.7.0 # via flake8 @@ -36,29 +36,29 @@ nodeenv==1.8.0 # via pre-commit packaging==23.1 # via black -pathspec==0.11.1 +pathspec==0.11.2 # via black -platformdirs==3.8.0 +platformdirs==3.10.0 # via # black # virtualenv pre-commit==3.3.3 # via -r requirements/requirements-dev.in -pycodestyle==2.10.0 +pycodestyle==2.11.0 # via flake8 -pyflakes==3.0.1 +pyflakes==3.1.0 # via flake8 -pyyaml==6.0 +pyyaml==6.0.1 # via pre-commit tomli==2.0.1 # via # black # mypy -typing-extensions==4.7.0 +typing-extensions==4.7.1 # via # black # mypy -virtualenv==20.23.1 +virtualenv==20.24.2 # via pre-commit # The following packages are considered to be unsafe in a requirements file: diff --git a/requirements/requirements-test.txt b/requirements/requirements-test.txt index deda8d6..3a39a83 100644 --- a/requirements/requirements-test.txt +++ b/requirements/requirements-test.txt @@ -2,25 +2,25 @@ # This file is autogenerated by pip-compile with Python 3.8 # by the following command: # -# pip-compile --no-emit-index-url --resolver=backtracking requirements/requirements-test.in +# pip-compile --config=pyproject.toml --no-emit-index-url requirements/requirements-test.in # cachetools==5.3.1 # via tox -chardet==5.1.0 +chardet==5.2.0 # via tox colorama==0.4.6 # via tox coverage==7.2.7 # via -r requirements/requirements-test.in -distlib==0.3.6 +distlib==0.3.7 # via virtualenv -exceptiongroup==1.1.1 +exceptiongroup==1.1.2 # via pytest filelock==3.12.2 # via # tox # virtualenv -importlib-metadata==6.7.0 +importlib-metadata==6.8.0 # via pytest-randomly iniconfig==2.0.0 # via pytest @@ -29,7 +29,7 @@ packaging==23.1 # pyproject-api # pytest # tox -platformdirs==3.8.0 +platformdirs==3.10.0 # via # tox # virtualenv @@ -37,22 +37,22 @@ pluggy==1.2.0 # via # pytest # tox -pyproject-api==1.5.2 +pyproject-api==1.5.3 # via tox pytest==7.4.0 # via # -r requirements/requirements-test.in # pytest-randomly -pytest-randomly==3.12.0 +pytest-randomly==3.13.0 # via -r requirements/requirements-test.in tomli==2.0.1 # via # pyproject-api # pytest # tox -tox==4.6.3 +tox==4.6.4 # via -r requirements/requirements-test.in -virtualenv==20.23.1 +virtualenv==20.24.2 # via tox -zipp==3.15.0 +zipp==3.16.2 # via importlib-metadata diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 25afd67..4dd1820 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -2,5 +2,5 @@ # This file is autogenerated by pip-compile with Python 3.8 # by the following command: # -# pip-compile --no-emit-index-url --resolver=backtracking requirements/requirements.in +# pip-compile --config=pyproject.toml --no-emit-index-url requirements/requirements.in # From 296f639bbee453f62f5d4be6bf778d452be3038e Mon Sep 17 00:00:00 2001 From: Preocts Date: Fri, 11 Aug 2023 21:24:04 -0400 Subject: [PATCH 12/75] Pin actions by sha --- .github/workflows/python-tests.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 260cbd5..8cd11ec 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -1,4 +1,9 @@ name: "python tests and coverage" +# Uses: +# https://github.com/actions/setup-python +# https://github.com/actions/checkout +# https://github.com/actions/download-artifact +# https://github.com/actions/upload-artifact on: pull_request: @@ -28,10 +33,10 @@ jobs: steps: - name: "Repo checkout" - uses: "actions/checkout@v3" + uses: "actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9" - name: "Set up Python ${{ matrix.python-version }}" - uses: "actions/setup-python@v4" + uses: "actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1" with: python-version: "${{ matrix.python-version }}" allow-prereleases: true @@ -45,7 +50,7 @@ jobs: tox -e py - name: "Save coverage artifact" - uses: "actions/upload-artifact@v3" + uses: "actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce" with: name: "coverage-artifact" path: ".coverage.*" @@ -57,10 +62,10 @@ jobs: runs-on: "ubuntu-latest" steps: - name: "Repo checkout" - uses: "actions/checkout@v3" + uses: "actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9" - name: "Set up Python" - uses: "actions/setup-python@v4" + uses: "actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1" with: python-version: "3.10" @@ -69,7 +74,7 @@ jobs: python -m pip install --upgrade pip tox - name: "Download coverage artifacts" - uses: actions/download-artifact@v3 + uses: "actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a" with: name: coverage-artifact From a150d3c775dded3d89c2be9e267fa5efbd151a03 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 15 Aug 2023 04:07:21 +0000 Subject: [PATCH 13/75] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/mirrors-mypy: v1.4.1 → v1.5.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.4.1...v1.5.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cccd01c..3dc6713 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -56,6 +56,6 @@ repos: # Type enforcement for Python - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.4.1 + rev: v1.5.0 hooks: - id: mypy From eea11d3bb09ea3bdb189f35abc16c528c33a6661 Mon Sep 17 00:00:00 2001 From: Preocts Date: Thu, 17 Aug 2023 22:56:42 -0400 Subject: [PATCH 14/75] Switch tox to nox and bump req version pins --- requirements/requirements-dev.txt | 10 +++---- requirements/requirements-test.in | 2 +- requirements/requirements-test.txt | 48 +++++++++++------------------- requirements/requirements.txt | 2 +- 4 files changed, 24 insertions(+), 38 deletions(-) diff --git a/requirements/requirements-dev.txt b/requirements/requirements-dev.txt index 5ef6410..b809070 100644 --- a/requirements/requirements-dev.txt +++ b/requirements/requirements-dev.txt @@ -2,13 +2,13 @@ # This file is autogenerated by pip-compile with Python 3.8 # by the following command: # -# pip-compile --config=pyproject.toml --no-emit-index-url requirements/requirements-dev.in +# pip-compile --no-emit-index-url requirements/requirements-dev.in # black==23.7.0 # via -r requirements/requirements-dev.in -cfgv==3.3.1 +cfgv==3.4.0 # via pre-commit -click==8.1.6 +click==8.1.7 # via black distlib==0.3.7 # via virtualenv @@ -26,7 +26,7 @@ identify==2.5.26 # via pre-commit mccabe==0.7.0 # via flake8 -mypy==1.4.1 +mypy==1.5.1 # via -r requirements/requirements-dev.in mypy-extensions==1.0.0 # via @@ -58,7 +58,7 @@ typing-extensions==4.7.1 # via # black # mypy -virtualenv==20.24.2 +virtualenv==20.24.3 # via pre-commit # The following packages are considered to be unsafe in a requirements file: diff --git a/requirements/requirements-test.in b/requirements/requirements-test.in index a8450e2..3f92e56 100644 --- a/requirements/requirements-test.in +++ b/requirements/requirements-test.in @@ -11,4 +11,4 @@ pytest pytest-randomly coverage -tox +nox diff --git a/requirements/requirements-test.txt b/requirements/requirements-test.txt index 3a39a83..54081a5 100644 --- a/requirements/requirements-test.txt +++ b/requirements/requirements-test.txt @@ -2,57 +2,43 @@ # This file is autogenerated by pip-compile with Python 3.8 # by the following command: # -# pip-compile --config=pyproject.toml --no-emit-index-url requirements/requirements-test.in +# pip-compile --no-emit-index-url requirements/requirements-test.in # -cachetools==5.3.1 - # via tox -chardet==5.2.0 - # via tox -colorama==0.4.6 - # via tox -coverage==7.2.7 +argcomplete==3.1.1 + # via nox +colorlog==6.7.0 + # via nox +coverage==7.3.0 # via -r requirements/requirements-test.in distlib==0.3.7 # via virtualenv -exceptiongroup==1.1.2 +exceptiongroup==1.1.3 # via pytest filelock==3.12.2 - # via - # tox - # virtualenv + # via virtualenv importlib-metadata==6.8.0 # via pytest-randomly iniconfig==2.0.0 # via pytest +nox==2023.4.22 + # via -r requirements/requirements-test.in packaging==23.1 # via - # pyproject-api + # nox # pytest - # tox platformdirs==3.10.0 - # via - # tox - # virtualenv + # via virtualenv pluggy==1.2.0 - # via - # pytest - # tox -pyproject-api==1.5.3 - # via tox + # via pytest pytest==7.4.0 # via # -r requirements/requirements-test.in # pytest-randomly -pytest-randomly==3.13.0 +pytest-randomly==3.15.0 # via -r requirements/requirements-test.in tomli==2.0.1 - # via - # pyproject-api - # pytest - # tox -tox==4.6.4 - # via -r requirements/requirements-test.in -virtualenv==20.24.2 - # via tox + # via pytest +virtualenv==20.24.3 + # via nox zipp==3.16.2 # via importlib-metadata diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 4dd1820..7ab7d2e 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -2,5 +2,5 @@ # This file is autogenerated by pip-compile with Python 3.8 # by the following command: # -# pip-compile --config=pyproject.toml --no-emit-index-url requirements/requirements.in +# pip-compile --no-emit-index-url requirements/requirements.in # From 646f7fe53fd653ac586b591fec030ac0fb2b8d27 Mon Sep 17 00:00:00 2001 From: Preocts Date: Thu, 17 Aug 2023 23:06:32 -0400 Subject: [PATCH 15/75] Replace tox with nox --- .gitignore | 2 +- Dockerfile | 4 ++-- Makefile | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 324b756..0f91802 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ temp_* .env venv/ *egg-info/ -.tox/ +.nox/ .coverage .coverage.* coverage.xml diff --git a/Dockerfile b/Dockerfile index 3d686c4..ad7c6d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,8 +12,8 @@ WORKDIR /src ENV PATH=/venv/bin:$PATH RUN python3.8 -m venv /venv -RUN python -m pip install --upgrade tox --no-cache-dir +RUN python -m pip install --upgrade nox --no-cache-dir COPY . /src -CMD ["tox", "-r"] +CMD ["nox"] diff --git a/Makefile b/Makefile index 0cfa8d8..77ce1f5 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,7 @@ clean: find . -name '*.pyo' -exec rm -f {} + find . -name '__pycache__' -exec rm -rf {} + find . -name '.mypy_cache' -exec rm -rf {} + - rm -rf .tox + rm -rf .nox rm -f coverage.xml rm -f coverage.json rm -rf htmlcov From 2c7d6deb27d9fab0fcde2eb24e40f302450779cf Mon Sep 17 00:00:00 2001 From: Preocts Date: Thu, 17 Aug 2023 23:07:32 -0400 Subject: [PATCH 16/75] Covert tox.ini to noxfile.py --- noxfile.py | 39 +++++++++++++++++++++++++++++++++++++++ tox.ini | 22 ---------------------- 2 files changed, 39 insertions(+), 22 deletions(-) create mode 100644 noxfile.py delete mode 100644 tox.ini diff --git a/noxfile.py b/noxfile.py new file mode 100644 index 0000000..de24100 --- /dev/null +++ b/noxfile.py @@ -0,0 +1,39 @@ +from __future__ import annotations + +import nox + +MODULE_NAME = "module_name" +COVERAGE_FAIL_UNDER = "--fail-under=50" + + +@nox.session( + python=["3.8", "3.9", "3.10", "3.11", "3.12"], +) +def tests_with_coverage(session: nox.Session) -> None: + session.log(f"Running from: {session.bin}") + session.log(f"Running with: {session.python}") + session.install(".[test]") + session.run("coverage", "run", "-p", "-m", "pytest", "tests/") + + +@nox.session() +def coverage_combine_and_report(session: nox.Session) -> None: + version = session.run("python", "--version", silent=True) + session.log(f"Running from: {session.bin}") + session.log(f"Running with: {version}") + + session.install(".[test]") + session.run("python", "-m", "coverage", "combine") + session.run("python", "-m", "coverage", "report", "-m", COVERAGE_FAIL_UNDER) + session.run("python", "-m", "coverage", "json") + + +@nox.session() +def mypy_check(session: nox.Session) -> None: + version = session.run("python", "--version", silent=True) + session.log(f"Running from: {session.bin}") + session.log(f"Running with: {version}") + + session.install(".") + session.install("mypy") + session.run("mypy", "-p", MODULE_NAME, "--no-incremental") diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 224b7f6..0000000 --- a/tox.ini +++ /dev/null @@ -1,22 +0,0 @@ -[tox] -envlist = py38,py39,py310,py311,py312,coverage,mypy -skip_missing_interpreters = true -isolated_build = True - -[testenv] -deps = - .[test] -commands = - coverage run -p -m pytest tests/ - -[testenv:coverage] -commands = - python -m coverage combine - python -m coverage report -m --fail-under=50 - python -m coverage json - -[testenv:mypy] -deps = - mypy -commands = - mypy -p module_name --no-incremental From fd4ccd66f63b1cc705a55003019644b151296ef8 Mon Sep 17 00:00:00 2001 From: Preocts Date: Thu, 17 Aug 2023 23:09:24 -0400 Subject: [PATCH 17/75] Add mypy enforcement and switch to nox --- .github/workflows/python-tests.yml | 38 +++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 8cd11ec..e8c0374 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -15,7 +15,7 @@ on: jobs: run-tests-and-coverage: - name: "Run Tox for tests and coverage" + name: "Run nox for tests and coverage" runs-on: "${{ matrix.os }}" strategy: fail-fast: false @@ -41,13 +41,13 @@ jobs: python-version: "${{ matrix.python-version }}" allow-prereleases: true - - name: "Install tox" + - name: "Install nox" run: | - python -m pip install --upgrade pip tox + python -m pip install --upgrade pip nox - - name: "Run tests and coverage via tox" + - name: "Run tests and coverage via nox" run: | - tox -e py + nox --session tests_with_coverage-${{ matrix.python-version }} - name: "Save coverage artifact" uses: "actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce" @@ -69,9 +69,9 @@ jobs: with: python-version: "3.10" - - name: "Install tox" + - name: "Install nox" run: | - python -m pip install --upgrade pip tox + python -m pip install --upgrade pip nox - name: "Download coverage artifacts" uses: "actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a" @@ -80,14 +80,34 @@ jobs: - name: "Compile coverage data, print report" run: | - python -m tox -e coverage + nox --session coverage_combine_and_report export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])") echo "TOTAL=$TOTAL" >> $GITHUB_ENV echo "### Total coverage: ${TOTAL}%" >> $GITHUB_STEP_SUMMARY + mypy-check: + name: "mypy strict enforcement" + runs-on: "ubuntu-latest" + steps: + - name: "Repo checkout" + uses: "actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9" + + - name: "Set up Python" + uses: "actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1" + with: + python-version: "3.10" + + - name: "Install nox" + run: | + python -m pip install --upgrade pip nox + + - name: "Enforce strict type annotations with mypy" + run: | + nox --session mypy_check + ci-success: name: "CI steps all completed successfully" - needs: "coverage-compile" + needs: ["coverage-compile", "mypy-check"] runs-on: "ubuntu-latest" steps: - name: "Success" From 7b18fb74aad42f5698b0bc69d96ffa2f7760853f Mon Sep 17 00:00:00 2001 From: Preocts Date: Thu, 17 Aug 2023 23:18:38 -0400 Subject: [PATCH 18/75] Update documentation --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c5373b2..c5b6485 100644 --- a/README.md +++ b/README.md @@ -148,7 +148,7 @@ $ pytest Run tests (slow): ```console -$ tox +$ nox ``` Build dist: From 2aa72f35b5d9f736378c21f311886aa58b588183 Mon Sep 17 00:00:00 2001 From: Preocts Date: Thu, 17 Aug 2023 23:20:56 -0400 Subject: [PATCH 19/75] Update to replace module_name in noxfile.py --- init_template.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/init_template.py b/init_template.py index 996ec15..2dcd787 100644 --- a/init_template.py +++ b/init_template.py @@ -17,7 +17,7 @@ PLACEHOLDER_DIR = [Path("src/module_name/sample_data")] PYPROJECT_TARGET = Path("pyproject.toml") README_TARGET = Path("README.md") -TOX_TARGET = Path("tox.ini") +NOX_TARGET = Path("noxfile.py") ALT_FILE_DIR = Path("alt_files") REQUIREMENTS_DIR = Path("requirements") ORG = "Preocts" @@ -111,12 +111,12 @@ def replace_readme_values(data: ProjectData) -> None: README_TARGET.write_text(readme) -@bookends("Updating tox.ini values") -def replace_tox_values(data: ProjectData) -> None: - """Update tox value, replacing module_name with actual module name.""" - tox = Path(TOX_TARGET).read_text() - tox = tox.replace("module_name", data.module) - Path(TOX_TARGET).write_text(tox) +@bookends("Updating noxfile.py values") +def replace_nox_values(data: ProjectData) -> None: + """Update nox value, replacing module_name with actual module name.""" + noxfile = Path(NOX_TARGET).read_text() + noxfile = noxfile.replace("module_name", data.module) + Path(NOX_TARGET).write_text(noxfile) @bookends("Renaming src/module_name folder") @@ -132,7 +132,7 @@ def rename_module_folder(name: str) -> None: project_data = get_project_data() replace_pyproject_values(project_data) - replace_tox_values(project_data) + replace_nox_values(project_data) replace_readme_values(project_data) delete_placeholder_files() From cdc58a49483dbbec0b5a21fa1edc653795b1c77c Mon Sep 17 00:00:00 2001 From: Preocts Date: Fri, 18 Aug 2023 19:50:42 -0400 Subject: [PATCH 20/75] Clean up nox files --- .dockerignore | 2 +- README.md | 2 +- noxfile.py | 22 ++++++++++++++-------- requirements/requirements-test.in | 2 +- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.dockerignore b/.dockerignore index 749bb6c..59aab11 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,7 +2,7 @@ venv/ Dockerfile .dockerignore build/ -.tox/ +.nox/ .pytest_cache/ .mypy_cache/ .github/ diff --git a/README.md b/README.md index c5b6485..344bfee 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ Makefile. If you are on Windows you can install make using scoop or chocolatey. | `coverage` | Run tests with coverage, generate console report | | `docker-test` | Run coverage and tests in a docker container. | | `build-dist` | Build source distribution and wheel distribution | -| `clean` | Deletes build, tox, coverage, pytest, mypy, cache, and pyc artifacts | +| `clean` | Deletes build, nox, coverage, pytest, mypy, cache, and pyc artifacts | Clone this repo and enter root directory of repo: diff --git a/noxfile.py b/noxfile.py index de24100..a8dc510 100644 --- a/noxfile.py +++ b/noxfile.py @@ -10,17 +10,17 @@ python=["3.8", "3.9", "3.10", "3.11", "3.12"], ) def tests_with_coverage(session: nox.Session) -> None: - session.log(f"Running from: {session.bin}") - session.log(f"Running with: {session.python}") + """Run unit tests with coverage saved to partial file.""" + print_standard_logs(session) + session.install(".[test]") session.run("coverage", "run", "-p", "-m", "pytest", "tests/") @nox.session() def coverage_combine_and_report(session: nox.Session) -> None: - version = session.run("python", "--version", silent=True) - session.log(f"Running from: {session.bin}") - session.log(f"Running with: {version}") + """Combine all coverage partial files and generate JSON report.""" + print_standard_logs(session) session.install(".[test]") session.run("python", "-m", "coverage", "combine") @@ -30,10 +30,16 @@ def coverage_combine_and_report(session: nox.Session) -> None: @nox.session() def mypy_check(session: nox.Session) -> None: - version = session.run("python", "--version", silent=True) - session.log(f"Running from: {session.bin}") - session.log(f"Running with: {version}") + """Run mypy against package and all required dependencies.""" + print_standard_logs(session) session.install(".") session.install("mypy") session.run("mypy", "-p", MODULE_NAME, "--no-incremental") + + +def print_standard_logs(session: nox.Session) -> None: + """Reusable output for monitoring environment factors.""" + version = session.run("python", "--version", silent=True) + session.log(f"Running from: {session.bin}") + session.log(f"Running with: {version}") diff --git a/requirements/requirements-test.in b/requirements/requirements-test.in index 3f92e56..bb87f28 100644 --- a/requirements/requirements-test.in +++ b/requirements/requirements-test.in @@ -1,4 +1,4 @@ -# Testing Requirements - pytest, tox, etc. +# Testing Requirements # ---------------------------------------- # Ensure to set PIP_INDEX_URL to the correct value for your environment # This is the URL to the Artifactory instance that hosts the Python packages (default: pypi.org) From c2d8d8c2a4c35e6f1ffb6f9f1725d369f04755c8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 22 Aug 2023 04:15:34 +0000 Subject: [PATCH 21/75] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/asottile/blacken-docs: 1.15.0 → 1.16.0](https://github.com/asottile/blacken-docs/compare/1.15.0...1.16.0) - [github.com/pre-commit/mirrors-mypy: v1.5.0 → v1.5.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.5.0...v1.5.1) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3dc6713..2f74a79 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -40,7 +40,7 @@ repos: # Format docs. - repo: https://github.com/asottile/blacken-docs - rev: 1.15.0 + rev: 1.16.0 hooks: - id: blacken-docs additional_dependencies: [black>=23.7.0] @@ -56,6 +56,6 @@ repos: # Type enforcement for Python - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.5.0 + rev: v1.5.1 hooks: - id: mypy From 6b69ff6f56dd4ac4fcc849eaef6d19a0ea36c3e7 Mon Sep 17 00:00:00 2001 From: Preocts Date: Mon, 28 Aug 2023 21:23:08 -0400 Subject: [PATCH 22/75] Overcomplicate noxfile --- noxfile.py | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 103 insertions(+), 3 deletions(-) diff --git a/noxfile.py b/noxfile.py index a8dc510..7bd7262 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,9 +1,44 @@ from __future__ import annotations +import os +import sys + import nox +# Control factors for finding pieces of the module MODULE_NAME = "module_name" -COVERAGE_FAIL_UNDER = "--fail-under=50" +TESTS_PATH = "tests" +COVERAGE_FAIL_UNDER = 50 +REQUIREMENT_IN_FILES = [ + os.path.join("requirements", "requirements.in"), + os.path.join("requirements", "requirements-dev.in"), + os.path.join("requirements", "requirements-test.in"), +] + +# What are we allowed to clean (delete)? +CLEAN_DIRS = [ + "__pycache__", + ".mypy_cache", + ".pytest_cache", + ".coverage", + ".nox", + "dist", + "build", +] +CLEAN_FILES = [ + "*.pyc", + "*.pyo", + "coverage.json", + ".coverage.*", +] + + +# Define the default sessions run when `nox` is called on the CLI +nox.options.sessions = [ + "tests_with_coverage", + "coverage_combine_and_report", + "mypy_check", +] @nox.session( @@ -14,7 +49,7 @@ def tests_with_coverage(session: nox.Session) -> None: print_standard_logs(session) session.install(".[test]") - session.run("coverage", "run", "-p", "-m", "pytest", "tests/") + session.run("coverage", "run", "-p", "-m", "pytest", TESTS_PATH) @nox.session() @@ -22,9 +57,11 @@ def coverage_combine_and_report(session: nox.Session) -> None: """Combine all coverage partial files and generate JSON report.""" print_standard_logs(session) + fail_under = f"--fail-under={COVERAGE_FAIL_UNDER}" + session.install(".[test]") session.run("python", "-m", "coverage", "combine") - session.run("python", "-m", "coverage", "report", "-m", COVERAGE_FAIL_UNDER) + session.run("python", "-m", "coverage", "report", "-m", fail_under) session.run("python", "-m", "coverage", "json") @@ -38,6 +75,69 @@ def mypy_check(session: nox.Session) -> None: session.run("mypy", "-p", MODULE_NAME, "--no-incremental") +@nox.session(python=False) +def coverage(session: nox.Session) -> None: + """Generate a coverage report. Does not use a venv.""" + session.run("coverage", "erase") + session.run("coverage", "run", "-m", "pytest", TESTS_PATH) + session.run("coverage", "report", "-m") + + +@nox.session(python=False) +def docker(session: nox.Session) -> None: + """Run tests in a docker container. Requires docker damon running.""" + session.run("docker", "build", "-t", "pydocker-test", ".") + session.run("docker", "run", "-it", "--rm", "pydocker-test") + + +@nox.session() +def build(session: nox.Session) -> None: + """Build distrobution files.""" + print_standard_logs(session) + + session.install("build") + session.run("python", "-m", "build") + + +@nox.session() +def update(session: nox.Session) -> None: + """Process requirement*.in files, updating only additions/removals.""" + print_standard_logs(session) + + session.install("pip-tools") + for filename in REQUIREMENT_IN_FILES: + session.run("pip-compile", "--no-emit-index-url", filename) + + +@nox.session() +def upgrade(session: nox.Session) -> None: + """Process requirement*.in files and upgrade all libraries as possible.""" + print_standard_logs(session) + + session.install("pip-tools") + for filename in REQUIREMENT_IN_FILES: + session.run("pip-compile", "--no-emit-index-url", "--upgrade", filename) + + +@nox.session(python=False) +def clean(session: nox.Session) -> None: + """Clean cache, .pyc, .pyo, and artifact files from project.""" + if sys.platform.startswith("win"): + print("Windows unsupported at this time.") + return None + + elif sys.platform in ["linux", "darwin"]: + for dirpath in CLEAN_DIRS: + session.run("find", ".", "-name", dirpath, "-exec", "rm", "-rf", "{}", "+") + + for file in CLEAN_FILES: + session.run("find", ".", "-name", file, "-exec", "rm", "-f", "{}", "+") + + else: + print("Unknown OS for this session.") + return None + + def print_standard_logs(session: nox.Session) -> None: """Reusable output for monitoring environment factors.""" version = session.run("python", "--version", silent=True) From 2faa44d334e369a45b4915a35f84d86540985fd9 Mon Sep 17 00:00:00 2001 From: Preocts Date: Mon, 28 Aug 2023 21:33:23 -0400 Subject: [PATCH 23/75] Update documentation --- README.md | 79 +++++++++++-------------------------------------------- 1 file changed, 15 insertions(+), 64 deletions(-) diff --git a/README.md b/README.md index 344bfee..19569f9 100644 --- a/README.md +++ b/README.md @@ -65,45 +65,27 @@ the desired version while creating the `venv`. (e.g. `python3` or `python3.8`) ## Installation steps -### Makefile - -This repo has a Makefile with some quality of life scripts if the system -supports `make`. Please note there are no checks for an active `venv` in the -Makefile. If you are on Windows you can install make using scoop or chocolatey. - -| PHONY | Description | -| ------------- | --------------------------------------------------------------------- | -| `install-dev` | install development/test requirements and project as editable install | -| `update-dev` | regenerate requirements-*.txt (will keep existing pins) | -| `upgrade-dev` | attempt to update all dependencies, regenerate requirements-*.txt | -| `coverage` | Run tests with coverage, generate console report | -| `docker-test` | Run coverage and tests in a docker container. | -| `build-dist` | Build source distribution and wheel distribution | -| `clean` | Deletes build, nox, coverage, pytest, mypy, cache, and pyc artifacts | - - Clone this repo and enter root directory of repo: ```console -$ git clone https://github.com/[ORG NAME]/[REPO NAME] -$ cd [REPO NAME] +git clone https://github.com/[ORG NAME]/[REPO NAME] +cd [REPO NAME] ``` - Create the `venv`: ```console -$ python -m venv venv +python -m venv venv ``` Activate the `venv`: ```console # Linux/Mac -$ . venv/bin/activate +. venv/bin/activate # Windows -$ venv\Scripts\activate +venv\Scripts\activate ``` The command prompt should now have a `(venv)` prefix on it. `python` will now @@ -111,22 +93,14 @@ call the version of the interpreter used to create the `venv` Install editable library and development requirements: -### With Makefile: - ```console -make install-dev -``` - -### Without Makefile: - -```console -$ python -m pip install --editable .[dev,test] +python -m pip install --editable .[dev,test] ``` Install pre-commit [(see below for details)](#pre-commit): ```console -$ pre-commit install +pre-commit install ``` --- @@ -136,33 +110,32 @@ $ pre-commit install Run pre-commit on all files: ```console -$ pre-commit run --all-files +pre-commit run --all-files ``` Run tests (quick): ```console -$ pytest +pytest ``` -Run tests (slow): +Run tests: ```console -$ nox +nox ``` Build dist: ```console -$ python -m pip install --upgrade build - -$ python -m build +python -m pip install --upgrade build +python -m build ``` To deactivate (exit) the `venv`: ```console -$ deactivate +deactivate ``` --- @@ -176,22 +149,6 @@ generated `requirements-*.txt` files. Once updated following the steps below, the package can be installed if needed. -### With Makefile - -To update the generated files with a dependency: - -```console -make update-dev -``` - -To attempt to upgrade all generated dependencies: - -```console -make upgrade-dev -``` - -### Without Makefile - To update the generated files with a dependency: ```console @@ -200,13 +157,7 @@ pip-compile --no-emit-index-url requirements/requirements-dev.in pip-compile --no-emit-index-url requirements/requirements-test.in ``` -To attempt to upgrade all generated dependencies: - -```console -pip-compile --upgrade --no-emit-index-url requirements/requirements.in -pip-compile --upgrade --no-emit-index-url requirements/requirements-dev.in -pip-compile --upgrade --no-emit-index-url requirements/requirements-test.in -``` +To attempt to upgrade all generated dependencies add the `--upgrade` flag. --- From 527ddd314728b807e35b3e39672e737ea7f1366f Mon Sep 17 00:00:00 2001 From: Preocts Date: Mon, 28 Aug 2023 21:33:39 -0400 Subject: [PATCH 24/75] Remove Makefile --- Makefile | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 Makefile diff --git a/Makefile b/Makefile deleted file mode 100644 index 77ce1f5..0000000 --- a/Makefile +++ /dev/null @@ -1,50 +0,0 @@ -.PHONY: install-dev -install-dev: - python -m pip install --upgrade --editable .[dev,test] - pre-commit install - -.PHONY: update-dev -update-dev: - python -m pip install --upgrade pip-tools - pip-compile --no-emit-index-url requirements/requirements.in - pip-compile --no-emit-index-url requirements/requirements-dev.in - pip-compile --no-emit-index-url requirements/requirements-test.in - -.PHONY: upgrade-dev -upgrade-dev: - python -m pip install --upgrade pip-tools - pip-compile --upgrade --no-emit-index-url requirements/requirements.in - pip-compile --upgrade --no-emit-index-url requirements/requirements-dev.in - pip-compile --upgrade --no-emit-index-url requirements/requirements-test.in - - -.PHONY: coverage -coverage: - coverage run -m pytest tests/ - coverage report -m - -.PHONY: docker-test -docker-test: - docker build -t pydocker-test . - docker run -it --rm pydocker-test - -.PHONY: build-dist -build-dist: - python -m pip install --upgrade build - python -m build - -.PHONY: clean -clean: - find . -name '*.pyc' -exec rm -f {} + - find . -name '*.pyo' -exec rm -f {} + - find . -name '__pycache__' -exec rm -rf {} + - find . -name '.mypy_cache' -exec rm -rf {} + - rm -rf .nox - rm -f coverage.xml - rm -f coverage.json - rm -rf htmlcov - rm -rf .coverage - rm -rf .coverage.* - find . -name '.pytest_cache' -exec rm -rf {} + - rm -rf dist - rm -rf build From 1d941c6781cfda6907cef51a9d3208f23cb87716 Mon Sep 17 00:00:00 2001 From: Preocts Date: Tue, 29 Aug 2023 22:55:35 -0400 Subject: [PATCH 25/75] Refine noxfile Removes the platform dependant shell calls for `clean` session --- noxfile.py | 70 +++++++++++++++++++++++++----------------------------- 1 file changed, 32 insertions(+), 38 deletions(-) diff --git a/noxfile.py b/noxfile.py index 7bd7262..363d163 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,7 +1,7 @@ from __future__ import annotations -import os -import sys +import pathlib +import shutil import nox @@ -10,26 +10,24 @@ TESTS_PATH = "tests" COVERAGE_FAIL_UNDER = 50 REQUIREMENT_IN_FILES = [ - os.path.join("requirements", "requirements.in"), - os.path.join("requirements", "requirements-dev.in"), - os.path.join("requirements", "requirements-test.in"), + pathlib.Path("requirements/requirements.in"), + pathlib.Path("requirements/requirements-dev.in"), + pathlib.Path("requirements/requirements-test.in"), ] -# What are we allowed to clean (delete)? -CLEAN_DIRS = [ - "__pycache__", - ".mypy_cache", - ".pytest_cache", - ".coverage", - ".nox", - "dist", - "build", -] -CLEAN_FILES = [ - "*.pyc", - "*.pyo", - "coverage.json", - ".coverage.*", +# What we allowed to clean (delete) +CLEANABLE_TARGETS = [ + "./**/__pycache__", + "./**/.mypy_cache", + "./**/.pytest_cache", + "./**/.coverage", + "./**/.nox", + "./**/dist", + "./**/build", + "./**/*.pyc", + "./**/*.pyo", + "./**/coverage.json", + "./**/.coverage.*", ] @@ -106,7 +104,7 @@ def update(session: nox.Session) -> None: session.install("pip-tools") for filename in REQUIREMENT_IN_FILES: - session.run("pip-compile", "--no-emit-index-url", filename) + session.run("pip-compile", "--no-emit-index-url", str(filename)) @nox.session() @@ -116,26 +114,22 @@ def upgrade(session: nox.Session) -> None: session.install("pip-tools") for filename in REQUIREMENT_IN_FILES: - session.run("pip-compile", "--no-emit-index-url", "--upgrade", filename) + session.run("pip-compile", "--no-emit-index-url", "--upgrade", str(filename)) @nox.session(python=False) -def clean(session: nox.Session) -> None: - """Clean cache, .pyc, .pyo, and artifact files from project.""" - if sys.platform.startswith("win"): - print("Windows unsupported at this time.") - return None - - elif sys.platform in ["linux", "darwin"]: - for dirpath in CLEAN_DIRS: - session.run("find", ".", "-name", dirpath, "-exec", "rm", "-rf", "{}", "+") - - for file in CLEAN_FILES: - session.run("find", ".", "-name", file, "-exec", "rm", "-f", "{}", "+") - - else: - print("Unknown OS for this session.") - return None +def clean(_: nox.Session) -> None: + """Clean cache, .pyc, .pyo, and test/build artifact files from project.""" + count = 0 + for searchpath in CLEANABLE_TARGETS: + for filepath in pathlib.Path(".").glob(searchpath): + if filepath.is_dir(): + shutil.rmtree(filepath) + else: + filepath.unlink() + count += 1 + + print(f"{count} files cleaned.") def print_standard_logs(session: nox.Session) -> None: From 64ecb0b33139cc52eab9549ebe776a3252d5b0a3 Mon Sep 17 00:00:00 2001 From: Preocts Date: Sat, 2 Sep 2023 13:56:59 -0400 Subject: [PATCH 26/75] Adjust clean to be more efficient Clear dirs that contain future clear targets first --- noxfile.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/noxfile.py b/noxfile.py index 363d163..bbfb610 100644 --- a/noxfile.py +++ b/noxfile.py @@ -17,13 +17,13 @@ # What we allowed to clean (delete) CLEANABLE_TARGETS = [ - "./**/__pycache__", + "./**/dist", + "./**/build", + "./**/.nox", "./**/.mypy_cache", "./**/.pytest_cache", "./**/.coverage", - "./**/.nox", - "./**/dist", - "./**/build", + "./**/__pycache__", "./**/*.pyc", "./**/*.pyo", "./**/coverage.json", From a6cb53aad4b17d9cf074d9b09a35b8625d11b807 Mon Sep 17 00:00:00 2001 From: Preocts Date: Sat, 9 Sep 2023 11:34:18 -0400 Subject: [PATCH 27/75] Update black to new official mirror --- .pre-commit-config.yaml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2f74a79..e5475e2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -33,18 +33,11 @@ repos: - "--py38-plus" # Format code. No, I don't like everything black does either. - - repo: https://github.com/psf/black - rev: 23.7.0 + - repo: https://github.com/psf/black-pre-commit-mirror + rev: 23.9.0 hooks: - id: black - # Format docs. - - repo: https://github.com/asottile/blacken-docs - rev: 1.16.0 - hooks: - - id: blacken-docs - additional_dependencies: [black>=23.7.0] - # Flake8 for linting, line-length adjusted to match Black default - repo: https://github.com/PyCQA/flake8 rev: 6.1.0 From 6b0a030669310072cf64deab045c9039d6635369 Mon Sep 17 00:00:00 2001 From: Preocts Date: Sat, 9 Sep 2023 11:40:30 -0400 Subject: [PATCH 28/75] Formatter change --- pyproject.toml | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e790f65..a1b2582 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,16 +9,14 @@ requires-python = ">=3.8" description = "Module Description" readme = "README.md" license = { file = "LICENSE" } -authors = [ - { email = "yourname@email.invalid", name = "[YOUR NAME]" } -] +authors = [{ email = "yourname@email.invalid", name = "[YOUR NAME]" }] maintainers = [] keywords = [] classifiers = [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: Implementation :: CPython" + "Programming Language :: Python :: Implementation :: CPython", ] # Dynamic dependencies are loaded from requirements*.txt files dynamic = ["dependencies", "optional-dependencies"] @@ -27,8 +25,8 @@ dynamic = ["dependencies", "optional-dependencies"] file = ["requirements/requirements.txt"] [tool.setuptools.dynamic.optional-dependencies] -dev = {file = ["requirements/requirements-dev.txt"]} -test = {file = ["requirements/requirements-test.txt"]} +dev = { file = ["requirements/requirements-dev.txt"] } +test = { file = ["requirements/requirements-test.txt"] } # Alertative way to specify dependencies # dependencies = [] @@ -73,25 +71,15 @@ warn_unused_ignores = false [tool.coverage.run] branch = true -source = [ - "tests", -] -source_pkgs = [ - "module_name", -] +source = ["tests"] +source_pkgs = ["module_name"] [tool.coverage.paths] -source = [ - "src/", - "*/site-packages", -] -test = [ - "tests/", - "*/tests", -] +source = ["src/", "*/site-packages"] +test = ["tests/", "*/tests"] [tool.coverage.report] -exclude_lines =[ +exclude_lines = [ "pragma: no cover", "raise NotImplementedError", "if __name__ == .__main__.:", From e93ff2fc7b6058ce489cb4cf037eea125e953ef7 Mon Sep 17 00:00:00 2001 From: Preocts Date: Sat, 9 Sep 2023 12:04:18 -0400 Subject: [PATCH 29/75] Use 3.11 to build inital venv --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index ad7c6d0..ab3bd90 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,13 +5,13 @@ ENV LANG=C.UTF-8 RUN apt-get update RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends software-properties-common RUN add-apt-repository -y 'ppa:deadsnakes/ppa' -RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends python3.8 python3.8-venv python3.9 python3.10 python3.11 python3.12 +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends python3.8-distutils python3.8 python3.9 python3.10 python3.11-venv python3.12 RUN rm -rf /var/lib/apt/lists/* WORKDIR /src ENV PATH=/venv/bin:$PATH -RUN python3.8 -m venv /venv +RUN python3.11 -m venv /venv RUN python -m pip install --upgrade nox --no-cache-dir COPY . /src From 514ee3305be8425bbbb94a327c7e5934fc03ce92 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 12 Sep 2023 05:28:48 +0000 Subject: [PATCH 30/75] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black-pre-commit-mirror: 23.9.0 → 23.9.1](https://github.com/psf/black-pre-commit-mirror/compare/23.9.0...23.9.1) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e5475e2..beb0e7d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,7 +34,7 @@ repos: # Format code. No, I don't like everything black does either. - repo: https://github.com/psf/black-pre-commit-mirror - rev: 23.9.0 + rev: 23.9.1 hooks: - id: black From 3d270c5317674377305112feb1db509c3739e062 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 19 Sep 2023 04:53:25 +0000 Subject: [PATCH 31/75] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/asottile/reorder-python-imports: v3.10.0 → v3.11.0](https://github.com/asottile/reorder-python-imports/compare/v3.10.0...v3.11.0) - [github.com/asottile/pyupgrade: v3.10.1 → v3.11.0](https://github.com/asottile/pyupgrade/compare/v3.10.1...v3.11.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index beb0e7d..06b82cb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,7 +14,7 @@ repos: # Adds a standard feel to import segments, adds future annotations - repo: https://github.com/asottile/reorder-python-imports - rev: v3.10.0 + rev: v3.11.0 hooks: - id: reorder-python-imports args: @@ -26,7 +26,7 @@ repos: # Automatically upgrade syntax to newer versions - repo: https://github.com/asottile/pyupgrade - rev: v3.10.1 + rev: v3.11.0 hooks: - id: pyupgrade args: From 5b10058c1549c27763da18599bc2c7dac2bd219b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 26 Sep 2023 05:08:34 +0000 Subject: [PATCH 32/75] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/asottile/pyupgrade: v3.11.0 → v3.13.0](https://github.com/asottile/pyupgrade/compare/v3.11.0...v3.13.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 06b82cb..b70a27a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,7 +26,7 @@ repos: # Automatically upgrade syntax to newer versions - repo: https://github.com/asottile/pyupgrade - rev: v3.11.0 + rev: v3.13.0 hooks: - id: pyupgrade args: From 1716b6cbcca740df601730d1944a8009065cc303 Mon Sep 17 00:00:00 2001 From: Preocts Date: Mon, 2 Oct 2023 15:55:09 -0400 Subject: [PATCH 33/75] Mark 3.12 support --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 19569f9..b5dc744 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Python 3.8 | 3.9 | 3.10 | 3.11](https://img.shields.io/badge/Python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11-blue)](https://www.python.org/downloads) +[![Python 3.8 | 3.9 | 3.10 | 3.11 | 3.12](https://img.shields.io/badge/Python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)](https://www.python.org/downloads) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit) From 3b3d3a76db533f6b917fba35b08036c2e1375314 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 3 Oct 2023 06:19:18 +0000 Subject: [PATCH 34/75] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/asottile/reorder-python-imports: v3.11.0 → v3.12.0](https://github.com/asottile/reorder-python-imports/compare/v3.11.0...v3.12.0) - [github.com/asottile/pyupgrade: v3.13.0 → v3.14.0](https://github.com/asottile/pyupgrade/compare/v3.13.0...v3.14.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b70a27a..61e7e2c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,7 +14,7 @@ repos: # Adds a standard feel to import segments, adds future annotations - repo: https://github.com/asottile/reorder-python-imports - rev: v3.11.0 + rev: v3.12.0 hooks: - id: reorder-python-imports args: @@ -26,7 +26,7 @@ repos: # Automatically upgrade syntax to newer versions - repo: https://github.com/asottile/pyupgrade - rev: v3.13.0 + rev: v3.14.0 hooks: - id: pyupgrade args: From 3374d7da09a5e60935c595cbe0de8de2610bdc27 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 19:57:48 +0000 Subject: [PATCH 35/75] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.5.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.4.0...v4.5.0) - [github.com/asottile/pyupgrade: v3.14.0 → v3.15.0](https://github.com/asottile/pyupgrade/compare/v3.14.0...v3.15.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 61e7e2c..4d0522e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ repos: # Batch of helpful formatters and patterns - repo: https://github.com/pre-commit/pre-commit-hooks - rev: "v4.4.0" + rev: "v4.5.0" hooks: - id: check-json - id: check-toml @@ -26,7 +26,7 @@ repos: # Automatically upgrade syntax to newer versions - repo: https://github.com/asottile/pyupgrade - rev: v3.14.0 + rev: v3.15.0 hooks: - id: pyupgrade args: From 06ba1665b1836ef4489ecc69e4e91f3d5431953c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 19:32:58 +0000 Subject: [PATCH 36/75] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/mirrors-mypy: v1.5.1 → v1.6.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.5.1...v1.6.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4d0522e..1b9c3ec 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -49,6 +49,6 @@ repos: # Type enforcement for Python - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.5.1 + rev: v1.6.0 hooks: - id: mypy From 4ec0514af29da2d0fc8ec49954cf4cdfbc275d80 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 19:54:20 +0000 Subject: [PATCH 37/75] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black-pre-commit-mirror: 23.9.1 → 23.10.0](https://github.com/psf/black-pre-commit-mirror/compare/23.9.1...23.10.0) - [github.com/pre-commit/mirrors-mypy: v1.6.0 → v1.6.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.6.0...v1.6.1) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1b9c3ec..dd0d7c9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,7 +34,7 @@ repos: # Format code. No, I don't like everything black does either. - repo: https://github.com/psf/black-pre-commit-mirror - rev: 23.9.1 + rev: 23.10.0 hooks: - id: black @@ -49,6 +49,6 @@ repos: # Type enforcement for Python - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.6.0 + rev: v1.6.1 hooks: - id: mypy From 64d7995334f9726254d7fc19474d211adeee1276 Mon Sep 17 00:00:00 2001 From: Preocts Date: Sat, 28 Oct 2023 19:11:25 -0400 Subject: [PATCH 38/75] refine readme --- README.md | 85 ++++++++++++++++++++++++++----------------------------- 1 file changed, 40 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index b5dc744..617d857 100644 --- a/README.md +++ b/README.md @@ -42,15 +42,19 @@ fit. # Local developer installation -It is **strongly** recommended to use a virtual environment -([`venv`](https://docs.python.org/3/library/venv.html)) when working with python -projects. Leveraging a `venv` will ensure the installed dependency files will -not impact other python projects or any system dependencies. - The following steps outline how to install this repo for local development. See the [CONTRIBUTING.md](CONTRIBUTING.md) file in the repo root for information on contributing to the repo. +## Prerequisites + +### It is recommended to use a virtual environment + +Use a ([`venv`](https://docs.python.org/3/library/venv.html)), or equivalent, +when working with python projects. Leveraging a `venv` will ensure the installed +dependency files will not impact other python projects or any system +dependencies. + **Windows users**: Depending on your python install you will use `py` in place of `python` to create the `venv`. @@ -61,18 +65,7 @@ the desired version while creating the `venv`. (e.g. `python3` or `python3.8`) `python` for command line instructions. This will ensure you are using the `venv`'s python and not the system level python. ---- - -## Installation steps - -Clone this repo and enter root directory of repo: - -```console -git clone https://github.com/[ORG NAME]/[REPO NAME] -cd [REPO NAME] -``` - -Create the `venv`: +### Create the `venv`: ```console python -m venv venv @@ -91,6 +84,24 @@ venv\Scripts\activate The command prompt should now have a `(venv)` prefix on it. `python` will now call the version of the interpreter used to create the `venv` +To deactivate (exit) the `venv`: + +```console +deactivate +``` + + +--- + +## Developer Installation Steps + +Clone this repo and enter root directory of repo: + +```console +git clone https://github.com/[ORG NAME]/[REPO NAME] +cd [REPO NAME] +``` + Install editable library and development requirements: ```console @@ -105,7 +116,7 @@ pre-commit install --- -## Misc Steps +## Pre-commit and nox tools Run pre-commit on all files: @@ -113,13 +124,13 @@ Run pre-commit on all files: pre-commit run --all-files ``` -Run tests (quick): +Run tests with coverage (quick): ```console -pytest +nox -e coverage ``` -Run tests: +Run tests (slow): ```console nox @@ -128,14 +139,7 @@ nox Build dist: ```console -python -m pip install --upgrade build -python -m build -``` - -To deactivate (exit) the `venv`: - -```console -deactivate +nox -e build ``` --- @@ -152,12 +156,14 @@ Once updated following the steps below, the package can be installed if needed. To update the generated files with a dependency: ```console -pip-compile --no-emit-index-url requirements/requirements.in -pip-compile --no-emit-index-url requirements/requirements-dev.in -pip-compile --no-emit-index-url requirements/requirements-test.in +nox -e update ``` -To attempt to upgrade all generated dependencies add the `--upgrade` flag. +To attempt to upgrade all generated dependencies: + +```console +nox -e upgrade +``` --- @@ -167,20 +173,9 @@ To attempt to upgrade all generated dependencies add the `--upgrade` flag. This repo is setup with a `.pre-commit-config.yaml` with the expectation that any code submitted for review already passes all selected pre-commit checks. -`pre-commit` is installed with the development requirements and runs seemlessly -with `git` hooks. --- ## Error: File "setup.py" not found. -If you recieve this error while installing an editible version of this project you have two choices: - -1. Update your `pip` to *at least* version 22.3.1 -2. Add the following empty `setup.py` to the project if upgrading pip is not an option - -```py -from setuptools import setup - -setup() -``` +Update `pip` to at least version 22.3.1 From 3f5050d2ba8e7d24f869d8adfc139c91e16eabf4 Mon Sep 17 00:00:00 2001 From: Preocts Date: Sat, 28 Oct 2023 19:18:57 -0400 Subject: [PATCH 39/75] Update requirements to 3.11 dev env --- requirements/requirements-dev.txt | 30 ++++++++++++------------------ requirements/requirements-test.txt | 26 +++++++++----------------- requirements/requirements.txt | 2 +- 3 files changed, 22 insertions(+), 36 deletions(-) diff --git a/requirements/requirements-dev.txt b/requirements/requirements-dev.txt index b809070..40e3f0c 100644 --- a/requirements/requirements-dev.txt +++ b/requirements/requirements-dev.txt @@ -1,10 +1,10 @@ # -# This file is autogenerated by pip-compile with Python 3.8 +# This file is autogenerated by pip-compile with Python 3.11 # by the following command: # # pip-compile --no-emit-index-url requirements/requirements-dev.in # -black==23.7.0 +black==23.10.1 # via -r requirements/requirements-dev.in cfgv==3.4.0 # via pre-commit @@ -12,7 +12,7 @@ click==8.1.7 # via black distlib==0.3.7 # via virtualenv -filelock==3.12.2 +filelock==3.13.0 # via virtualenv flake8==6.1.0 # via @@ -22,11 +22,11 @@ flake8-builtins==2.1.0 # via -r requirements/requirements-dev.in flake8-pep585==0.1.7 # via -r requirements/requirements-dev.in -identify==2.5.26 +identify==2.5.31 # via pre-commit mccabe==0.7.0 # via flake8 -mypy==1.5.1 +mypy==1.6.1 # via -r requirements/requirements-dev.in mypy-extensions==1.0.0 # via @@ -34,31 +34,25 @@ mypy-extensions==1.0.0 # mypy nodeenv==1.8.0 # via pre-commit -packaging==23.1 +packaging==23.2 # via black pathspec==0.11.2 # via black -platformdirs==3.10.0 +platformdirs==3.11.0 # via # black # virtualenv -pre-commit==3.3.3 +pre-commit==3.5.0 # via -r requirements/requirements-dev.in -pycodestyle==2.11.0 +pycodestyle==2.11.1 # via flake8 pyflakes==3.1.0 # via flake8 pyyaml==6.0.1 # via pre-commit -tomli==2.0.1 - # via - # black - # mypy -typing-extensions==4.7.1 - # via - # black - # mypy -virtualenv==20.24.3 +typing-extensions==4.8.0 + # via mypy +virtualenv==20.24.6 # via pre-commit # The following packages are considered to be unsafe in a requirements file: diff --git a/requirements/requirements-test.txt b/requirements/requirements-test.txt index 54081a5..055c989 100644 --- a/requirements/requirements-test.txt +++ b/requirements/requirements-test.txt @@ -1,44 +1,36 @@ # -# This file is autogenerated by pip-compile with Python 3.8 +# This file is autogenerated by pip-compile with Python 3.11 # by the following command: # # pip-compile --no-emit-index-url requirements/requirements-test.in # -argcomplete==3.1.1 +argcomplete==3.1.2 # via nox colorlog==6.7.0 # via nox -coverage==7.3.0 +coverage==7.3.2 # via -r requirements/requirements-test.in distlib==0.3.7 # via virtualenv -exceptiongroup==1.1.3 - # via pytest -filelock==3.12.2 +filelock==3.13.0 # via virtualenv -importlib-metadata==6.8.0 - # via pytest-randomly iniconfig==2.0.0 # via pytest nox==2023.4.22 # via -r requirements/requirements-test.in -packaging==23.1 +packaging==23.2 # via # nox # pytest -platformdirs==3.10.0 +platformdirs==3.11.0 # via virtualenv -pluggy==1.2.0 +pluggy==1.3.0 # via pytest -pytest==7.4.0 +pytest==7.4.3 # via # -r requirements/requirements-test.in # pytest-randomly pytest-randomly==3.15.0 # via -r requirements/requirements-test.in -tomli==2.0.1 - # via pytest -virtualenv==20.24.3 +virtualenv==20.24.6 # via nox -zipp==3.16.2 - # via importlib-metadata diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 7ab7d2e..110ef67 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.8 +# This file is autogenerated by pip-compile with Python 3.11 # by the following command: # # pip-compile --no-emit-index-url requirements/requirements.in From d7344325bcf301fe38ee6c643a717aef5ba278ab Mon Sep 17 00:00:00 2001 From: Preocts Date: Sat, 28 Oct 2023 19:46:34 -0400 Subject: [PATCH 40/75] refine readme --- README.md | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 617d857..8dfb510 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,15 @@ contributing to the repo. ## Prerequisites -### It is recommended to use a virtual environment +### Clone repo + +```console +git clone https://github.com/[ORG NAME]/[REPO NAME] + +cd [REPO NAME] +``` + +### Virtual Environment Use a ([`venv`](https://docs.python.org/3/library/venv.html)), or equivalent, when working with python projects. Leveraging a `venv` will ensure the installed @@ -90,25 +98,17 @@ To deactivate (exit) the `venv`: deactivate ``` - --- ## Developer Installation Steps -Clone this repo and enter root directory of repo: - -```console -git clone https://github.com/[ORG NAME]/[REPO NAME] -cd [REPO NAME] -``` - -Install editable library and development requirements: +### Install editable library and development requirements ```console python -m pip install --editable .[dev,test] ``` -Install pre-commit [(see below for details)](#pre-commit): +### Install pre-commit [(see below for details)](#pre-commit) ```console pre-commit install @@ -118,25 +118,25 @@ pre-commit install ## Pre-commit and nox tools -Run pre-commit on all files: +### Run pre-commit on all files ```console pre-commit run --all-files ``` -Run tests with coverage (quick): +### Run tests with coverage (quick) ```console nox -e coverage ``` -Run tests (slow): +### Run tests (slow) ```console nox ``` -Build dist: +### Build dist ```console nox -e build @@ -153,13 +153,13 @@ generated `requirements-*.txt` files. Once updated following the steps below, the package can be installed if needed. -To update the generated files with a dependency: +### Update the generated files with changes ```console nox -e update ``` -To attempt to upgrade all generated dependencies: +### Upgrade all generated dependencies ```console nox -e upgrade @@ -176,6 +176,6 @@ any code submitted for review already passes all selected pre-commit checks. --- -## Error: File "setup.py" not found. +## Error: File "setup.py" not found Update `pip` to at least version 22.3.1 From e858608e7dcfd5d75a94d4f7ae862f594bd65e2f Mon Sep 17 00:00:00 2001 From: Preocts Date: Sat, 28 Oct 2023 19:59:59 -0400 Subject: [PATCH 41/75] reformat pyproject.toml (remove terrible auto-formatter) --- pyproject.toml | 47 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a1b2582..64326bd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,7 @@ [build-system] -requires = ["setuptools"] +requires = [ + "setuptools", +] build-backend = "setuptools.build_meta" [project] @@ -9,7 +11,9 @@ requires-python = ">=3.8" description = "Module Description" readme = "README.md" license = { file = "LICENSE" } -authors = [{ email = "yourname@email.invalid", name = "[YOUR NAME]" }] +authors = [ + { email = "yourname@email.invalid", name = "[YOUR NAME]" }, +] maintainers = [] keywords = [] classifiers = [ @@ -19,14 +23,23 @@ classifiers = [ "Programming Language :: Python :: Implementation :: CPython", ] # Dynamic dependencies are loaded from requirements*.txt files -dynamic = ["dependencies", "optional-dependencies"] +dynamic = [ + "dependencies", + "optional-dependencies", +] [tool.setuptools.dynamic.dependencies] -file = ["requirements/requirements.txt"] +file = [ + "requirements/requirements.txt", +] [tool.setuptools.dynamic.optional-dependencies] -dev = { file = ["requirements/requirements-dev.txt"] } -test = { file = ["requirements/requirements-test.txt"] } +dev = { file = [ + "requirements/requirements-dev.txt", + ] } +test = { file = [ + "requirements/requirements-test.txt", + ] } # Alertative way to specify dependencies # dependencies = [] @@ -52,7 +65,9 @@ homepage = "https://github.com/[ORG NAME]/[REPO NAME]" # namespaces = true # true by default [tool.setuptools.package-data] -"module_name" = ["py.typed"] +"module_name" = [ + "py.typed", +] [tool.mypy] check_untyped_defs = true @@ -71,12 +86,22 @@ warn_unused_ignores = false [tool.coverage.run] branch = true -source = ["tests"] -source_pkgs = ["module_name"] +source = [ + "tests", +] +source_pkgs = [ + "module_name", +] [tool.coverage.paths] -source = ["src/", "*/site-packages"] -test = ["tests/", "*/tests"] +source = [ + "src/", + "*/site-packages", +] +test = [ + "tests/", + "*/tests", +] [tool.coverage.report] exclude_lines = [ From 1fa4dda59ca7f976a7f21a7f5ab7b8779d32b3b9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 30 Oct 2023 19:42:34 +0000 Subject: [PATCH 42/75] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black-pre-commit-mirror: 23.10.0 → 23.10.1](https://github.com/psf/black-pre-commit-mirror/compare/23.10.0...23.10.1) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index dd0d7c9..c6795d6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,7 +34,7 @@ repos: # Format code. No, I don't like everything black does either. - repo: https://github.com/psf/black-pre-commit-mirror - rev: 23.10.0 + rev: 23.10.1 hooks: - id: black From ae237b3597d6d9443b3afdffbe997f8c1c1b4145 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 13 Nov 2023 19:58:32 +0000 Subject: [PATCH 43/75] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black-pre-commit-mirror: 23.10.1 → 23.11.0](https://github.com/psf/black-pre-commit-mirror/compare/23.10.1...23.11.0) - [github.com/pre-commit/mirrors-mypy: v1.6.1 → v1.7.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.6.1...v1.7.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c6795d6..adca0b9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,7 +34,7 @@ repos: # Format code. No, I don't like everything black does either. - repo: https://github.com/psf/black-pre-commit-mirror - rev: 23.10.1 + rev: 23.11.0 hooks: - id: black @@ -49,6 +49,6 @@ repos: # Type enforcement for Python - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.6.1 + rev: v1.7.0 hooks: - id: mypy From 74a3b635482276565eac6934097cbe11fb3f8606 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 27 Nov 2023 19:29:57 +0000 Subject: [PATCH 44/75] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/mirrors-mypy: v1.7.0 → v1.7.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.7.0...v1.7.1) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index adca0b9..b980674 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -49,6 +49,6 @@ repos: # Type enforcement for Python - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.7.0 + rev: v1.7.1 hooks: - id: mypy From b9286cad7ab6cc2c670e0d99350b2b5e97eaed3b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 18 Dec 2023 19:59:49 +0000 Subject: [PATCH 45/75] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black-pre-commit-mirror: 23.11.0 → 23.12.0](https://github.com/psf/black-pre-commit-mirror/compare/23.11.0...23.12.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b980674..d8a010f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,7 +34,7 @@ repos: # Format code. No, I don't like everything black does either. - repo: https://github.com/psf/black-pre-commit-mirror - rev: 23.11.0 + rev: 23.12.0 hooks: - id: black From 80ef979e6da7dc4171e5ac45419d3e885cc92d0c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 25 Dec 2023 19:43:50 +0000 Subject: [PATCH 46/75] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black-pre-commit-mirror: 23.12.0 → 23.12.1](https://github.com/psf/black-pre-commit-mirror/compare/23.12.0...23.12.1) - [github.com/pre-commit/mirrors-mypy: v1.7.1 → v1.8.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.7.1...v1.8.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d8a010f..5504f23 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,7 +34,7 @@ repos: # Format code. No, I don't like everything black does either. - repo: https://github.com/psf/black-pre-commit-mirror - rev: 23.12.0 + rev: 23.12.1 hooks: - id: black @@ -49,6 +49,6 @@ repos: # Type enforcement for Python - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.7.1 + rev: v1.8.0 hooks: - id: mypy From 2919b13008ae12c1759a41564b72b5a900864245 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 8 Jan 2024 19:45:20 +0000 Subject: [PATCH 47/75] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/PyCQA/flake8: 6.1.0 → 7.0.0](https://github.com/PyCQA/flake8/compare/6.1.0...7.0.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5504f23..939f949 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -40,7 +40,7 @@ repos: # Flake8 for linting, line-length adjusted to match Black default - repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 + rev: 7.0.0 hooks: - id: flake8 additional_dependencies: From 7a9f6768e0640b0f2f7e7cc5bf7da0fe08005c94 Mon Sep 17 00:00:00 2001 From: Preocts Date: Tue, 30 Jan 2024 18:16:08 -0500 Subject: [PATCH 48/75] Replace reorder-python-imports, remove pyupgrade Do to conflicts against the format of `black`, the tool `reorder-python-imports` is replaced with `isort`. Removing `pyupgrade` to reduce tool opinionation further. --- .pre-commit-config.yaml | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 939f949..b01d0c2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,25 +12,12 @@ repos: - id: debug-statements - id: mixed-line-ending - # Adds a standard feel to import segments, adds future annotations - - repo: https://github.com/asottile/reorder-python-imports - rev: v3.12.0 + # Adds a standard feel to import segments + - repo: https://github.com/pycqa/isort + rev: 5.5.4 hooks: - - id: reorder-python-imports - args: - - "--py37-plus" - - "--add-import" - - "from __future__ import annotations" - - "--application-directories" - - ".:src" - - # Automatically upgrade syntax to newer versions - - repo: https://github.com/asottile/pyupgrade - rev: v3.15.0 - hooks: - - id: pyupgrade - args: - - "--py38-plus" + - id: isort + args: ["--profile", "black"] # Format code. No, I don't like everything black does either. - repo: https://github.com/psf/black-pre-commit-mirror From d04202d108ab43f9f06c807b56e35828b087c18e Mon Sep 17 00:00:00 2001 From: Preocts Date: Tue, 30 Jan 2024 18:18:36 -0500 Subject: [PATCH 49/75] Update black to 24.x with formatting changes --- .pre-commit-config.yaml | 4 ++-- src/module_name/sample.py | 1 + tests/test_sample.py | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b01d0c2..b41436d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,14 +14,14 @@ repos: # Adds a standard feel to import segments - repo: https://github.com/pycqa/isort - rev: 5.5.4 + rev: 5.13.2 hooks: - id: isort args: ["--profile", "black"] # Format code. No, I don't like everything black does either. - repo: https://github.com/psf/black-pre-commit-mirror - rev: 23.12.1 + rev: 24.1.1 hooks: - id: black diff --git a/src/module_name/sample.py b/src/module_name/sample.py index 06e66dd..8f0589b 100644 --- a/src/module_name/sample.py +++ b/src/module_name/sample.py @@ -1,4 +1,5 @@ """This is just a sample file""" + from __future__ import annotations diff --git a/tests/test_sample.py b/tests/test_sample.py index e68214b..c748611 100644 --- a/tests/test_sample.py +++ b/tests/test_sample.py @@ -1,4 +1,5 @@ """Tests for sample""" + from __future__ import annotations import pytest From 6c40244581bdb8239933a9a05cd13aea5a3c6570 Mon Sep 17 00:00:00 2001 From: Preocts Date: Tue, 30 Jan 2024 18:27:45 -0500 Subject: [PATCH 50/75] Ensure isort forces single line imports --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b41436d..946797a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: rev: 5.13.2 hooks: - id: isort - args: ["--profile", "black"] + args: ["--profile", "black", "--force-single-line-imports"] # Format code. No, I don't like everything black does either. - repo: https://github.com/psf/black-pre-commit-mirror From 6971409aeeb62fd3bf33d42fa8258e463e272343 Mon Sep 17 00:00:00 2001 From: Preocts Date: Tue, 30 Jan 2024 18:48:41 -0500 Subject: [PATCH 51/75] Include __future__.annotations import --- .pre-commit-config.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 946797a..e48d028 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,12 @@ repos: rev: 5.13.2 hooks: - id: isort - args: ["--profile", "black", "--force-single-line-imports"] + args: + - "--force-single-line-imports" + - "--add-import" + - "from __future__ import annotations" + - "--profile" + - "black" # Format code. No, I don't like everything black does either. - repo: https://github.com/psf/black-pre-commit-mirror From 665dfee005d20f40a17a20ad8e228c3e8e65f7b3 Mon Sep 17 00:00:00 2001 From: Preocts Date: Mon, 12 Feb 2024 00:01:04 -0500 Subject: [PATCH 52/75] Stop nox clean session from breaking venvs How about we don't delete the build folder inside the venv? resolves #151 --- noxfile.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/noxfile.py b/noxfile.py index bbfb610..9389d99 100644 --- a/noxfile.py +++ b/noxfile.py @@ -17,17 +17,17 @@ # What we allowed to clean (delete) CLEANABLE_TARGETS = [ - "./**/dist", - "./**/build", - "./**/.nox", + "./dist", + "./build", + "./.nox", + "./.coverage", + "./.coverage.*", + "./coverage.json", "./**/.mypy_cache", "./**/.pytest_cache", - "./**/.coverage", "./**/__pycache__", "./**/*.pyc", "./**/*.pyo", - "./**/coverage.json", - "./**/.coverage.*", ] From 8b2654c7507a50cbad9a4815bc660ebc30304ada Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 19 Feb 2024 23:23:59 +0000 Subject: [PATCH 53/75] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black-pre-commit-mirror: 24.1.1 → 24.2.0](https://github.com/psf/black-pre-commit-mirror/compare/24.1.1...24.2.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e48d028..719c54d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,7 +26,7 @@ repos: # Format code. No, I don't like everything black does either. - repo: https://github.com/psf/black-pre-commit-mirror - rev: 24.1.1 + rev: 24.2.0 hooks: - id: black From 2f67a467c0c4253a4abb5342386903d0062226c6 Mon Sep 17 00:00:00 2001 From: Preocts Date: Sun, 25 Feb 2024 15:06:45 -0500 Subject: [PATCH 54/75] Add install session for noxfile This probably fails in multiple ways for Windows but an attempt was made. --- README.md | 9 +++++++++ noxfile.py | 31 +++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/README.md b/README.md index 8dfb510..4fb109d 100644 --- a/README.md +++ b/README.md @@ -114,6 +114,15 @@ python -m pip install --editable .[dev,test] pre-commit install ``` +### Install with nox + +If you have `nox` installed with `pipx` or in the current venv you can use the +following session. This is an alternative to the two steps above. + +```console +nox -s install +``` + --- ## Pre-commit and nox tools diff --git a/noxfile.py b/noxfile.py index 9389d99..bc41d18 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,7 +1,9 @@ from __future__ import annotations +import os import pathlib import shutil +import sys import nox @@ -9,6 +11,9 @@ MODULE_NAME = "module_name" TESTS_PATH = "tests" COVERAGE_FAIL_UNDER = 50 +VENV_PATH = "venv" +WINDOWS_PYTHON = "py" +LINUX_PYTHON = "python3" REQUIREMENT_IN_FILES = [ pathlib.Path("requirements/requirements.in"), pathlib.Path("requirements/requirements-dev.in"), @@ -97,6 +102,32 @@ def build(session: nox.Session) -> None: session.run("python", "-m", "build") +@nox.session(python=False) +def install(session: nox.Session) -> None: + """Setup a development environment. Uses active venv if available, builds one if not.""" + # Use the active environement if it exists, otherwise create a new one + venv_path = os.environ.get("VIRTUAL_ENV", VENV_PATH) + + if sys.platform == "win32": + py_command = "py" + venv_path = f"{venv_path}/Scripts" + activate_command = f"{venv_path}/activate" + else: + py_command = "python3" + venv_path = f"{venv_path}/bin" + activate_command = f"source {venv_path}/activate" + + if not os.path.exists(VENV_PATH): + session.run(py_command, "-m", "venv", VENV_PATH) + session.run(f"{venv_path}/python", "-m", "pip", "install", "--upgrade", "pip") + + session.run(f"{venv_path}/python", "-m", "pip", "install", "-e", ".[dev,test]") + session.run(f"{venv_path}/pre-commit", "install") + + if not os.environ.get("VIRTUAL_ENV"): + session.log(f"\n\nRun '{activate_command}' to enter the virtual environment.\n") + + @nox.session() def update(session: nox.Session) -> None: """Process requirement*.in files, updating only additions/removals.""" From 88ac4441c0dee8f5af5211455e81abc40a449a31 Mon Sep 17 00:00:00 2001 From: Preocts Date: Tue, 12 Mar 2024 00:17:11 -0400 Subject: [PATCH 55/75] Run nox sessions and ci in 3.11 This is the default version used. Tests still assert prior and later versions are supported by default. --- .github/workflows/python-tests.yml | 4 ++-- noxfile.py | 15 +++++++-------- requirements/requirements-dev.txt | 28 ++++++++++++++-------------- requirements/requirements-test.txt | 22 +++++++++++----------- 4 files changed, 34 insertions(+), 35 deletions(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index e8c0374..9f45b0a 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -67,7 +67,7 @@ jobs: - name: "Set up Python" uses: "actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1" with: - python-version: "3.10" + python-version: "3.11" - name: "Install nox" run: | @@ -95,7 +95,7 @@ jobs: - name: "Set up Python" uses: "actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1" with: - python-version: "3.10" + python-version: "3.11" - name: "Install nox" run: | diff --git a/noxfile.py b/noxfile.py index bc41d18..f2a3186 100644 --- a/noxfile.py +++ b/noxfile.py @@ -11,9 +11,8 @@ MODULE_NAME = "module_name" TESTS_PATH = "tests" COVERAGE_FAIL_UNDER = 50 +DEFAULT_PYTHON_VERSION = "3.11" VENV_PATH = "venv" -WINDOWS_PYTHON = "py" -LINUX_PYTHON = "python3" REQUIREMENT_IN_FILES = [ pathlib.Path("requirements/requirements.in"), pathlib.Path("requirements/requirements-dev.in"), @@ -55,7 +54,7 @@ def tests_with_coverage(session: nox.Session) -> None: session.run("coverage", "run", "-p", "-m", "pytest", TESTS_PATH) -@nox.session() +@nox.session(python=DEFAULT_PYTHON_VERSION) def coverage_combine_and_report(session: nox.Session) -> None: """Combine all coverage partial files and generate JSON report.""" print_standard_logs(session) @@ -68,7 +67,7 @@ def coverage_combine_and_report(session: nox.Session) -> None: session.run("python", "-m", "coverage", "json") -@nox.session() +@nox.session(python=DEFAULT_PYTHON_VERSION) def mypy_check(session: nox.Session) -> None: """Run mypy against package and all required dependencies.""" print_standard_logs(session) @@ -93,7 +92,7 @@ def docker(session: nox.Session) -> None: session.run("docker", "run", "-it", "--rm", "pydocker-test") -@nox.session() +@nox.session(python=DEFAULT_PYTHON_VERSION) def build(session: nox.Session) -> None: """Build distrobution files.""" print_standard_logs(session) @@ -113,7 +112,7 @@ def install(session: nox.Session) -> None: venv_path = f"{venv_path}/Scripts" activate_command = f"{venv_path}/activate" else: - py_command = "python3" + py_command = f"python{DEFAULT_PYTHON_VERSION}" venv_path = f"{venv_path}/bin" activate_command = f"source {venv_path}/activate" @@ -128,7 +127,7 @@ def install(session: nox.Session) -> None: session.log(f"\n\nRun '{activate_command}' to enter the virtual environment.\n") -@nox.session() +@nox.session(python=DEFAULT_PYTHON_VERSION) def update(session: nox.Session) -> None: """Process requirement*.in files, updating only additions/removals.""" print_standard_logs(session) @@ -138,7 +137,7 @@ def update(session: nox.Session) -> None: session.run("pip-compile", "--no-emit-index-url", str(filename)) -@nox.session() +@nox.session(python=DEFAULT_PYTHON_VERSION) def upgrade(session: nox.Session) -> None: """Process requirement*.in files and upgrade all libraries as possible.""" print_standard_logs(session) diff --git a/requirements/requirements-dev.txt b/requirements/requirements-dev.txt index 40e3f0c..f638cdf 100644 --- a/requirements/requirements-dev.txt +++ b/requirements/requirements-dev.txt @@ -4,29 +4,29 @@ # # pip-compile --no-emit-index-url requirements/requirements-dev.in # -black==23.10.1 +black==24.2.0 # via -r requirements/requirements-dev.in cfgv==3.4.0 # via pre-commit click==8.1.7 # via black -distlib==0.3.7 +distlib==0.3.8 # via virtualenv -filelock==3.13.0 +filelock==3.13.1 # via virtualenv -flake8==6.1.0 +flake8==7.0.0 # via # -r requirements/requirements-dev.in # flake8-builtins -flake8-builtins==2.1.0 +flake8-builtins==2.2.0 # via -r requirements/requirements-dev.in flake8-pep585==0.1.7 # via -r requirements/requirements-dev.in -identify==2.5.31 +identify==2.5.35 # via pre-commit mccabe==0.7.0 # via flake8 -mypy==1.6.1 +mypy==1.9.0 # via -r requirements/requirements-dev.in mypy-extensions==1.0.0 # via @@ -34,25 +34,25 @@ mypy-extensions==1.0.0 # mypy nodeenv==1.8.0 # via pre-commit -packaging==23.2 +packaging==24.0 # via black -pathspec==0.11.2 +pathspec==0.12.1 # via black -platformdirs==3.11.0 +platformdirs==4.2.0 # via # black # virtualenv -pre-commit==3.5.0 +pre-commit==3.6.2 # via -r requirements/requirements-dev.in pycodestyle==2.11.1 # via flake8 -pyflakes==3.1.0 +pyflakes==3.2.0 # via flake8 pyyaml==6.0.1 # via pre-commit -typing-extensions==4.8.0 +typing-extensions==4.10.0 # via mypy -virtualenv==20.24.6 +virtualenv==20.25.1 # via pre-commit # The following packages are considered to be unsafe in a requirements file: diff --git a/requirements/requirements-test.txt b/requirements/requirements-test.txt index 055c989..9bd1d36 100644 --- a/requirements/requirements-test.txt +++ b/requirements/requirements-test.txt @@ -4,33 +4,33 @@ # # pip-compile --no-emit-index-url requirements/requirements-test.in # -argcomplete==3.1.2 +argcomplete==3.2.3 # via nox -colorlog==6.7.0 +colorlog==6.8.2 # via nox -coverage==7.3.2 +coverage==7.4.3 # via -r requirements/requirements-test.in -distlib==0.3.7 +distlib==0.3.8 # via virtualenv -filelock==3.13.0 +filelock==3.13.1 # via virtualenv iniconfig==2.0.0 # via pytest -nox==2023.4.22 +nox==2024.3.2 # via -r requirements/requirements-test.in -packaging==23.2 +packaging==24.0 # via # nox # pytest -platformdirs==3.11.0 +platformdirs==4.2.0 # via virtualenv -pluggy==1.3.0 +pluggy==1.4.0 # via pytest -pytest==7.4.3 +pytest==8.1.1 # via # -r requirements/requirements-test.in # pytest-randomly pytest-randomly==3.15.0 # via -r requirements/requirements-test.in -virtualenv==20.24.6 +virtualenv==20.25.1 # via nox From aeb0eb3664492aec53b546ea0101e1652afe749e Mon Sep 17 00:00:00 2001 From: Preocts Date: Tue, 12 Mar 2024 00:22:41 -0400 Subject: [PATCH 56/75] Bump github action versions --- .github/workflows/python-tests.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 9f45b0a..6d0031a 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -33,10 +33,10 @@ jobs: steps: - name: "Repo checkout" - uses: "actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9" + uses: "actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11" - name: "Set up Python ${{ matrix.python-version }}" - uses: "actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1" + uses: "actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c" with: python-version: "${{ matrix.python-version }}" allow-prereleases: true @@ -50,7 +50,7 @@ jobs: nox --session tests_with_coverage-${{ matrix.python-version }} - name: "Save coverage artifact" - uses: "actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce" + uses: "actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3" with: name: "coverage-artifact" path: ".coverage.*" @@ -62,10 +62,10 @@ jobs: runs-on: "ubuntu-latest" steps: - name: "Repo checkout" - uses: "actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9" + uses: "actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11" - name: "Set up Python" - uses: "actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1" + uses: "actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c" with: python-version: "3.11" @@ -74,7 +74,7 @@ jobs: python -m pip install --upgrade pip nox - name: "Download coverage artifacts" - uses: "actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a" + uses: "actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427" with: name: coverage-artifact @@ -90,10 +90,10 @@ jobs: runs-on: "ubuntu-latest" steps: - name: "Repo checkout" - uses: "actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9" + uses: "actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11" - name: "Set up Python" - uses: "actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1" + uses: "actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c" with: python-version: "3.11" From 81eb3686f31aaa47d5de8f178a74484d565f6837 Mon Sep 17 00:00:00 2001 From: Preocts Date: Tue, 12 Mar 2024 19:36:30 -0400 Subject: [PATCH 57/75] Migrate to v4 of upload/download artifact --- .github/workflows/python-tests.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 6d0031a..a694389 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -52,7 +52,7 @@ jobs: - name: "Save coverage artifact" uses: "actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3" with: - name: "coverage-artifact" + name: "coverage-artifact-${{ matrix.os}}-${{ matrix.python-version}}" path: ".coverage.*" retention-days: 1 @@ -76,7 +76,9 @@ jobs: - name: "Download coverage artifacts" uses: "actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427" with: - name: coverage-artifact + name: "coverage-artifacts" + pattern: "coverage-artifact-*" + merge-multiple: true - name: "Compile coverage data, print report" run: | From bb4d5effc896abbbf600cf759aaf7636ed46669f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 12 Mar 2024 23:37:03 +0000 Subject: [PATCH 58/75] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/mirrors-mypy: v1.8.0 → v1.9.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.8.0...v1.9.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 719c54d..57404a5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -41,6 +41,6 @@ repos: # Type enforcement for Python - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.8.0 + rev: v1.9.0 hooks: - id: mypy From 2aa6155e4d8129304f8d86e174974b7a62f1a422 Mon Sep 17 00:00:00 2001 From: Preocts Date: Tue, 12 Mar 2024 19:40:13 -0400 Subject: [PATCH 59/75] Remove name attribute Colour blindness is hard sometimes --- .github/workflows/python-tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index a694389..c78fa8d 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -76,7 +76,6 @@ jobs: - name: "Download coverage artifacts" uses: "actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427" with: - name: "coverage-artifacts" pattern: "coverage-artifact-*" merge-multiple: true From 372eaf048249b7ea1e3ebe99459859bc36ad3914 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 18 Mar 2024 21:05:09 +0000 Subject: [PATCH 60/75] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black-pre-commit-mirror: 24.2.0 → 24.3.0](https://github.com/psf/black-pre-commit-mirror/compare/24.2.0...24.3.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 57404a5..62773a2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,7 +26,7 @@ repos: # Format code. No, I don't like everything black does either. - repo: https://github.com/psf/black-pre-commit-mirror - rev: 24.2.0 + rev: 24.3.0 hooks: - id: black From 6ddefb64e1276ff93e3e4f3909945f486fe0fb1e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 8 Apr 2024 21:24:08 +0000 Subject: [PATCH 61/75] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v4.6.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.5.0...v4.6.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 62773a2..32e5c52 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ repos: # Batch of helpful formatters and patterns - repo: https://github.com/pre-commit/pre-commit-hooks - rev: "v4.5.0" + rev: "v4.6.0" hooks: - id: check-json - id: check-toml From ab38491cded5d9926cbea9ca36f7ea3253e3afd9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 15 Apr 2024 21:14:54 +0000 Subject: [PATCH 62/75] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black-pre-commit-mirror: 24.3.0 → 24.4.0](https://github.com/psf/black-pre-commit-mirror/compare/24.3.0...24.4.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 32e5c52..95b729e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,7 +26,7 @@ repos: # Format code. No, I don't like everything black does either. - repo: https://github.com/psf/black-pre-commit-mirror - rev: 24.3.0 + rev: 24.4.0 hooks: - id: black From 4e2ae9bb5cdcb95d29a67c89710d1abb15c0d429 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 29 Apr 2024 21:22:05 +0000 Subject: [PATCH 63/75] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black-pre-commit-mirror: 24.4.0 → 24.4.2](https://github.com/psf/black-pre-commit-mirror/compare/24.4.0...24.4.2) - [github.com/pre-commit/mirrors-mypy: v1.9.0 → v1.10.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.9.0...v1.10.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 95b729e..5942afb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,7 +26,7 @@ repos: # Format code. No, I don't like everything black does either. - repo: https://github.com/psf/black-pre-commit-mirror - rev: 24.4.0 + rev: 24.4.2 hooks: - id: black @@ -41,6 +41,6 @@ repos: # Type enforcement for Python - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.9.0 + rev: v1.10.0 hooks: - id: mypy From 404dc2079fbf0d199baa9af704e565bff6df11e3 Mon Sep 17 00:00:00 2001 From: Preocts Date: Mon, 20 May 2024 20:27:51 -0400 Subject: [PATCH 64/75] Remove docker files and nox sessions This was never used as imagined. --- .dockerignore | 9 --------- Dockerfile | 19 ------------------- noxfile.py | 7 ------- 3 files changed, 35 deletions(-) delete mode 100644 .dockerignore delete mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 59aab11..0000000 --- a/.dockerignore +++ /dev/null @@ -1,9 +0,0 @@ -venv/ -Dockerfile -.dockerignore -build/ -.nox/ -.pytest_cache/ -.mypy_cache/ -.github/ -*.egg-info/ diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index ab3bd90..0000000 --- a/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM ubuntu:focal - -ENV LANG=C.UTF-8 - -RUN apt-get update -RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends software-properties-common -RUN add-apt-repository -y 'ppa:deadsnakes/ppa' -RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends python3.8-distutils python3.8 python3.9 python3.10 python3.11-venv python3.12 -RUN rm -rf /var/lib/apt/lists/* - -WORKDIR /src - -ENV PATH=/venv/bin:$PATH -RUN python3.11 -m venv /venv -RUN python -m pip install --upgrade nox --no-cache-dir - -COPY . /src - -CMD ["nox"] diff --git a/noxfile.py b/noxfile.py index f2a3186..02e3ac0 100644 --- a/noxfile.py +++ b/noxfile.py @@ -85,13 +85,6 @@ def coverage(session: nox.Session) -> None: session.run("coverage", "report", "-m") -@nox.session(python=False) -def docker(session: nox.Session) -> None: - """Run tests in a docker container. Requires docker damon running.""" - session.run("docker", "build", "-t", "pydocker-test", ".") - session.run("docker", "run", "-it", "--rm", "pydocker-test") - - @nox.session(python=DEFAULT_PYTHON_VERSION) def build(session: nox.Session) -> None: """Build distrobution files.""" From c6a428ca3f06356af705bfe5688a5a1a9d8851ee Mon Sep 17 00:00:00 2001 From: Preocts Date: Mon, 20 May 2024 20:31:51 -0400 Subject: [PATCH 65/75] Move python matrix to a global --- noxfile.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/noxfile.py b/noxfile.py index 02e3ac0..88bd466 100644 --- a/noxfile.py +++ b/noxfile.py @@ -12,6 +12,7 @@ TESTS_PATH = "tests" COVERAGE_FAIL_UNDER = 50 DEFAULT_PYTHON_VERSION = "3.11" +PYTHON_MATRIX = ["3.8", "3.9", "3.10", "3.11", "3.12"] VENV_PATH = "venv" REQUIREMENT_IN_FILES = [ pathlib.Path("requirements/requirements.in"), @@ -43,9 +44,7 @@ ] -@nox.session( - python=["3.8", "3.9", "3.10", "3.11", "3.12"], -) +@nox.session(python=PYTHON_MATRIX) def tests_with_coverage(session: nox.Session) -> None: """Run unit tests with coverage saved to partial file.""" print_standard_logs(session) From 0e1eb6d1498c6da4ab34124b1d4e24037d99bcc4 Mon Sep 17 00:00:00 2001 From: KRRT7 <106575910+KRRT7@users.noreply.github.com> Date: Tue, 21 May 2024 00:36:20 +0000 Subject: [PATCH 66/75] typo nuke --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 88bd466..dc84232 100644 --- a/noxfile.py +++ b/noxfile.py @@ -86,7 +86,7 @@ def coverage(session: nox.Session) -> None: @nox.session(python=DEFAULT_PYTHON_VERSION) def build(session: nox.Session) -> None: - """Build distrobution files.""" + """Build distribution files.""" print_standard_logs(session) session.install("build") From 66e8e50c02a7f8cca83703e98f6761c2bf980132 Mon Sep 17 00:00:00 2001 From: Preocts Date: Thu, 13 Jun 2024 22:22:08 -0400 Subject: [PATCH 67/75] default to monthly auto updates for pre-commit ci --- .pre-commit-config.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5942afb..5505ec7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,6 @@ +ci: + autoupdate_schedule: monthly + repos: # Batch of helpful formatters and patterns - repo: https://github.com/pre-commit/pre-commit-hooks From 41f75298bc8538b0a46c0356a0904e245a1b7f33 Mon Sep 17 00:00:00 2001 From: Preocts Date: Mon, 17 Jun 2024 21:51:23 -0400 Subject: [PATCH 68/75] Remove final workflow step This didn't work as I expected it would in GitHub Actions. If a `needs` workflow fails the final workflow is skipped. Skipped workflows, however, do not prevent a PR from being merged. Instead, just require the mypy and coverage workflows. --- .github/workflows/python-tests.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index c78fa8d..aebb5cc 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -105,12 +105,3 @@ jobs: - name: "Enforce strict type annotations with mypy" run: | nox --session mypy_check - - ci-success: - name: "CI steps all completed successfully" - needs: ["coverage-compile", "mypy-check"] - runs-on: "ubuntu-latest" - steps: - - name: "Success" - run: | - echo "If you are seeing this, the CI run was successful." From 410ff43eba1d046c37053240c23083adfd1bf33d Mon Sep 17 00:00:00 2001 From: Preocts Date: Mon, 24 Jun 2024 23:13:20 -0400 Subject: [PATCH 69/75] Add pep8-naming flake8 plugin A rather helpful plugin. --- .pre-commit-config.yaml | 1 + requirements/requirements-dev.in | 1 + requirements/requirements-dev.txt | 3 +++ 3 files changed, 5 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5505ec7..66d6774 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -41,6 +41,7 @@ repos: additional_dependencies: - flake8-builtins - flake8-pep585 + - pep8-naming # Type enforcement for Python - repo: https://github.com/pre-commit/mirrors-mypy diff --git a/requirements/requirements-dev.in b/requirements/requirements-dev.in index e59aac0..8e39dbc 100644 --- a/requirements/requirements-dev.in +++ b/requirements/requirements-dev.in @@ -13,3 +13,4 @@ mypy flake8 flake8-builtins flake8-pep585 +pep8-naming diff --git a/requirements/requirements-dev.txt b/requirements/requirements-dev.txt index f638cdf..6f693c4 100644 --- a/requirements/requirements-dev.txt +++ b/requirements/requirements-dev.txt @@ -18,6 +18,7 @@ flake8==7.0.0 # via # -r requirements/requirements-dev.in # flake8-builtins + # pep8-naming flake8-builtins==2.2.0 # via -r requirements/requirements-dev.in flake8-pep585==0.1.7 @@ -38,6 +39,8 @@ packaging==24.0 # via black pathspec==0.12.1 # via black +pep8-naming==0.14.1 + # via -r requirements/requirements-dev.in platformdirs==4.2.0 # via # black From 271e27af998b00fa3edbce491701f77954ad5a10 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 22:27:21 +0000 Subject: [PATCH 70/75] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/PyCQA/flake8: 7.0.0 → 7.1.0](https://github.com/PyCQA/flake8/compare/7.0.0...7.1.0) - [github.com/pre-commit/mirrors-mypy: v1.10.0 → v1.10.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.10.0...v1.10.1) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 66d6774..3d41ed7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -35,7 +35,7 @@ repos: # Flake8 for linting, line-length adjusted to match Black default - repo: https://github.com/PyCQA/flake8 - rev: 7.0.0 + rev: 7.1.0 hooks: - id: flake8 additional_dependencies: @@ -45,6 +45,6 @@ repos: # Type enforcement for Python - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.10.0 + rev: v1.10.1 hooks: - id: mypy From 59e1984d8b4ff25ee77a1b18fa005425fc2c3581 Mon Sep 17 00:00:00 2001 From: Preocts Date: Wed, 31 Jul 2024 21:33:11 -0400 Subject: [PATCH 71/75] Add setuptools-scm for handling version Version will be dynamically determined based on the latest tag of the repository. --- pyproject.toml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 64326bd..78cfa57 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,9 @@ [build-system] -requires = [ - "setuptools", -] +requires = ["setuptools>=64", "setuptools_scm>=8"] build-backend = "setuptools.build_meta" [project] name = "module-name" -version = "0.1.0" requires-python = ">=3.8" description = "Module Description" readme = "README.md" @@ -26,8 +23,12 @@ classifiers = [ dynamic = [ "dependencies", "optional-dependencies", + "version", ] +[tool.setuptools_scm] +# Purposely left empty + [tool.setuptools.dynamic.dependencies] file = [ "requirements/requirements.txt", From 3095b123f2402be2f2aebd9b7658fd96b4ed08d5 Mon Sep 17 00:00:00 2001 From: Preocts Date: Wed, 31 Jul 2024 21:40:31 -0400 Subject: [PATCH 72/75] Clean up old formatter style --- pyproject.toml | 57 ++++++++------------------------------------------ 1 file changed, 9 insertions(+), 48 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 78cfa57..3948699 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,56 +19,27 @@ classifiers = [ "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: Implementation :: CPython", ] -# Dynamic dependencies are loaded from requirements*.txt files -dynamic = [ - "dependencies", - "optional-dependencies", - "version", -] +dynamic = ["dependencies", "optional-dependencies", "version"] [tool.setuptools_scm] # Purposely left empty [tool.setuptools.dynamic.dependencies] -file = [ - "requirements/requirements.txt", -] +file = ["requirements/requirements.txt"] [tool.setuptools.dynamic.optional-dependencies] -dev = { file = [ - "requirements/requirements-dev.txt", - ] } -test = { file = [ - "requirements/requirements-test.txt", - ] } - -# Alertative way to specify dependencies -# dependencies = [] - -# [project.optional-dependencies] -# dev = [] -# test = [] +dev = { file = ["requirements/requirements-dev.txt"] } +test = { file = ["requirements/requirements-test.txt"] } [project.urls] homepage = "https://github.com/[ORG NAME]/[REPO NAME]" -# documentation = "" -# repository = "" -# changelog = "" # CLI scripts if needed # [project.scripts] # python-src-example = "module_name.sample:main" -# [tool.setuptools.packages.find] -# where = ["src"] # ["."] by default -# include = ["*"] # ["*"] by default -# exclude = ["tests"] # empty by default -# namespaces = true # true by default - [tool.setuptools.package-data] -"module_name" = [ - "py.typed", -] +"module_name" = ["py.typed"] [tool.mypy] check_untyped_defs = true @@ -87,22 +58,12 @@ warn_unused_ignores = false [tool.coverage.run] branch = true -source = [ - "tests", -] -source_pkgs = [ - "module_name", -] +source = ["tests"] +source_pkgs = ["module_name"] [tool.coverage.paths] -source = [ - "src/", - "*/site-packages", -] -test = [ - "tests/", - "*/tests", -] +source = ["src/", "*/site-packages"] +test = ["tests/", "*/tests"] [tool.coverage.report] exclude_lines = [ From ca837c0a9591b42e7d0ce2960b489b00b55da973 Mon Sep 17 00:00:00 2001 From: Preocts Date: Wed, 31 Jul 2024 21:44:34 -0400 Subject: [PATCH 73/75] Default to 3.12, remove 3.8 --- noxfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/noxfile.py b/noxfile.py index dc84232..1b9f856 100644 --- a/noxfile.py +++ b/noxfile.py @@ -11,8 +11,8 @@ MODULE_NAME = "module_name" TESTS_PATH = "tests" COVERAGE_FAIL_UNDER = 50 -DEFAULT_PYTHON_VERSION = "3.11" -PYTHON_MATRIX = ["3.8", "3.9", "3.10", "3.11", "3.12"] +DEFAULT_PYTHON_VERSION = "3.12" +PYTHON_MATRIX = ["3.9", "3.10", "3.11", "3.12"] VENV_PATH = "venv" REQUIREMENT_IN_FILES = [ pathlib.Path("requirements/requirements.in"), From 9400932b4da249854267afdb47b77b16af0e5202 Mon Sep 17 00:00:00 2001 From: Preocts Date: Wed, 31 Jul 2024 21:50:10 -0400 Subject: [PATCH 74/75] Remove 3.8 support, default to 3.12 --- .github/workflows/python-tests.yml | 5 ++--- README.md | 2 +- pyproject.toml | 2 +- requirements/requirements-dev.txt | 2 +- requirements/requirements-test.txt | 2 +- requirements/requirements.txt | 2 +- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index aebb5cc..f2a5b22 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -25,7 +25,6 @@ jobs: - "windows-latest" - "ubuntu-latest" python-version: - - "3.8" - "3.9" - "3.10" - "3.11" @@ -67,7 +66,7 @@ jobs: - name: "Set up Python" uses: "actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c" with: - python-version: "3.11" + python-version: "3.12" - name: "Install nox" run: | @@ -96,7 +95,7 @@ jobs: - name: "Set up Python" uses: "actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c" with: - python-version: "3.11" + python-version: "3.12" - name: "Install nox" run: | diff --git a/README.md b/README.md index 4fb109d..6d353df 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Python 3.8 | 3.9 | 3.10 | 3.11 | 3.12](https://img.shields.io/badge/Python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)](https://www.python.org/downloads) +[![Python 3.9 | 3.10 | 3.11 | 3.12](https://img.shields.io/badge/Python-3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)](https://www.python.org/downloads) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit) diff --git a/pyproject.toml b/pyproject.toml index 3948699..284d9dc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "module-name" -requires-python = ">=3.8" +requires-python = ">=3.9" description = "Module Description" readme = "README.md" license = { file = "LICENSE" } diff --git a/requirements/requirements-dev.txt b/requirements/requirements-dev.txt index 6f693c4..860df5c 100644 --- a/requirements/requirements-dev.txt +++ b/requirements/requirements-dev.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # pip-compile --no-emit-index-url requirements/requirements-dev.in diff --git a/requirements/requirements-test.txt b/requirements/requirements-test.txt index 9bd1d36..d5b288e 100644 --- a/requirements/requirements-test.txt +++ b/requirements/requirements-test.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # pip-compile --no-emit-index-url requirements/requirements-test.in diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 110ef67..48a4bfc 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # pip-compile --no-emit-index-url requirements/requirements.in From cc87f573c92ce69de61ebedbd036e82aa21858ab Mon Sep 17 00:00:00 2001 From: Preocts Date: Wed, 31 Jul 2024 21:54:28 -0400 Subject: [PATCH 75/75] Add support for 3.13 Still in beta release 2 but this is a template and I can be a little earily for the busy-work --- .github/workflows/python-tests.yml | 1 + README.md | 2 +- noxfile.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index f2a5b22..b0efbd2 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -29,6 +29,7 @@ jobs: - "3.10" - "3.11" - "3.12" + - "3.13" steps: - name: "Repo checkout" diff --git a/README.md b/README.md index 6d353df..8861f43 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Python 3.9 | 3.10 | 3.11 | 3.12](https://img.shields.io/badge/Python-3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)](https://www.python.org/downloads) +[![Python 3.9 | 3.10 | 3.11 | 3.12 | 3.13](https://img.shields.io/badge/Python-3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue)](https://www.python.org/downloads) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit) diff --git a/noxfile.py b/noxfile.py index 1b9f856..1839451 100644 --- a/noxfile.py +++ b/noxfile.py @@ -12,7 +12,7 @@ TESTS_PATH = "tests" COVERAGE_FAIL_UNDER = 50 DEFAULT_PYTHON_VERSION = "3.12" -PYTHON_MATRIX = ["3.9", "3.10", "3.11", "3.12"] +PYTHON_MATRIX = ["3.9", "3.10", "3.11", "3.12", "3.13"] VENV_PATH = "venv" REQUIREMENT_IN_FILES = [ pathlib.Path("requirements/requirements.in"),