Skip to content

setuptools validation error installing types-pyyaml re: project.license in pyproject.toml #13879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
charles-dyfis-net opened this issue Apr 24, 2025 · 2 comments

Comments

@charles-dyfis-net
Copy link

setuptools 69.5.1 complains that the types-pyyaml pyproject.toml metadata is malformed, containing both file and text keys in the project.license field when only one or the other is allowed:

python3.12-types-pyyaml> Processing /private/tmp/nix-build-python3.12-types-pyyaml-6.0.12.20250402.drv-0/types_pyyaml-6.0.12.20250402
python3.12-types-pyyaml>   Running command Preparing metadata (pyproject.toml)
python3.12-types-pyyaml>   configuration error: `project.license` must be valid exactly by one definition (2 matches found):
python3.12-types-pyyaml>       - keys:
python3.12-types-pyyaml>           'file': {type: string}
python3.12-types-pyyaml>         required: ['file']
python3.12-types-pyyaml>       - keys:
python3.12-types-pyyaml>           'text': {type: string}
python3.12-types-pyyaml>         required: ['text']
python3.12-types-pyyaml>   DESCRIPTION:
python3.12-types-pyyaml>       `Project license <https://peps.python.org/pep-0621/#license>`_.
python3.12-types-pyyaml>   GIVEN VALUE:
python3.12-types-pyyaml>       "Apache-2.0"
python3.12-types-pyyaml>   OFFENDING RULE: 'oneOf'
python3.12-types-pyyaml>   DEFINITION:
python3.12-types-pyyaml>       {
python3.12-types-pyyaml>           "oneOf": [
python3.12-types-pyyaml>               {
python3.12-types-pyyaml>                   "properties": {
python3.12-types-pyyaml>                       "file": {
python3.12-types-pyyaml>                           "type": "string",
python3.12-types-pyyaml>                           "$$description": [
python3.12-types-pyyaml>                               "Relative path to the file (UTF-8) which contains the license for the",
python3.12-types-pyyaml>                               "project."
python3.12-types-pyyaml>                           ]
python3.12-types-pyyaml>                       }
python3.12-types-pyyaml>                   },
python3.12-types-pyyaml>                   "required": [
python3.12-types-pyyaml>                       "file"
python3.12-types-pyyaml>                   ]
python3.12-types-pyyaml>               },
python3.12-types-pyyaml>               {
python3.12-types-pyyaml>                   "properties": {
python3.12-types-pyyaml>                       "text": {
python3.12-types-pyyaml>                           "type": "string",
python3.12-types-pyyaml>                           "$$description": [
python3.12-types-pyyaml>                               "The license of the project whose meaning is that of the",
python3.12-types-pyyaml>                               "`License field from the core metadata",
python3.12-types-pyyaml>                               "<https://packaging.python.org/specifications/core-metadata/#license>`_."
python3.12-types-pyyaml>                           ]
python3.12-types-pyyaml>                       }
python3.12-types-pyyaml>                   },
python3.12-types-pyyaml>                   "required": [
python3.12-types-pyyaml>                       "text"
python3.12-types-pyyaml>                   ]
python3.12-types-pyyaml>               }
python3.12-types-pyyaml>           ]
python3.12-types-pyyaml>       }
python3.12-types-pyyaml>   Traceback (most recent call last):
python3.12-types-pyyaml>     File "/nix/store/cp74c7q8d0hd023hj7ds5gqh9213nhxm-python3.12-pip-24.0/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
python3.12-types-pyyaml>       main()
python3.12-types-pyyaml>     File "/nix/store/cp74c7q8d0hd023hj7ds5gqh9213nhxm-python3.12-pip-24.0/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
python3.12-types-pyyaml>       json_out['return_val'] = hook(**hook_input['kwargs'])
python3.12-types-pyyaml>                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
python3.12-types-pyyaml>     File "/nix/store/cp74c7q8d0hd023hj7ds5gqh9213nhxm-python3.12-pip-24.0/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 149, in prepare_metadata_for_build_wheel
python3.12-types-pyyaml>       return hook(metadata_directory, config_settings)
python3.12-types-pyyaml>              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
python3.12-types-pyyaml>     File "/nix/store/bh40rl4ifswkywhnvv8iggbdw27pk7nq-python3.12-setuptools-69.5.1/lib/python3.12/site-packages/setuptools/build_meta.py", line 366, in prepare_metadata_for_build_wheel
python3.12-types-pyyaml>       self.run_setup()
python3.12-types-pyyaml>     File "/nix/store/bh40rl4ifswkywhnvv8iggbdw27pk7nq-python3.12-setuptools-69.5.1/lib/python3.12/site-packages/setuptools/build_meta.py", line 311, in run_setup
python3.12-types-pyyaml>       exec(code, locals())
python3.12-types-pyyaml>     File "<string>", line 4, in <module>
python3.12-types-pyyaml>     File "/nix/store/bh40rl4ifswkywhnvv8iggbdw27pk7nq-python3.12-setuptools-69.5.1/lib/python3.12/site-packages/setuptools/__init__.py", line 104, in setup
python3.12-types-pyyaml>       return distutils.core.setup(**attrs)
python3.12-types-pyyaml>              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
python3.12-types-pyyaml>     File "/nix/store/bh40rl4ifswkywhnvv8iggbdw27pk7nq-python3.12-setuptools-69.5.1/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 158, in setup
python3.12-types-pyyaml>       dist.parse_config_files()
python3.12-types-pyyaml>     File "/nix/store/bh40rl4ifswkywhnvv8iggbdw27pk7nq-python3.12-setuptools-69.5.1/lib/python3.12/site-packages/setuptools/dist.py", line 631, in parse_config_files
python3.12-types-pyyaml>       pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
python3.12-types-pyyaml>     File "/nix/store/bh40rl4ifswkywhnvv8iggbdw27pk7nq-python3.12-setuptools-69.5.1/lib/python3.12/site-packages/setuptools/config/pyprojecttoml.py", line 68, in apply_configuration
python3.12-types-pyyaml>       config = read_configuration(filepath, True, ignore_option_errors, dist)
python3.12-types-pyyaml>                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
python3.12-types-pyyaml>     File "/nix/store/bh40rl4ifswkywhnvv8iggbdw27pk7nq-python3.12-setuptools-69.5.1/lib/python3.12/site-packages/setuptools/config/pyprojecttoml.py", line 129, in read_configuration
python3.12-types-pyyaml>       validate(subset, filepath)
python3.12-types-pyyaml>     File "/nix/store/bh40rl4ifswkywhnvv8iggbdw27pk7nq-python3.12-setuptools-69.5.1/lib/python3.12/site-packages/setuptools/config/pyprojecttoml.py", line 57, in validate
python3.12-types-pyyaml>       raise ValueError(f"{error}\n{summary}") from None
python3.12-types-pyyaml>   ValueError: invalid pyproject.toml config: `project.license`.
python3.12-types-pyyaml>   configuration error: `project.license` must be valid exactly by one definition (2 matches found):
python3.12-types-pyyaml>       - keys:
python3.12-types-pyyaml>           'file': {type: string}
python3.12-types-pyyaml>         required: ['file']
python3.12-types-pyyaml>       - keys:
python3.12-types-pyyaml>           'text': {type: string}
python3.12-types-pyyaml>         required: ['text']
python3.12-types-pyyaml>   error: subprocess-exited-with-error
python3.12-types-pyyaml>   × Preparing metadata (pyproject.toml) did not run successfully.
python3.12-types-pyyaml>   │ exit code: 1
python3.12-types-pyyaml>   ╰─> See above for output.
python3.12-types-pyyaml>   note: This error originates from a subprocess, and is likely not a problem with pip.
python3.12-types-pyyaml>   full command: /nix/store/037bk67acx9nzl93g3py8nbahn6y1z1r-python3-3.12.6/bin/python3.12 /nix/store/cp74c7q8d0hd023hj7ds5gqh9213nhxm-python3.12-pip-24.0/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py prepare_metadata_for_build_wheel /private/tmp/nix-build-python3.12-types-pyyaml-6.0.12.20250402.drv-0/tmp8nfi9d6q
python3.12-types-pyyaml>   cwd: /private/tmp/nix-build-python3.12-types-pyyaml-6.0.12.20250402.drv-0/types_pyyaml-6.0.12.20250402
python3.12-types-pyyaml>   Preparing metadata (pyproject.toml) ... error
python3.12-types-pyyaml> error: metadata-generation-failed
python3.12-types-pyyaml> × Encountered error while generating package metadata.
python3.12-types-pyyaml> ╰─> See above for output.
python3.12-types-pyyaml> note: This is an issue with the package mentioned above, not pip.
python3.12-types-pyyaml> hint: See above for details.
@vidhyavijayan3
Copy link
Contributor

Hi @charles-dyfis-net

Can I work on this issue?

@srittau
Copy link
Collaborator

srittau commented Apr 25, 2025

This is the relevant part of the project table from the distribution package:

[project]
# ...
license = "Apache-2.0"
license-files = ["LICENSE"]
# ...

This is in line with the packaging spec, which current setuptools versions with PEP 639 support should be able to parse.

@srittau srittau closed this as not planned Won't fix, can't repro, duplicate, stale Apr 25, 2025
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

No branches or pull requests

3 participants