From e42f542397afb703464b77634d77519ccf437b65 Mon Sep 17 00:00:00 2001 From: Tom Fleet Date: Tue, 28 Dec 2021 16:29:06 +0000 Subject: [PATCH] Fix virtualenv setuptools version bug (#549) * Use SETUPTOOLS_USE_DISTUTILS env var rather than pinning virtualenv * Add explanatory comment and fix typo * Add a further explanatory comment for traceability * Add the SETUPTOOLS_USE_DISTUTILS env var to the nox lint session * Add session.posargs back to the lint session --- .github/workflows/ci.yml | 3 +++ noxfile.py | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 815cd5f5..be875bf4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,6 +3,9 @@ on: [push, pull_request] env: FORCE_COLOR: "1" PRE_COMMIT_COLOR: "always" + # 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 }} diff --git a/noxfile.py b/noxfile.py index d807c0bb..ee0e4516 100644 --- a/noxfile.py +++ b/noxfile.py @@ -93,11 +93,16 @@ def cover(session): @nox.session(python="3.9") def lint(session): """Run pre-commit linting.""" - # Pin virtualenv for pre-commit run + session.install("pre-commit") # See https://github.com/theacodes/nox/issues/545 - session.install("virtualenv==20.10.0", "pre-commit") + # 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"}, + *session.posargs, )