Bug 2342318 - python-sphinx-theme-builder doesn't work with Python 3.14: AttributeError: module 'ast' has no attribute 'Str'
Summary: python-sphinx-theme-builder doesn't work with Python 3.14: AttributeError: mo...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-sphinx-theme-builder
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jerry James
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.14
TreeView+ depends on / blocked
 
Reported: 2025-01-27 18:21 UTC by Karolina Surma
Modified: 2025-01-28 00:23 UTC (History)
3 users (show)

Fixed In Version: python-sphinx-theme-builder-0.2.0-0.18.b2.fc42
Clone Of:
Environment:
Last Closed: 2025-01-28 00:23:21 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Karolina Surma 2025-01-27 18:21:33 UTC
python-sphinx-theme-builder doesn't work with Python 3.14.

Requirement satisfied: sphinx-theme-builder >= 0.2.0a10
   (installed: sphinx-theme-builder 0.2.0b2)
Traceback (most recent call last):
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 720, in main
    generate_requires(
    ~~~~~~~~~~~~~~~~~^
        include_runtime=args.runtime,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<11 lines>...
        config_settings=parse_config_settings_args(args.config_settings),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 610, in generate_requires
    generate_run_requirements(backend, requirements, build_wheel=build_wheel,
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        read_pyproject_dependencies=read_pyproject_dependencies, wheeldir=wheeldir)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 414, in generate_run_requirements
    generate_run_requirements_hook(backend, requirements)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 328, in generate_run_requirements_hook
    dir_basename = prepare_metadata('.', config_settings=requirements.config_settings)
  File "/usr/lib/python3.14/site-packages/sphinx_theme_builder/__init__.py", line 79, in prepare_metadata_for_build_wheel
    project = Project.from_cwd()
  File "/usr/lib/python3.14/site-packages/sphinx_theme_builder/_internal/project.py", line 233, in from_cwd
    retval = cls.from_path(Path.cwd())
  File "/usr/lib/python3.14/site-packages/sphinx_theme_builder/_internal/project.py", line 247, in from_path
    version_s, version_comes_from = _determine_version(
                                    ~~~~~~~~~~~~~~~~~~^
        package_path, kebab_name, pyproject_data
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.14/site-packages/sphinx_theme_builder/_internal/project.py", line 149, in _determine_version
    declared_in_python = get_version_using_ast(package_init_file.read_bytes())
  File "/usr/lib/python3.14/site-packages/sphinx_theme_builder/_internal/project.py", line 43, in get_version_using_ast
    and isinstance(child.value, ast.Str)
                                ^^^^^^^
AttributeError: module 'ast' has no attribute 'Str'


According to: https://docs.python.org/dev/whatsnew/3.14.html#id2

Remove the following classes. They were all deprecated since Python 3.8, and have emitted deprecation warnings since Python 3.12:
ast.Bytes
ast.Ellipsis
ast.NameConstant
ast.Num
ast.Str

Use ast.Constant instead. As a consequence of these removals, user-defined visit_Num, visit_Str, visit_Bytes, visit_NameConstant and visit_Ellipsis methods on custom ast.NodeVisitor subclasses will no longer be called when the NodeVisitor subclass is visiting an AST. Define a visit_Constant method instead.

Also, remove the following deprecated properties on ast.Constant, which were present for compatibility with the now-removed AST classes:
ast.Constant.n
ast.Constant.s

Use ast.Constant.value instead.
(Contributed by Alex Waygood in gh-119562.)


For all our attempts to build python-furo with Python 3.14, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/package/python-sphinx-theme-builder/

Testing and mass rebuild of packages is happening in copr.
You can follow these instructions to test locally in mock if your package builds with Python 3.14:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/

Let us know here if you have any questions.

Python 3.14 is planned to be included in Fedora 43.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.14.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires),
so if this package is required a lot, it's important for us to get it fixed soon.

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 2 Jerry James 2025-01-27 22:46:46 UTC
How are y'all doing the builds to hit this error?  I created a candidate patch, which I will be happy to send upstream if it works, then followed the linked instructions to create a file in ~/.config/mock.  When I run the mock build, however, this is what I get:

$ mock -r fedora-rawhide-python314 --enablerepo=local --no-bootstrap-chroot --rebuild python-sphinx-theme-builder-0.2.0-0.18.b2.fc42.src.rpm
[snip lots of lines]
Failed to resolve the transaction:
Package "help2man-1.49.3-7.fc42.noarch" is already installed.
Package "pyproject-rpm-macros-1.16.4-2.fc42.noarch" is already installed.
Package "python3-devel-3.14.0~a4-2.fc42.x86_64" is already installed.
Package "python3-packaging-24.2-2.fc42.noarch" is already installed.
Package "python3-pip-24.3.1-2.fc42.noarch" is already installed.
Package "python3-pytest-8.3.4-3.fc42.noarch" is already installed.
Package "python3-pytest-cov-5.0.0-1.fc42.noarch" is already installed.
Package "python3-setuptools-74.1.3-5.fc42.noarch" is already installed.
Problem: package python3-sphinx-autobuild-2024.10.03-2.fc42.noarch from fedora requires python(abi) = 3.13, but none of the providers can be installed
  - installed package python3-devel-3.14.0~a4-2.fc42.x86_64 conflicts with python3 < 3.14.0~a4-2.fc42 provided by python3-3.13.1-3.fc42.i686 from fedora
  - installed package python3-devel-3.14.0~a4-2.fc42.x86_64 conflicts with python3 < 3.14.0~a4-2.fc42 provided by python3-3.13.1-3.fc42.x86_64 from fedora
  - installed package python3-devel-3.14.0~a4-2.fc42.x86_64 conflicts with python3 < 3.14.0~a4-2.fc42 provided by python3-3.13.1-3.fc42.x86_64 from local
  - cannot install the best candidate for the job
You can try to add to command line:
  --no-best to not limit the transaction to the best candidates

So python-sphinx-autobuild hasn't been built yet?  Then how did you do a build that generated this error?

Comment 4 Jerry James 2025-01-28 00:10:08 UTC
[Jerry smacks himself in the forehead.] Sorry, I'm trying to do about 5 things simultaneously here...

Upstream pull request: https://github.com/pradyunsg/sphinx-theme-builder/pull/51.  I have verified that python-furo builds with that patch applied.  I will push the patch to Rawhide shortly.

Comment 5 Fedora Update System 2025-01-28 00:18:38 UTC
FEDORA-2025-e8d09f558c (python-sphinx-theme-builder-0.2.0-0.18.b2.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-e8d09f558c

Comment 6 Fedora Update System 2025-01-28 00:23:21 UTC
FEDORA-2025-e8d09f558c (python-sphinx-theme-builder-0.2.0-0.18.b2.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.