Skip to content

[BUG] requires-python invalid value - pyproject.toml #21335

Closed
@srydz-aiclearing

Description

@srydz-aiclearing
Description

This commit breaks our pipelines where we are using openapitools/openapi-generator-cli:latest image to generate some artifacts and later build package (Sorry for watered-down issue details, I don't have time)

openapi-generator version

docker image latest

Error we get:
configuration error: `project.requires-python` must be pep508-versionspec
DESCRIPTION:
    `The Python version requirements of the project
    <https://packaging.python.org/specifications/core-metadata/#requires-
    python>`_.
GIVEN VALUE:
    "^3.9"
OFFENDING RULE: 'format'
DEFINITION:
    {
        "type": "string",
        "format": "pep508-versionspec"
    }
For more details about `format` see
https://validate-pyproject.readthedocs.io/en/latest/api/validate_pyproject.formats.html
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
    main()
  File "/usr/local/lib/python3.11/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.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 317, in get_requires_for_build_sdist
    return hook(config_settings)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/build-env-2ecltzhr/lib/python3.11/site-packages/setuptools/build_meta.py", line 334, in get_requires_for_build_sdist
    return self._get_build_requires(config_settings, requirements=[])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/build-env-2ecltzhr/lib/python3.11/site-packages/setuptools/build_meta.py", line 301, in _get_build_requires
    self.run_setup()
  File "/tmp/build-env-2ecltzhr/lib/python3.11/site-packages/setuptools/build_meta.py", line 317, in run_setup
    exec(code, locals())
  File "<string>", line 35, in <module>
  File "/tmp/build-env-2ecltzhr/lib/python3.11/site-packages/setuptools/__init__.py", line 115, in setup
    return distutils.core.setup(**attrs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/build-env-2ecltzhr/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 160, in setup
    dist.parse_config_files()
  File "/tmp/build-env-2ecltzhr/lib/python3.11/site-packages/setuptools/dist.py", line 756, in parse_config_files
    pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
  File "/tmp/build-env-2ecltzhr/lib/python3.11/site-packages/setuptools/config/pyprojecttoml.py", line 72, in apply_configuration
    config = read_configuration(filepath, True, ignore_option_errors, dist)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/build-env-2ecltzhr/lib/python3.11/site-packages/setuptools/config/pyprojecttoml.py", line 140, in read_configuration
    validate(subset, filepath)
  File "/tmp/build-env-2ecltzhr/lib/python3.11/site-packages/setuptools/config/pyprojecttoml.py", line 61, in validate
    raise ValueError(f"{error}\n{summary}") from None
ValueError: invalid pyproject.toml config: `project.requires-python`.
configuration error: `project.requires-python` must be pep508-versionspec
Steps to reproduce

try building package from artifacts with python>= 3.11?

Related issues/PRs

https://github.com/OpenAPITools/openapi-generator/pull/21268/files#diff-1f30eb8ed63b755ee7e2bdee645631802bee0f57d71e8650dcde554dd91a3368R46

Suggest a fix

change syntax

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions