From 391dc525329ab6080d57c93b9db542be31b5467e Mon Sep 17 00:00:00 2001 From: Kurt McKee Date: Fri, 6 Sep 2024 05:55:58 -0500 Subject: [PATCH] Match how Read the Docs builds the documentation --- docs/conf.py | 14 ++++++++++++-- tox.ini | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index ef559461..6555c713 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,4 +1,14 @@ -import importlib.metadata +import pathlib + + +def get_version() -> str: + path = pathlib.Path(__file__).parent.parent / "sqlalchemy_utils/__init__.py" + content = path.read_text() + for line in content.splitlines(): + if line.strip().startswith("__version__"): + _, _, version_ = line.partition("=") + return version_.strip("'\" ") + # -- General configuration ----------------------------------------------------- @@ -24,7 +34,7 @@ project = "SQLAlchemy-Utils" copyright = "2013-2022, Konsta Vesterinen" -version = importlib.metadata.version("sqlalchemy_utils") +version = get_version() release = version # List of patterns, relative to source directory, that match files and diff --git a/tox.ini b/tox.ini index c293cef0..7807d1c7 100644 --- a/tox.ini +++ b/tox.ini @@ -49,6 +49,7 @@ commands = pre-commit run --hook-stage manual --all isort-check [testenv:docs] base_python = py3.12 recreate = False +skip_install = True deps = -r requirements/docs/requirements.txt commands = sphinx-build docs/ build/docs