From 12eaa7afe77912c02db296d3f6b03e71c4981f23 Mon Sep 17 00:00:00 2001 From: Tom Date: Tue, 28 Dec 2021 15:56:03 +0000 Subject: [PATCH 1/5] Use SETUPTOOLS_USE_DISTUTILS env var rather than pinning virtualenv --- .github/workflows/ci.yml | 1 + noxfile.py | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 815cd5f5..3f4692d5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,6 +3,7 @@ on: [push, pull_request] env: FORCE_COLOR: "1" PRE_COMMIT_COLOR: "always" + SETUPTOOLS_USE_DISTUTIL: "stdlib" jobs: build: runs-on: ${{ matrix.os }} diff --git a/noxfile.py b/noxfile.py index d807c0bb..cea922fb 100644 --- a/noxfile.py +++ b/noxfile.py @@ -93,9 +93,7 @@ def cover(session): @nox.session(python="3.9") def lint(session): """Run pre-commit linting.""" - # Pin virtualenv for pre-commit run - # See https://github.com/theacodes/nox/issues/545 - session.install("virtualenv==20.10.0", "pre-commit") + session.install("pre-commit") session.run( "pre-commit", "run", "--all-files", "--show-diff-on-failure", *session.posargs ) From 7b17acb57ec4801170efea8e93aa8277ba6eff06 Mon Sep 17 00:00:00 2001 From: Tom Date: Tue, 28 Dec 2021 15:58:39 +0000 Subject: [PATCH 2/5] Add explanatory comment and fix typo --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3f4692d5..68e9acf9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ on: [push, pull_request] env: FORCE_COLOR: "1" PRE_COMMIT_COLOR: "always" - SETUPTOOLS_USE_DISTUTIL: "stdlib" + SETUPTOOLS_USE_DISTUTILS: "stdlib" # See https://github.com/theacodes/nox/issues/545 jobs: build: runs-on: ${{ matrix.os }} From 488668712d2d7c7e9515ab2ae021fd43723924fb Mon Sep 17 00:00:00 2001 From: Tom Date: Tue, 28 Dec 2021 16:07:20 +0000 Subject: [PATCH 3/5] Add a further explanatory comment for traceability --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 68e9acf9..be875bf4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,9 @@ on: [push, pull_request] env: FORCE_COLOR: "1" PRE_COMMIT_COLOR: "always" - SETUPTOOLS_USE_DISTUTILS: "stdlib" # See https://github.com/theacodes/nox/issues/545 + # See https://github.com/theacodes/nox/issues/545 + # and https://github.com/pre-commit/pre-commit/issues/2178#issuecomment-1002163763 + SETUPTOOLS_USE_DISTUTILS: "stdlib" jobs: build: runs-on: ${{ matrix.os }} From 0224be8eb382666453359046d3acd78da57d0e65 Mon Sep 17 00:00:00 2001 From: Tom Date: Tue, 28 Dec 2021 16:16:43 +0000 Subject: [PATCH 4/5] Add the SETUPTOOLS_USE_DISTUTILS env var to the nox lint session --- noxfile.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/noxfile.py b/noxfile.py index cea922fb..af9b62fb 100644 --- a/noxfile.py +++ b/noxfile.py @@ -91,11 +91,17 @@ def cover(session): @nox.session(python="3.9") -def lint(session): +def lint(session: nox.Session): """Run pre-commit linting.""" session.install("pre-commit") + # See https://github.com/theacodes/nox/issues/545 + # and https://github.com/pre-commit/pre-commit/issues/2178#issuecomment-1002163763 session.run( - "pre-commit", "run", "--all-files", "--show-diff-on-failure", *session.posargs + "pre-commit", + "run", + "--all-files", + "--show-diff-on-failure", + env={"SETUPTOOLS_USE_DISTUTILS": "stdlib"}, ) From d0986ae25ffaf9bcf3603b15aad2e378549abaec Mon Sep 17 00:00:00 2001 From: Tom Date: Tue, 28 Dec 2021 16:18:16 +0000 Subject: [PATCH 5/5] Add session.posargs back to the lint session --- noxfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index af9b62fb..ee0e4516 100644 --- a/noxfile.py +++ b/noxfile.py @@ -91,7 +91,7 @@ def cover(session): @nox.session(python="3.9") -def lint(session: nox.Session): +def lint(session): """Run pre-commit linting.""" session.install("pre-commit") # See https://github.com/theacodes/nox/issues/545 @@ -102,6 +102,7 @@ def lint(session: nox.Session): "--all-files", "--show-diff-on-failure", env={"SETUPTOOLS_USE_DISTUTILS": "stdlib"}, + *session.posargs, )