Skip to content

fix: use ast.Constant.value in docs conf parse_version - #439

Open
Sanjays2402 wants to merge 1 commit into
pyutils:mainfrom
Sanjays2402:fix/docs-conf-ast-constant-py314
Open

fix: use ast.Constant.value in docs conf parse_version#439
Sanjays2402 wants to merge 1 commit into
pyutils:mainfrom
Sanjays2402:fix/docs-conf-ast-constant-py314

Conversation

@Sanjays2402

Copy link
Copy Markdown

Closes #429

ast.Constant.s was removed in Python 3.14, so parse_version() in docs/source/conf.py raised AttributeError: 'Constant' object has no attribute 's' while statically reading __version__, and Sphinx aborted with a ConfigError. Reading node.value.value instead (the canonical field since Python 3.8) fixes the build.

Added tests/test_docs_conf.py, which extracts parse_version from conf.py without importing sphinx; it fails with the reported AttributeError before this change and passes after.

Sphinx docs failed to build on Python 3.14 with
"AttributeError: 'Constant' object has no attribute 's'".

The deprecated ast.Constant.s alias was removed in Python 3.14, so
parse_version() in docs/source/conf.py raised while statically reading
__version__ and Sphinx aborted with a ConfigError.

Read node.value.value instead, which has been the canonical field since
Python 3.8. Added tests/test_docs_conf.py, which extracts parse_version
from conf.py (without importing sphinx) and asserts it parses a version
string; it fails with the reported AttributeError before this change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs fail to build on Python 3.14 (ast.Constant.s no longer supported)

1 participant