{{ message }}
setup.py: fix version parsing on Python 3.14 (ast.Str removed)#589
Open
sookach wants to merge 1 commit into
Open
setup.py: fix version parsing on Python 3.14 (ast.Str removed)#589sookach wants to merge 1 commit into
setup.py: fix version parsing on Python 3.14 (ast.Str removed)#589sookach wants to merge 1 commit into
Conversation
Python 3.14 removes the ast.Str node type. String literals now appear as ast.Constant(value=str). Update the AST check to accept both ast.Str (for older Pythons) and ast.Constant with a string value (for Python 3.8+), allowing html5lib to build successfully on Python 3.14 while remaining compatible with older version.
Author
|
Thanks! Updated the PR. |
13 tasks
freebsd-git
pushed a commit
to freebsd/freebsd-ports
that referenced
this pull request
Mar 18, 2026
Use an upstream pull request [0] to handle ast.Str deprecation/removal, as the existing patch fails:
Traceback (most recent call last):
File "/usr/local/lib/python3.13t/site-packages/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
main()
~~~~^^
File "/usr/local/lib/python3.13t/site-packages/pyproject_hooks/_in_process/_in_process.py", line 373, in main
json_out["return_val"] = hook(**hook_input["kwargs"])
~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13t/site-packages/pyproject_hooks/_in_process/_in_process.py", line 143, in get_requires_for_build_wheel
return hook(config_settings)
File "/usr/local/lib/python3.13t/site-packages/setuptools/build_meta.py", line 333, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[])
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13t/site-packages/setuptools/build_meta.py", line 301, in _get_build_requires
self.run_setup()
~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13t/site-packages/setuptools/build_meta.py", line 520, in run_setup
super().run_setup(setup_script=setup_script)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13t/site-packages/setuptools/build_meta.py", line 317, in run_setup
exec(code, locals())
~~~~^^^^^^^^^^^^^^^^
File "<string>", line 96, in <module>
File "/usr/local/lib/python3.13t/site-packages/setuptools/__init__.py", line 117, in setup
return distutils.core.setup(**attrs) # type: ignore[return-value]
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/usr/local/lib/python3.13t/site-packages/setuptools/_distutils/core.py", line 148, in setup
_setup_distribution = dist = klass(attrs)
~~~~~^^^^^^^
File "/usr/local/lib/python3.13t/site-packages/setuptools/dist.py", line 332, in __init__
self.metadata.version = self._normalize_version(self.metadata.version)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13t/site-packages/setuptools/dist.py", line 368, in _normalize_version
normalized = str(Version(version))
~~~~~~~^^^^^^^^^
File "/usr/local/lib/python3.13t/site-packages/packaging/version.py", line 359, in __init__
match = self._regex.fullmatch(version)
TypeError: expected string or bytes-like object, got 'Constant'
While here:
- remove all references to pkg_resources, removed in setuptools 82+
- switch to USE_PYTHON=pep517
[0] html5lib/html5lib-python#589
PR: 293763
Approved by: rm (maintainer)
BSDKaffee
pushed a commit
to freebsd/freebsd-ports-kde
that referenced
this pull request
Mar 22, 2026
Use an upstream pull request [0] to handle ast.Str deprecation/removal, as the existing patch fails:
Traceback (most recent call last):
File "/usr/local/lib/python3.13t/site-packages/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
main()
~~~~^^
File "/usr/local/lib/python3.13t/site-packages/pyproject_hooks/_in_process/_in_process.py", line 373, in main
json_out["return_val"] = hook(**hook_input["kwargs"])
~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13t/site-packages/pyproject_hooks/_in_process/_in_process.py", line 143, in get_requires_for_build_wheel
return hook(config_settings)
File "/usr/local/lib/python3.13t/site-packages/setuptools/build_meta.py", line 333, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[])
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13t/site-packages/setuptools/build_meta.py", line 301, in _get_build_requires
self.run_setup()
~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13t/site-packages/setuptools/build_meta.py", line 520, in run_setup
super().run_setup(setup_script=setup_script)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13t/site-packages/setuptools/build_meta.py", line 317, in run_setup
exec(code, locals())
~~~~^^^^^^^^^^^^^^^^
File "<string>", line 96, in <module>
File "/usr/local/lib/python3.13t/site-packages/setuptools/__init__.py", line 117, in setup
return distutils.core.setup(**attrs) # type: ignore[return-value]
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/usr/local/lib/python3.13t/site-packages/setuptools/_distutils/core.py", line 148, in setup
_setup_distribution = dist = klass(attrs)
~~~~~^^^^^^^
File "/usr/local/lib/python3.13t/site-packages/setuptools/dist.py", line 332, in __init__
self.metadata.version = self._normalize_version(self.metadata.version)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13t/site-packages/setuptools/dist.py", line 368, in _normalize_version
normalized = str(Version(version))
~~~~~~~^^^^^^^^^
File "/usr/local/lib/python3.13t/site-packages/packaging/version.py", line 359, in __init__
match = self._regex.fullmatch(version)
TypeError: expected string or bytes-like object, got 'Constant'
While here:
- remove all references to pkg_resources, removed in setuptools 82+
- switch to USE_PYTHON=pep517
[0] html5lib/html5lib-python#589
PR: 293763
Approved by: rm (maintainer)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Python 3.14 removes the ast.Str node type. String literals now appear as ast.Constant(value=str).
Update the AST check to accept both ast.Str (for older Pythons) and ast.Constant with a string value (for Python 3.8+), allowing html5lib to build successfully on Python 3.14 while remaining compatible with older version. Tested at desk with
pip install -e .Fixes: #588