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
This commit is contained in:
Jeremy Stanley 2025-03-24 19:51:02 +00:00
parent 09f16f6071
commit 32c0590450
2 changed files with 9 additions and 2 deletions

View File

@ -11,12 +11,14 @@ nox.options.sessions = ["tests-3", "linters"]
# version using --force-python. # version using --force-python.
@nox.session(python="3") @nox.session(python="3")
def linters(session): def linters(session):
# TODO: switch to a dependency group after Python 3.8 support is dropped
session.install(".[test-linters]") session.install(".[test-linters]")
session.run("flake8") session.run("flake8")
@nox.session(python="3") @nox.session(python="3")
def docs(session): def docs(session):
# TODO: switch to a dependency group after Python 3.8 support is dropped
session.install(".[build-docs]") session.install(".[build-docs]")
session.run( session.run(
"sphinx-build", "-W", "sphinx-build", "-W",
@ -28,6 +30,7 @@ def docs(session):
@nox.session(python="3") @nox.session(python="3")
def venv(session): def venv(session):
# TODO: switch to a dependency group after Python 3.8 support is dropped
session.install("-e", ".[test-unit]") session.install("-e", ".[test-unit]")
session.run(*session.posargs) session.run(*session.posargs)
@ -35,6 +38,7 @@ def venv(session):
# This will attempt to run python3 tests by default. # This will attempt to run python3 tests by default.
@nox.session(python=["3"]) @nox.session(python=["3"])
def tests(session): def tests(session):
# TODO: switch to a dependency group after Python 3.8 support is dropped
session.install("-e", ".[test-unit]") session.install("-e", ".[test-unit]")
session.run("stestr", "run", *session.posargs) session.run("stestr", "run", *session.posargs)
session.run("stestr", "slowest") session.run("stestr", "slowest")
@ -42,6 +46,7 @@ def tests(session):
@nox.session(python="3") @nox.session(python="3")
def cover(session): def cover(session):
# TODO: switch to a dependency group after Python 3.8 support is dropped
session.install("-e", ".[test-cover]") session.install("-e", ".[test-cover]")
session.env["PYTHON"] = "coverage run --source bindep --parallel-mode" session.env["PYTHON"] = "coverage run --source bindep --parallel-mode"
session.run("stestr", "run", *session.posargs) session.run("stestr", "run", *session.posargs)

View File

@ -45,8 +45,8 @@ keywords = [
"distro", "distro",
"package", "package",
] ]
# TODO: Add 'license-expression = "Apache-2.0"' here and drop the License # TODO: Add 'license = "Apache-2.0"' here and drop the License classifier above
# classifier once https://github.com/pypa/setuptools/issues/4629 is resolved. # once support for Python 3.8 is dropped (requires SetupTools>=77).
maintainers = [ maintainers = [
{email = "service-discuss@lists.opendev.org"}, {email = "service-discuss@lists.opendev.org"},
{name = "OpenDev Contributors"}, {name = "OpenDev Contributors"},
@ -55,6 +55,8 @@ name = "bindep"
readme = {charset = "UTF-8", content-type = "text/x-rst", file = "README.rst"} readme = {charset = "UTF-8", content-type = "text/x-rst", file = "README.rst"}
requires-python = ">=3.7" 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] [project.optional-dependencies]
build-docs = [ build-docs = [
# needed because we use autodoc to document our tests in the dev docs # needed because we use autodoc to document our tests in the dev docs