diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index beb50178528..30811a43a8d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -190,7 +190,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install --upgrade wheel setuptools tox + pip install --upgrade wheel setuptools setuptools_scm[toml] tox - name: Build package run: | python setup.py sdist bdist_wheel diff --git a/changelog/8133.trivial.rst b/changelog/8133.trivial.rst new file mode 100644 index 00000000000..c4493b87fc7 --- /dev/null +++ b/changelog/8133.trivial.rst @@ -0,0 +1 @@ +Migrate to setuptools_scm 5.x to use SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST for more robust release tooling. diff --git a/pyproject.toml b/pyproject.toml index dd4be6c22d5..a80cf8e63bf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ requires = [ # sync with setup.py until we discard non-pep-517/518 "setuptools>=42.0", - "setuptools-scm[toml]>=3.4", + "setuptools-scm[toml]>=5.0.1", "wheel", ] build-backend = "setuptools.build_meta" diff --git a/scripts/release.py b/scripts/release.py index 798e42e1fe0..5bd8f9efb3c 100644 --- a/scripts/release.py +++ b/scripts/release.py @@ -63,7 +63,7 @@ def regen(version): print(f"{Fore.CYAN}[generate.regen] {Fore.RESET}Updating docs") check_call( ["tox", "-e", "regen"], - env={**os.environ, "SETUPTOOLS_SCM_PRETEND_VERSION": version}, + env={**os.environ, "SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST": version}, ) diff --git a/setup.cfg b/setup.cfg index 14fdb6df5c0..04e7a5028c9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -55,7 +55,7 @@ package_dir = =src setup_requires = setuptools>=>=42.0 - setuptools-scm>=3.4 + setuptools-scm>=5.0.1 zip_safe = no [options.entry_points] diff --git a/tox.ini b/tox.ini index 908f56ea681..877b662efd2 100644 --- a/tox.ini +++ b/tox.ini @@ -16,6 +16,8 @@ envlist = docs docs-checklinks + + [testenv] commands = {env:_PYTEST_TOX_COVERAGE_RUN:} pytest {posargs:{env:_PYTEST_TOX_DEFAULT_POSARGS:}} @@ -23,6 +25,7 @@ commands = coverage: coverage combine coverage: coverage report -m passenv = USER USERNAME COVERAGE_* PYTEST_ADDOPTS TERM +passenv = USER USERNAME COVERAGE_* PYTEST_ADDOPTS TERM SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST setenv = _PYTEST_TOX_DEFAULT_POSARGS={env:_PYTEST_TOX_POSARGS_DOCTESTING:} {env:_PYTEST_TOX_POSARGS_LSOF:} {env:_PYTEST_TOX_POSARGS_XDIST:} @@ -83,10 +86,7 @@ commands = [testenv:regen] changedir = doc/en basepython = python3 -passenv = SETUPTOOLS_SCM_PRETEND_VERSION -# TODO: When setuptools-scm 5.0.0 is released, use SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST -# and remove the next line. -install_command=python -m pip --use-deprecated=legacy-resolver install {opts} {packages} +passenv = SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST deps = dataclasses PyYAML @@ -112,8 +112,6 @@ changedir = testing/plugins_integration deps = -rtesting/plugins_integration/requirements.txt setenv = PYTHONPATH=. - # due to pytest-rerunfailures requiring 6.2+; can be removed after 6.2.0 - SETUPTOOLS_SCM_PRETEND_VERSION=6.2.0a1 commands = pip check pytest bdd_wallet.py @@ -187,6 +185,7 @@ extend-ignore = ; Docstring Content Issues D400,D401,D401,D402,D405,D406,D407,D408,D409,D410,D411,D412,D413,D414,D415,D416,D417 + [isort] ; This config mimics what reorder-python-imports does. force_single_line = 1