Skip to content

Commit 4255cfd

Browse files
committed
Update conf.py
1 parent 6922092 commit 4255cfd

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

docs/conf.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,25 @@
66
# -- Project information -----------------------------------------------------
77
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
88

9+
from pathlib import Path
10+
11+
try: # Python 3.11+
12+
import tomllib
13+
except ModuleNotFoundError: # pragma: no cover - fallback for older runtimes
14+
import tomli as tomllib # type: ignore
15+
916
import plot3d
1017
project = 'Plot3D'
1118
copyright = '2025, Paht Juangphanich'
1219
author = 'Paht Juangphanich <paht.juangphanich@nasa.gov>'
13-
release = '1.6.8'
20+
_pyproject_path = Path(__file__).resolve().parents[1] / 'python' / 'pyproject.toml'
21+
try:
22+
_pyproject = tomllib.loads(_pyproject_path.read_text(encoding='utf-8'))
23+
release = _pyproject['tool']['poetry']['version']
24+
except Exception: # pragma: no cover - fallback if file missing/unreadable
25+
release = getattr(plot3d, '__version__', 'dev')
26+
27+
version = release
1428

1529
rst_context = {'plot3d': plot3d}
1630

0 commit comments

Comments
 (0)