Skip to content

Fix release parsing in conf.py #2526

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import importlib.metadata

from packaging.specifiers import SpecifierSet
from packaging.version import Version

project = "VWS-Python-Mock"
author = "Adam Dangoor"
Expand Down Expand Up @@ -34,17 +35,16 @@
copybutton_exclude = ".linenos, .gp"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# |release|, also used in various other places throughout the
# built documents.
#
# Use ``importlib.metadata.version`` as per
# https://setuptools-scm.readthedocs.io/en/latest/usage/#usage-from-sphinx.
version = importlib.metadata.version(distribution_name=project)
# This method of getting the release from the version goes hand in hand with
# the ``post-release`` versioning scheme chosen in the ``setuptools-scm``
# configuration.
release = version.split(sep=".post")[0]

_version_string = importlib.metadata.version(distribution_name=project)
_version = Version(version=_version_string)
# GitHub release tags have the format YYYY.MM.DD, while Python requirement
# versions may have the format YYYY.M.D for single digit months and days.
release = ".".join(f"{part:02d}" for part in _version.release)

project_metadata = importlib.metadata.metadata(distribution_name=project)
requires_python = project_metadata["Requires-Python"]
Expand Down
Loading