From 91804f94b814b8cdb14b840f1b7983a3f664091c Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Thu, 20 Feb 2025 19:09:23 +0000 Subject: [PATCH] Fix release parsing in conf.py --- docs/source/conf.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 3255877d..e7a796f4 100755 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -6,6 +6,7 @@ import importlib.metadata from packaging.specifiers import SpecifierSet +from packaging.version import Version project = "VWS-Python" author = "Adam Dangoor" @@ -30,16 +31,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] +# https://setuptools-scm.readthedocs.io/en/latest/usage/#usage-from-sphinx. +_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)