From 7256ed33089c72878dcf94ed7022618d57ebb025 Mon Sep 17 00:00:00 2001 From: Will Barnes Date: Thu, 12 Sep 2024 14:02:05 -0400 Subject: [PATCH] better version parsing in docs (#313) --- docs/conf.py | 10 ++++++++-- docs/index.rst | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 6e0a1735..1968a82a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -5,6 +5,7 @@ import datetime import os +from packaging.version import Version from sphinx_gallery.sorting import ExplicitOrder # This file does only contain a selection of the most common options. For a @@ -19,8 +20,13 @@ from fiasco import __version__ -version = release = __version__ -is_development = '.dev' in __version__ +_version_ = Version(__version__) +# NOTE: Avoid "post" appearing in version string in rendered docs +if _version_.is_postrelease: + version = release = f'{_version_.major}.{_version_.minor}.{_version_.micro}' +else: + version = release = str(_version_) +is_development = _version_.is_devrelease # -- General configuration --------------------------------------------------- extensions = [ diff --git a/docs/index.rst b/docs/index.rst index 2d7412c6..f1ac3843 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,7 +1,7 @@ fiasco Documentation ==================== -Welcome to the documentation for fiasco **version |release|** +Welcome to the documentation for fiasco version |release|. fiasco provides a Python interface to the `CHIANTI atomic database`_. In addition to several high-level abstractions of the atomic data, fiasco also provides many common atomic physics calculations.