From 32c0590450877e73847f5ace78e6639c8807b2e0 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Mon, 24 Mar 2025 19:51:02 +0000 Subject: [PATCH] Comment reminding to replace extras with depgroups Our use of project.optional-dependencies for nox test environment package lists is effectively an abuse of that feature, which is intended to be more user-facing. There is finally a solution agreed upon in PEP 735 and supported in unreleased pip under development, slated for inclusion in pip 25.1 (which will require Python 3.9): https://github.com/pypa/pip/commit/e930fee Until we can rely on that, add code comments to pyproject.toml and noxfile.py as a reminder. While we're here, also correct a TODO comment about license expressions, the fix for which will also require a minimum of Python 3.9 to work. Change-Id: I6f38e9a48b06fcea9ad6adca195bb4204cd42a64 --- noxfile.py | 5 +++++ pyproject.toml | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/noxfile.py b/noxfile.py index d954795..4ad5ed1 100644 --- a/noxfile.py +++ b/noxfile.py @@ -11,12 +11,14 @@ nox.options.sessions = ["tests-3", "linters"] # version using --force-python. @nox.session(python="3") def linters(session): + # TODO: switch to a dependency group after Python 3.8 support is dropped session.install(".[test-linters]") session.run("flake8") @nox.session(python="3") def docs(session): + # TODO: switch to a dependency group after Python 3.8 support is dropped session.install(".[build-docs]") session.run( "sphinx-build", "-W", @@ -28,6 +30,7 @@ def docs(session): @nox.session(python="3") def venv(session): + # TODO: switch to a dependency group after Python 3.8 support is dropped session.install("-e", ".[test-unit]") session.run(*session.posargs) @@ -35,6 +38,7 @@ def venv(session): # This will attempt to run python3 tests by default. @nox.session(python=["3"]) def tests(session): + # TODO: switch to a dependency group after Python 3.8 support is dropped session.install("-e", ".[test-unit]") session.run("stestr", "run", *session.posargs) session.run("stestr", "slowest") @@ -42,6 +46,7 @@ def tests(session): @nox.session(python="3") def cover(session): + # TODO: switch to a dependency group after Python 3.8 support is dropped session.install("-e", ".[test-cover]") session.env["PYTHON"] = "coverage run --source bindep --parallel-mode" session.run("stestr", "run", *session.posargs) diff --git a/pyproject.toml b/pyproject.toml index 4d241dd..d1d5ed5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,8 +45,8 @@ keywords = [ "distro", "package", ] -# TODO: Add 'license-expression = "Apache-2.0"' here and drop the License -# classifier once https://github.com/pypa/setuptools/issues/4629 is resolved. +# TODO: Add 'license = "Apache-2.0"' here and drop the License classifier above +# once support for Python 3.8 is dropped (requires SetupTools>=77). maintainers = [ {email = "service-discuss@lists.opendev.org"}, {name = "OpenDev Contributors"}, @@ -55,6 +55,8 @@ name = "bindep" readme = {charset = "UTF-8", content-type = "text/x-rst", file = "README.rst"} requires-python = ">=3.7" +# TODO: replace these with PEP 735 compliant dependency groups once support for +# Python 3.8 is dropped (requires pip>=25.1). [project.optional-dependencies] build-docs = [ # needed because we use autodoc to document our tests in the dev docs