Skip to content
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

Become PEP 639 compliant #650

Open
MicahGale opened this issue Jan 29, 2025 · 0 comments
Open

Become PEP 639 compliant #650

MicahGale opened this issue Jan 29, 2025 · 0 comments
Labels
CI/CD code improvement A feature request that will improve the software and its maintainability, but be invisible to users.

Comments

@MicahGale
Copy link
Collaborator

PEP 639 changes the metadata around license to be expression based.

With PEP 639 flowing down to pyproject.toml we should go from:

license = {file="LICENSE"}

to:

license = "MIT"
license-files= ["LICENSE"]

In my experimenting setuptools (up to version 75.8.0) does not like this and thinks its invalid:

Traceback (most recent call last):
  File "/home/mgale/mambaforge/lib/python3.12/site-packages/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
    main()
  File "/home/mgale/mambaforge/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 "/home/mgale/mambaforge/lib/python3.12/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-u3mq52vy/lib/python3.12/site-packages/setuptools/build_meta.py", line 337, in get_requires_for_build_sdist
    return self._get_build_requires(config_settings, requirements=[])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/build-env-u3mq52vy/lib/python3.12/site-packages/setuptools/build_meta.py", line 304, in _get_build_requires
    self.run_setup()
  File "/tmp/build-env-u3mq52vy/lib/python3.12/site-packages/setuptools/build_meta.py", line 320, in run_setup
    exec(code, locals())
  File "<string>", line 1, in <module>
  File "/tmp/build-env-u3mq52vy/lib/python3.12/site-packages/setuptools/__init__.py", line 117, in setup
    return distutils.core.setup(**attrs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/build-env-u3mq52vy/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 160, in setup
    dist.parse_config_files()
  File "/tmp/build-env-u3mq52vy/lib/python3.12/site-packages/setuptools/dist.py", line 652, in parse_config_files
    pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
  File "/tmp/build-env-u3mq52vy/lib/python3.12/site-packages/setuptools/config/pyprojecttoml.py", line 72, in apply_configuration
    config = read_configuration(filepath, True, ignore_option_errors, dist)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/build-env-u3mq52vy/lib/python3.12/site-packages/setuptools/config/pyprojecttoml.py", line 140, in read_configuration
    validate(subset, filepath)
  File "/tmp/build-env-u3mq52vy/lib/python3.12/site-packages/setuptools/config/pyprojecttoml.py", line 61, in validate
    raise ValueError(f"{error}\n{summary}") from None
ValueError: invalid pyproject.toml config: `project.license`.
configuration error: `project.license` must be valid exactly by one definition (2 matches found):

    - keys:
        'file': {type: string}
      required: ['file']
    - keys:
        'text': {type: string}
      required: ['text']


ERROR Backend subprocess exited when trying to invoke get_requires_for_build_sdist

This is probably the fact that setuptools doesn't support PEP 639 yet I think, but could be operator error

@MicahGale MicahGale added CI/CD code improvement A feature request that will improve the software and its maintainability, but be invisible to users. labels Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/CD code improvement A feature request that will improve the software and its maintainability, but be invisible to users.
Projects
None yet
Development

No branches or pull requests

1 participant