Skip to content

Move [doc] extra to a PEP 735 dependency group; add uv-sync CI check - #2243

Merged
Byron merged 2 commits into
gitpython-developers:mainfrom
mwtoews:uv-sync
Sep 17, 2026
Merged

Byron merged 2 commits into
gitpython-developers:mainfrom
mwtoews:uv-sync

Conversation

@mwtoews

@mwtoews mwtoews commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

This PR has two related changes. The first is to move the [doc] optional dependency to a dependency group (PEP 735). This requires pip v25.1 available for Python 3.9 or later to work; older Python versions will ignore this data. The contents of doc/requirements.txt is moved to pyproject.toml, and .readthedocs.yaml is adjusted to use the dependency group.

The second change is to resolve an incompatibility with the project dependencies identified with uv sync:

$ uv sync --all-extras --all-groups --dry-run
Using CPython 3.14.2
Would create project environment at: .venv
  × No solution found when resolving dependencies for split (markers: python_full_version == '3.8.*'):
  ╰─▶ Because the requested Python version (>=3.7) does not satisfy Python>=3.9 and sphinx==7.4.7 depends on Python>=3.9, we can conclude that sphinx==7.4.7 cannot be used.
      And because only the following versions of sphinx are available:
          sphinx<=7.4.7
          sphinx>=8
      we can conclude that sphinx>=7.4.7,<8 cannot be used.
      And because gitpython[doc] depends on sphinx>=7.4.7,<8 and your project requires gitpython[doc], we can conclude that your project's requirements are unsatisfiable.

hint: While the active Python version is 3.14, the resolution failed for other Python versions supported by your project. Consider limiting your project's supported Python versions using `requires-python`.
hint: The `requires-python` value (>=3.7) includes Python versions that are not supported by your dependencies (e.g., sphinx==7.4.7 only supports >=3.9). Consider using a more restrictive `requires-python` value (like >=3.9).

The fix is to simply to limit the version via sphinx >=7.4.7,<8 ; python_version >= "3.9"'. This change should be fine, since versions before Python 3.9 can't install the dependency group and are not tested to build the documentation in the CI.

A CI check is added to see if the dependencies can be resolved for all extras and all groups for all supported versions of Python.

- prescribe proper commit messages
@Byron

Byron commented Sep 17, 2026

Copy link
Copy Markdown
Member

Thanks.

