From 8e7d14402ca34684cb7bf14985312f20331566c9 Mon Sep 17 00:00:00 2001 From: 0jc1 Date: Sun, 1 Mar 2026 07:18:27 -0500 Subject: [PATCH 01/11] feat: add get_version_from_toml() --- docs/conf.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 882b7bb..fbd4fee 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -42,6 +42,27 @@ ) sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) + +def get_version_from_toml(): + """ + Returns the version from the pyproject.toml file. + Supports PEP 621 formats. Works with Python 3.10+. + """ + path = os.path.join(os.path.dirname(__file__), '..', 'pyproject.toml') + version = "2.0.0" + try: + if sys.version_info >= (3, 11): + import tomllib + else: + import tomli as tomllib + + with open(path, "rb") as f: + data = tomllib.load(f) + return str(data.get("project", {}).get("version", version)) + except Exception as e: + pass + return version + # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. @@ -78,7 +99,7 @@ # The short X.Y version. version = '1.8' # The full version, including alpha/beta/rc tags. -release = '1.8.1' +release = get_version_from_toml() # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. From 788f45514c2d582cbfe74fde0c757ee28ef840cf Mon Sep 17 00:00:00 2001 From: 0jc1 <52017130+0jc1@users.noreply.github.com> Date: Thu, 13 Aug 2026 00:03:08 +0700 Subject: [PATCH 02/11] Update docs/conf.py Co-authored-by: Steve Piercy --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 85033d9..8795ffd 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -43,7 +43,7 @@ sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) -def get_version_from_toml(): +def get_version_from_toml() -> str: """ Returns the version from the pyproject.toml file. Supports PEP 621 formats. Works with Python 3.10+. From f66322cfc516136243f4eb874eee9aa580763d19 Mon Sep 17 00:00:00 2001 From: 0jc1 <52017130+0jc1@users.noreply.github.com> Date: Thu, 13 Aug 2026 00:03:31 +0700 Subject: [PATCH 03/11] Apply suggestion from @stevepiercy Co-authored-by: Steve Piercy --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 8795ffd..36f8006 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -45,7 +45,7 @@ def get_version_from_toml() -> str: """ - Returns the version from the pyproject.toml file. + Returns the version from the :file:`pyproject.toml` file. Supports PEP 621 formats. Works with Python 3.10+. """ path = os.path.join(os.path.dirname(__file__), '..', 'pyproject.toml') From f23c2e6d7f5b6f2f4d0a99d196caaa6620992115 Mon Sep 17 00:00:00 2001 From: 0jc1 <52017130+0jc1@users.noreply.github.com> Date: Thu, 13 Aug 2026 00:03:39 +0700 Subject: [PATCH 04/11] Apply suggestion from @stevepiercy Co-authored-by: Steve Piercy --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 36f8006..04507ef 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -46,7 +46,7 @@ def get_version_from_toml() -> str: """ Returns the version from the :file:`pyproject.toml` file. - Supports PEP 621 formats. Works with Python 3.10+. + Supports :pep:`621` formats. Works with Python 3.10+. """ path = os.path.join(os.path.dirname(__file__), '..', 'pyproject.toml') version = "2.0.0" From cb8fe1cbc0c74c00c491cc6ec1cda6d51143ec29 Mon Sep 17 00:00:00 2001 From: 0jc1 <52017130+0jc1@users.noreply.github.com> Date: Thu, 13 Aug 2026 00:05:35 +0700 Subject: [PATCH 05/11] Apply suggestion from @stevepiercy Co-authored-by: Steve Piercy --- docs/conf.py | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 04507ef..0a74ffb 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -48,20 +48,15 @@ def get_version_from_toml() -> str: Returns the version from the :file:`pyproject.toml` file. Supports :pep:`621` formats. Works with Python 3.10+. """ - path = os.path.join(os.path.dirname(__file__), '..', 'pyproject.toml') - version = "2.0.0" - try: - if sys.version_info >= (3, 11): - import tomllib - else: - import tomli as tomllib - - with open(path, "rb") as f: - data = tomllib.load(f) - return str(data.get("project", {}).get("version", version)) - except Exception as e: - pass - return version + path = os.path.join(os.path.dirname(__file__), "..", "pyproject.toml") + if sys.version_info >= (3, 11): + import tomllib + else: + import tomli as tomllib + + with open(path, "rb") as f: + data = tomllib.load(f) + return str(data.get("project", {}).get("version")) # -- General configuration ----------------------------------------------------- From 84d054116097235698f65c96a726a8737bbfb8ff Mon Sep 17 00:00:00 2001 From: 0jc1 <52017130+0jc1@users.noreply.github.com> Date: Thu, 13 Aug 2026 00:05:52 +0700 Subject: [PATCH 06/11] Apply suggestion from @stevepiercy Co-authored-by: Steve Piercy --- docs/conf.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 0a74ffb..3981653 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -91,8 +91,6 @@ def get_version_from_toml() -> str: # |version| and |release|, also used in various other places throughout the # built documents. # -# The short X.Y version. -version = '1.8' # The full version, including alpha/beta/rc tags. release = get_version_from_toml() From 08f79f6833793e5dac4cd90e5d500e5c44bf67a9 Mon Sep 17 00:00:00 2001 From: 0jc1 <52017130+0jc1@users.noreply.github.com> Date: Thu, 13 Aug 2026 00:06:06 +0700 Subject: [PATCH 07/11] Apply suggestion from @stevepiercy Co-authored-by: Steve Piercy --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 3981653..ab4fd1b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -92,7 +92,7 @@ def get_version_from_toml() -> str: # built documents. # # The full version, including alpha/beta/rc tags. -release = get_version_from_toml() +version = release = get_version_from_toml() # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. From 5db9649c711d76d7478d4e7b6be7e3fc3b3e46dd Mon Sep 17 00:00:00 2001 From: 0jc1 <52017130+0jc1@users.noreply.github.com> Date: Sat, 15 Aug 2026 18:25:12 +0700 Subject: [PATCH 08/11] Update pyproject.toml --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index a7ae0eb..782a46f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,6 +62,7 @@ dev = [ "flask>=3.1.2", "pytest>=9.0.2", "sphinx-autobuild>=2024.10.3", + "tomli>=2.0; python_version < '3.11'", "tornado>=6.5.4", ] From 217a9e92def165360a7b49e0106d4ee75022a1ad Mon Sep 17 00:00:00 2001 From: 0jc1 <52017130+0jc1@users.noreply.github.com> Date: Sat, 15 Aug 2026 18:46:36 +0700 Subject: [PATCH 09/11] Update CHANGELOG.rst --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e7de16c..e0aded9 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -16,6 +16,7 @@ Major changes Minor changes ............. +- Read version from pyproject.toml [:pull:`104` by @0jc1 and @stevepiercy] - Fix author email format. [:issue:`99` by @gboutry and @stevepiercy] - Drop deprecated license classifier. [:issue:`101` by @gboutry] - Use ``--allow-existing`` argument in the ``dev`` make target to avoid recreating a virtual environment with uv. [:pull:`123` by @stevepiercy] From ac866165ea9c192e119130314bb91d6da6d9da66 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Tue, 18 Aug 2026 02:52:21 -0700 Subject: [PATCH 10/11] Update CHANGELOG.rst --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e0aded9..560f4c6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -16,7 +16,7 @@ Major changes Minor changes ............. -- Read version from pyproject.toml [:pull:`104` by @0jc1 and @stevepiercy] +- Read version from :file:`pyproject.toml` for documentation. [:issue:`103` by @0jc1 and @stevepiercy] - Fix author email format. [:issue:`99` by @gboutry and @stevepiercy] - Drop deprecated license classifier. [:issue:`101` by @gboutry] - Use ``--allow-existing`` argument in the ``dev`` make target to avoid recreating a virtual environment with uv. [:pull:`123` by @stevepiercy] From a3b319e4061628ebafa249b2ed00307dd17d17b1 Mon Sep 17 00:00:00 2001 From: 0jc1 <52017130+0jc1@users.noreply.github.com> Date: Wed, 19 Aug 2026 10:19:38 +0700 Subject: [PATCH 11/11] update uv.lock --- uv.lock | 2 ++ 1 file changed, 2 insertions(+) diff --git a/uv.lock b/uv.lock index f26cfdf..cb172bc 100644 --- a/uv.lock +++ b/uv.lock @@ -629,6 +629,7 @@ dev = [ { name = "pytest" }, { name = "sphinx-autobuild", version = "2024.10.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, { name = "sphinx-autobuild", version = "2025.8.25", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, + { name = "tomli", marker = "python_full_version < '3.11'" }, { name = "tornado" }, ] @@ -641,6 +642,7 @@ dev = [ { name = "flask", specifier = ">=3.1.2" }, { name = "pytest", specifier = ">=9.0.2" }, { name = "sphinx-autobuild", specifier = ">=2024.10.3" }, + { name = "tomli", marker = "python_full_version < '3.11'", specifier = ">=2.0" }, { name = "tornado", specifier = ">=6.5.4" }, ]