Skip to content

Commit ec84969

Browse files
authored
Merge pull request #756 from kurtmckee/fix-docs
Match how Read the Docs builds the documentation
2 parents 7f272de + 391dc52 commit ec84969

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

docs/conf.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
import importlib.metadata
1+
import pathlib
2+
3+
4+
def get_version() -> str:
5+
path = pathlib.Path(__file__).parent.parent / "sqlalchemy_utils/__init__.py"
6+
content = path.read_text()
7+
for line in content.splitlines():
8+
if line.strip().startswith("__version__"):
9+
_, _, version_ = line.partition("=")
10+
return version_.strip("'\" ")
11+
212

313
# -- General configuration -----------------------------------------------------
414

@@ -24,7 +34,7 @@
2434
project = "SQLAlchemy-Utils"
2535
copyright = "2013-2022, Konsta Vesterinen"
2636

27-
version = importlib.metadata.version("sqlalchemy_utils")
37+
version = get_version()
2838
release = version
2939

3040
# List of patterns, relative to source directory, that match files and

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ commands = pre-commit run --hook-stage manual --all isort-check
4949
[testenv:docs]
5050
base_python = py3.12
5151
recreate = False
52+
skip_install = True
5253
deps = -r requirements/docs/requirements.txt
5354
commands = sphinx-build docs/ build/docs
5455

0 commit comments

Comments
 (0)