Skip to content

Commit

Permalink
De-duplicate the version numbers in the project
Browse files Browse the repository at this point in the history
  • Loading branch information
kurtmckee committed Sep 19, 2023
1 parent 44a913d commit dcaa85c
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
import pathlib
import sys

basedir = pathlib.Path(__file__).parent.parent
src_directory = (pathlib.Path(__file__).parent.parent / "src").resolve()
sys.path.insert(0, str(src_directory))


# Extract the current version from the source.
def get_version():
"""Get the version and release from the source code."""

text = (src_directory / "cachetools/__init__.py").read_text()
for line in text.splitlines():
if not line.strip().startswith("__version__"):
continue
full_version = line.partition("=")[2].strip().strip("\"'")
partial_version = ".".join(full_version.split(".")[:2])
return full_version, partial_version

sys.path.insert(0, str((basedir / "src").resolve()))

project = "cachetools"
copyright = "2014-2023 Thomas Kemmer"
version = "5.3"
release = "5.3.1"
release, version = get_version()

extensions = [
"sphinx.ext.autodoc",
Expand Down

0 comments on commit dcaa85c

Please sign in to comment.