@Byron
Byron merged commit cf43820 into gitpython-developers:main Sep 17, 2026
51 checks passed
@mwtoews
mwtoews deleted the uv-sync branch September 17, 2026 06:40
@EliahKagan EliahKagan mentioned this pull request Sep 20, 2026
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull request Oct 25, 2026
The documentation build dependencies (Sphinx and its extensions) used
to be the `doc` extra. 9e54de4 (gitpython-developers#2243) moved them to a PEP 735 `doc`
dependency group in `pyproject.toml`, and CI now installs them with
`pip install --group doc`, but the tox `html` environment still asked
for the `doc` extra. GitPython no longer has that extra, so
`tox -e html` failed before building anything:

    html: failed with extras not found for package GitPython: doc
    (available: gix, test)

Install the `doc` dependency group with `dependency_groups = doc`
instead. `extras =` is set to empty, so the environment still installs
only GitPython and the documentation dependencies, as it did with
`extras = doc`, rather than inheriting `extras = test` from
`[testenv]`.

`dependency_groups` was added in tox 4.22, so raise the `requires`
floor from `tox>=4` to `tox>=4.22`. With an older tox installed, tox
then provisions a new enough one rather than ignoring the setting.

Run locally with tox 4.67.1, `tox -e html` now installs the group and
builds the HTML documentation successfully. Sphinx reports one
warning, about the docstring of
`git.objects.submodule.util.is_relative_url`. CI's documentation build
reports the same single warning.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull request Oct 25, 2026
The documentation build dependencies (Sphinx and its extensions) used
to be the `doc` extra. 9e54de4 (gitpython-developers#2243) moved them to a PEP 735 `doc`
dependency group in `pyproject.toml`, and CI now installs them with
`pip install --group doc`, but the tox `html` environment still asked
for the `doc` extra. GitPython no longer has that extra, so
`tox -e html` failed before building anything:

    html: failed with extras not found for package GitPython: doc
    (available: gix, test)

Install the `doc` dependency group with `dependency_groups = doc`
instead. `extras =` is set to empty, so the environment still installs
only GitPython and the documentation dependencies, as it did with
`extras = doc`, rather than inheriting `extras = test` from
`[testenv]`.

`dependency_groups` was added in tox 4.22, so raise the `requires`
floor from `tox>=4` to `tox>=4.22`. With an older tox installed, tox
then provisions a new enough one rather than ignoring the setting.

Run locally with tox 4.67.1, `tox -e html` now installs the group and
builds the HTML documentation successfully. Sphinx reports one
warning, about the docstring of
`git.objects.submodule.util.is_relative_url`. CI's documentation build
on Python 3.13 reports the same single warning.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull request Oct 25, 2026
The main CI does not use tox, so the tox configuration can break
without anyone noticing. It has: `tox -e html` stopped working when
9e54de4 (gitpython-developers#2243) removed the `doc` extra, `tox -e misc` has run
`ruff check` again since b7ce712 (gitpython-developers#2031) changed that hook's id, and
the `base_python` fallbacks have not meant what they said since
62c024e (gitpython-developers#1693). New releases of tox and virtualenv can also change
how the configuration behaves, as when tox 4.56.0 made missing
interpreters fail. But running every tox environment is too slow for
every push and pull request.

Add a `tox` workflow that runs on a weekly schedule and through
`workflow_dispatch`. Each job runs the tox environments for one Python
version, from 3.8 to 3.15, on Ubuntu. 3.8 and 3.9 run on
`ubuntu-24.04`, since `setup-python` has no builds of them for Ubuntu
26.04. The 3.12 job also runs `gix`, and the 3.13 job also runs
`ruff`, `format`, `mypy`, `html`, and `misc`. The steps that prepare
for the tests (Rust for GixPython source builds, current Git from the
git-core PPA, `init-tests-after-clone.sh`, and the test Git identity
and aliases) are the same as in `pythonpackage.yml`.

tox and the plugin used below both need Python 3.11 or later, so
`setup-python` also installs Python 3.13, and tox runs on that. tox is
installed unpinned, so that the workflow tests the configuration with
the tox and virtualenv that a contributor would get. The job has only
`contents: read` and uses no secrets.

For running tox on GitHub Actions, there are two tox plugins and one
action:

- `tox-gh`, from the `tox-dev` organization that maintains tox, selects
  the environments for the job's Python version from a mapping in the
  tox configuration, puts each environment's output in its own log
  group, and summarizes the results.
- `tox-gh-actions`, an older plugin maintained outside `tox-dev`, does
  the same with more ways to select environments, and also supports
  tox 3. This project needs only selection by Python version.
- `fedora-python/tox-github-action` runs tox in a Fedora container
  that has most Python versions, but no longer 3.8. It also pulls its
  image by a mutable tag, its repository has no license, and it runs
  tox as root in the container, which would change what GitPython's
  tests see about file ownership and `safe.directory`.

Use `tox-gh`. Selecting environments by version is simple here, but
the log groups make long weekly logs easier to read, and it adds
little risk, since it comes from the `tox-dev` organization, like tox
itself. Its
mapping goes in `[tool.tox.gh.python]` in `pyproject.toml`. tox-gh
does nothing outside GitHub Actions, and without it, `tox config`
only adds a note that `gh` is unused. The job sets
`TOX_GH_MAJOR_MINOR` to the matrix version, as tox-gh documents for
when tox runs on a different Python.

`actionlint`, `zizmor` 1.31.1 (pedantic, with online audits), and
`pinact run --check --verify-comment` report nothing for the new
workflow, and all pre-commit hooks pass. With `GITHUB_ACTIONS=true`
set locally, tox with tox-gh ran only `py38` for
`TOX_GH_MAJOR_MINOR=3.8`, in its own log group, and set up `py313`,
`ruff`, `format`, `mypy`, `html`, and `misc` for 3.13. The workflow
itself has not run on GitHub yet, because `workflow_dispatch` and
`schedule` only work once it is on the default branch.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull request Oct 25, 2026
The documentation build dependencies (Sphinx and its extensions) used
to be the `doc` extra. 9e54de4 (gitpython-developers#2243) moved them to a PEP 735 `doc`
dependency group in `pyproject.toml`, and CI now installs them with
`pip install --group doc`, but the tox `html` environment still asked
for the `doc` extra. GitPython no longer has that extra, so
`tox -e html` failed before building anything:

    html: failed with extras not found for package GitPython: doc
    (available: gix, test)

Install the `doc` dependency group with `dependency_groups = doc`
instead. `extras =` is set to empty, so the environment still installs
only GitPython and the documentation dependencies, as it did with
`extras = doc`, rather than inheriting `extras = test` from
`[testenv]`.

`dependency_groups` was added in tox 4.22, so raise the `requires`
floor from `tox>=4` to `tox>=4.22`. With an older tox installed, tox
then provisions a new enough one rather than ignoring the setting.

Run locally with tox 4.67.1, `tox -e html` now installs the group and
builds the HTML documentation successfully, with no Sphinx warnings,
as in CI's documentation build on Python 3.13.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull request Oct 25, 2026
The main CI does not use tox, so the tox configuration can break
without anyone noticing. It has: `tox -e html` stopped working when
9e54de4 (gitpython-developers#2243) removed the `doc` extra, `tox -e misc` has run
`ruff check` again since b7ce712 (gitpython-developers#2031) changed that hook's id, and
the `base_python` fallbacks have not meant what they said since
62c024e (gitpython-developers#1693). New releases of tox and virtualenv can also change
how the configuration behaves, as when tox 4.56.0 made missing
interpreters fail. But running every tox environment is too slow for
every push and pull request.

Add a `tox` workflow that runs on a weekly schedule and through
`workflow_dispatch`. Each job runs the tox environments for one Python
version, from 3.8 to 3.15, on Ubuntu. 3.8 and 3.9 run on
`ubuntu-24.04`, since `setup-python` has no builds of them for Ubuntu
26.04. The 3.12 job also runs `gix`, and the 3.13 job also runs
`ruff`, `format`, `mypy`, `html`, and `misc`. The steps that prepare
for the tests (Rust for GixPython source builds, current Git from the
git-core PPA, `init-tests-after-clone.sh`, and the test Git identity
and aliases) are the same as in `pythonpackage.yml`.

tox and the plugin used below both need Python 3.11 or later, so
`setup-python` also installs Python 3.13, and tox runs on that. tox is
installed unpinned, so that the workflow tests the configuration with
the tox and virtualenv that a contributor would get. The job has only
`contents: read` and uses no secrets.

For running tox on GitHub Actions, there are two tox plugins and one
action:

- `tox-gh`, from the `tox-dev` organization that maintains tox, selects
  the environments for the job's Python version from a mapping in the
  tox configuration, puts each environment's output in its own log
  group, and summarizes the results.
- `tox-gh-actions`, an older plugin maintained outside `tox-dev`, does
  the same with more ways to select environments, and also supports
  tox 3. This project needs only selection by Python version.
- `fedora-python/tox-github-action` runs tox in a Fedora container
  that has most Python versions, but no longer 3.8. It also pulls its
  image by a mutable tag, its repository has no license, and it runs
  tox as root in the container, which would change what GitPython's
  tests see about file ownership and `safe.directory`.

Use `tox-gh`. Selecting environments by version is simple here, but
the log groups make long weekly logs easier to read, and it adds
little risk, since it comes from the `tox-dev` organization, like tox
itself. Its
mapping goes in `[tool.tox.gh.python]` in `pyproject.toml`. tox-gh
does nothing outside GitHub Actions, and without it, `tox config`
only adds a note that `gh` is unused. The job sets
`TOX_GH_MAJOR_MINOR` to the matrix version, as tox-gh documents for
when tox runs on a different Python.

`actionlint`, `zizmor` 1.31.1 (pedantic, with online audits), and
`pinact run --check --verify-comment` report nothing for the new
workflow, and all pre-commit hooks pass. With `GITHUB_ACTIONS=true`
set locally, tox with tox-gh ran only `py38` for
`TOX_GH_MAJOR_MINOR=3.8`, in its own log group, and set up `py313`,
`ruff`, `format`, `mypy`, `html`, and `misc` for 3.13. The workflow
itself has not run on GitHub yet, because `workflow_dispatch` and
`schedule` only work once it is on the default branch.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants