Skip to content

Commit 91804f9

Browse files
committed
Fix release parsing in conf.py
1 parent 9aec597 commit 91804f9

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

docs/source/conf.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import importlib.metadata
77

88
from packaging.specifiers import SpecifierSet
9+
from packaging.version import Version
910

1011
project = "VWS-Python"
1112
author = "Adam Dangoor"
@@ -30,16 +31,16 @@
3031
copybutton_exclude = ".linenos, .gp"
3132

3233
# The version info for the project you're documenting, acts as replacement for
33-
# |version| and |release|, also used in various other places throughout the
34+
# |release|, also used in various other places throughout the
3435
# built documents.
3536
#
3637
# Use ``importlib.metadata.version`` as per
37-
# https://setuptools-scm.readthedocs.io/en/latest/usage/#usage-from-sphinx
38-
version = importlib.metadata.version(distribution_name=project)
39-
# This method of getting the release from the version goes hand in hand with
40-
# the ``post-release`` versioning scheme chosen in the ``setuptools-scm``
41-
# configuration.
42-
release = version.split(sep=".post")[0]
38+
# https://setuptools-scm.readthedocs.io/en/latest/usage/#usage-from-sphinx.
39+
_version_string = importlib.metadata.version(distribution_name=project)
40+
_version = Version(version=_version_string)
41+
# GitHub release tags have the format YYYY.MM.DD, while Python requirement
42+
# versions may have the format YYYY.M.D for single digit months and days.
43+
release = ".".join(f"{part:02d}" for part in _version.release)
4344

4445

4546
project_metadata = importlib.metadata.metadata(distribution_name=project)

0 commit comments

Comments
 (0)