From 15f93b332c1c3ec9c200c0ad3d55af5a2158e0db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=87=BA=F0=9F=87=A6=20Sviatoslav=20Sydorenko=20=28?= =?UTF-8?q?=D0=A1=D0=B2=D1=8F=D1=82=D0=BE=D1=81=D0=BB=D0=B0=D0=B2=20=D0=A1?= =?UTF-8?q?=D0=B8=D0=B4=D0=BE=D1=80=D0=B5=D0=BD=D0=BA=D0=BE=29?= Date: Tue, 11 Nov 2025 20:28:42 +0100 Subject: [PATCH] Merge pull request #13933 from webknjaz/maintenance/tox-pep517-env-setuptools-scm-pretend-env-var MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 📦 Pass desired release to PEP 517 tox env (cherry picked from commit ce8b8a7b4b360ac5f3953b8c3b8b59e6bb420f37) --- changelog/13933.contrib.rst | 4 ++++ changelog/13933.packaging.rst | 1 + tox.ini | 23 ++++++++++++++++++++--- 3 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 changelog/13933.contrib.rst create mode 120000 changelog/13933.packaging.rst diff --git a/changelog/13933.contrib.rst b/changelog/13933.contrib.rst new file mode 100644 index 00000000000..feab3e0dc03 --- /dev/null +++ b/changelog/13933.contrib.rst @@ -0,0 +1,4 @@ +The tox configuration has been adjusted to make sure the desired +version string can be passed into its :ref:`package_env` through +the ``SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST`` environment +variable as a part of the release process -- by :user:`webknjaz`. diff --git a/changelog/13933.packaging.rst b/changelog/13933.packaging.rst new file mode 120000 index 00000000000..79139f98eed --- /dev/null +++ b/changelog/13933.packaging.rst @@ -0,0 +1 @@ +13933.contrib.rst \ No newline at end of file diff --git a/tox.ini b/tox.ini index 5c2106ee5b4..2e91ddcb2d6 100644 --- a/tox.ini +++ b/tox.ini @@ -23,6 +23,26 @@ envlist = +[pkgenv] +# NOTE: This section tweaks how Tox manages the PEP 517 build +# NOTE: environment where it assembles wheels (editable and regular) +# NOTE: for further installing them into regular testenvs. +# +# NOTE: `[testenv:.pkg]` does not work due to a regression in tox v4.14.1 +# NOTE: so `[pkgenv]` is being used in place of it. +# Refs: +# * https://github.com/tox-dev/tox/pull/3237 +# * https://github.com/tox-dev/tox/issues/3238 +# * https://github.com/tox-dev/tox/issues/3292 +# * https://hynek.me/articles/turbo-charge-tox/ +# +# NOTE: The `SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST` environment +# NOTE: variable allows enforcing a pre-determined version for use in +# NOTE: the wheel being installed into usual testenvs. +pass_env = + SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST + + [testenv] description = run the tests @@ -49,7 +69,6 @@ passenv = COVERAGE_* PYTEST_ADDOPTS TERM - SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST CI setenv = _PYTEST_TOX_DEFAULT_POSARGS={env:_PYTEST_TOX_POSARGS_DOCTESTING:} {env:_PYTEST_TOX_POSARGS_LSOF:} {env:_PYTEST_TOX_POSARGS_XDIST:} {env:_PYTEST_FILES:} @@ -141,8 +160,6 @@ setenv = description = regenerate documentation examples under `{basepython}` changedir = doc/en -passenv = - SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST deps = PyYAML regendoc>=0.8.1