Skip to content

Commit e4cdf9a

Browse files
committed
Set upper limit for project Python version
The version of Python used by the project infrastructure is controlled via the pyproject.yaml metadata file. Previously the file specified that any version <=3.9.0 and <4.0.0 could be used, since it had been validated with 3.9 and theoretically no breaking changes should be introduced without a major version bump. However, there was a breaking change in Python version 3.12.0, which caused an incompatibility with the version of the project's pyyaml Python package dependency. This caused the `poetry install` command to fail when Python 3.12 or newer was used: ``` ChefBuildError Backend subprocess exited when trying to invoke get_requires_for_build_wheel running egg_info writing lib/PyYAML.egg-info/PKG-INFO writing dependency_links to lib/PyYAML.egg-info/dependency_links.txt writing top-level names to lib/PyYAML.egg-info/top_level.txt Traceback (most recent call last): File "/opt/pipx/venvs/poetry/lib/python3.12/site-packages/pyproject_hooks/_in_process/_in_process.py", line 389, in <module> main() File "/opt/pipx/venvs/poetry/lib/python3.12/site-packages/pyproject_hooks/_in_process/_in_process.py", line 373, in main json_out["return_val"] = hook(**hook_input["kwargs"]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/pipx/venvs/poetry/lib/python3.12/site-packages/pyproject_hooks/_in_process/_in_process.py", line 143, in get_requires_for_build_wheel return hook(config_settings) ^^^^^^^^^^^^^^^^^^^^^ File "/tmp/tmpigs9xbct/.venv/lib/python3.12/site-packages/setuptools/build_meta.py", line 334, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=[]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/tmpigs9xbct/.venv/lib/python3.12/site-packages/setuptools/build_meta.py", line 304, in _get_build_requires self.run_setup() File "/tmp/tmpigs9xbct/.venv/lib/python3.12/site-packages/setuptools/build_meta.py", line 320, in run_setup exec(code, locals()) File "<string>", line 288, in <module> File "/tmp/tmpigs9xbct/.venv/lib/python3.12/site-packages/setuptools/__init__.py", line 117, in setup return distutils.core.setup(**attrs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/tmpigs9xbct/.venv/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 183, in setup return run_commands(dist) ^^^^^^^^^^^^^^^^^^ File "/tmp/tmpigs9xbct/.venv/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 199, in run_commands dist.run_commands() File "/tmp/tmpigs9xbct/.venv/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 954, in run_commands self.run_command(cmd) File "/tmp/tmpigs9xbct/.venv/lib/python3.12/site-packages/setuptools/dist.py", line 995, in run_command super().run_command(command) File "/tmp/tmpigs9xbct/.venv/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 973, in run_command cmd_obj.run() File "/tmp/tmpigs9xbct/.venv/lib/python3.12/site-packages/setuptools/command/egg_info.py", line 313, in run self.find_sources() File "/tmp/tmpigs9xbct/.venv/lib/python3.12/site-packages/setuptools/command/egg_info.py", line 321, in find_sources mm.run() File "/tmp/tmpigs9xbct/.venv/lib/python3.12/site-packages/setuptools/command/egg_info.py", line 544, in run self.add_defaults() File "/tmp/tmpigs9xbct/.venv/lib/python3.12/site-packages/setuptools/command/egg_info.py", line 582, in add_defaults sdist.add_defaults(self) File "/tmp/tmpigs9xbct/.venv/lib/python3.12/site-packages/setuptools/command/sdist.py", line 109, in add_defaults super().add_defaults() File "/tmp/tmpigs9xbct/.venv/lib/python3.12/site-packages/setuptools/_distutils/command/sdist.py", line 238, in add_defaults self._add_defaults_ext() File "/tmp/tmpigs9xbct/.venv/lib/python3.12/site-packages/setuptools/_distutils/command/sdist.py", line 323, in _add_defaults_ext self.filelist.extend(build_ext.get_source_files()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<string>", line 204, in get_source_files File "/tmp/tmpigs9xbct/.venv/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 107, in __getattr__ raise AttributeError(attr) AttributeError: cython_sources at /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/installation/chef.py:164 in _prepare 160│ 161│ error = ChefBuildError("\n\n".join(message_parts)) 162│ 163│ if error is not None: → 164│ raise error from None 165│ 166│ return path 167│ 168│ def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path: Note: This error originates from the build backend, and is likely not a problem with poetry but with pyyaml (6.0) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "pyyaml (==6.0)"'. ``` Although the incompatibility has already been fixed in pyyaml, this is a transitive dependency and so it might be difficult to update the version used by the project. So the chosen solution is to adjust the Python version constraints to require a version less than 3.12.0 to be used. This will still allow a reasonable range of Python versions to make the infrastructure more friendly to local use by contributors, while ensuring that a compatible version is used.
1 parent 7ba30e9 commit e4cdf9a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

poetry.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description = ""
88
authors = ["Arduino <[email protected]>"]
99

1010
[tool.poetry.dependencies]
11-
python = "^3.9"
11+
python = ">=3.9.0, <3.12.0"
1212
requests = "^2.32.3"
1313

1414
[tool.poetry.group.dev.dependencies]

0 commit comments

Comments
 (0)