-
Notifications
You must be signed in to change notification settings - Fork 224
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
WIP: Set license and license-files key in project metadata to follow PEP639 #3699
base: main
Are you sure you want to change the base?
Conversation
Adhere to https://peps.python.org/pep-0639 and specify exact variant of license used (BSD-3-Clause).
The changes look good to me, but I'm unsure if we need to wait for upstream changes in setuptools (e.g., pypa/setuptools#3596). |
Also remove license-files, because it doesn't seem to be supported by setuptools yet.
Hmm, you're right that python -m build
* Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
- setuptools>=64
- setuptools_scm[toml]>=6.2
* Getting build dependencies for sdist...
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']
DESCRIPTION:
`Project license <https://peps.python.org/pep-0621/#license>`_.
GIVEN VALUE:
"BSD-3-Clause"
OFFENDING RULE: 'oneOf'
DEFINITION:
{
"oneOf": [
{
"properties": {
"file": {
"type": "string",
"$$description": [
"Relative path to the file (UTF-8) which contains the license for the",
"project."
]
}
},
"required": [
"file"
]
},
{
"properties": {
"text": {
"type": "string",
"$$description": [
"The license of the project whose meaning is that of the",
"`License field from the core metadata",
"<https://packaging.python.org/specifications/core-metadata/#license>`_."
]
}
},
"required": [
"text"
]
}
]
}
Traceback (most recent call last):
File "/home/user/mambaforge/envs/pygmt/lib/python3.12/site-packages/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
main()
File "/home/user/mambaforge/envs/pygmt/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/user/mambaforge/envs/pygmt/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-97hptb3y/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-97hptb3y/lib/python3.12/site-packages/setuptools/build_meta.py", line 304, in _get_build_requires
self.run_setup()
File "/tmp/build-env-97hptb3y/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-97hptb3y/lib/python3.12/site-packages/setuptools/__init__.py", line 117, in setup
return distutils.core.setup(**attrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/build-env-97hptb3y/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 157, in setup
dist.parse_config_files()
File "/tmp/build-env-97hptb3y/lib/python3.12/site-packages/setuptools/dist.py", line 648, in parse_config_files
pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
File "/tmp/build-env-97hptb3y/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-97hptb3y/lib/python3.12/site-packages/setuptools/config/pyprojecttoml.py", line 140, in read_configuration
validate(subset, filepath)
File "/tmp/build-env-97hptb3y/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
make: *** [Makefile:29: package] Error 1 I changed it to just |
pyproject.toml
Outdated
@@ -8,6 +8,7 @@ description = "A Python interface for the Generic Mapping Tools" | |||
readme = "README.md" | |||
requires-python = ">=3.11" | |||
authors = [{name = "The PyGMT Developers", email = "[email protected]"}] | |||
license = {text = "BSD-3-Clause"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://peps.python.org/pep-0639/#deprecate-license-key-table-subkeys
If I understand it correctly, this syntax will be deprecated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok, I'll revert the change then and mark this PR as draft until setuptools supports PEP639 properly.
This reverts commit 9d0dead.
Description of proposed changes
Specify exact variant of license using SPDX format (BSD-3-Clause) in the pyproject.toml file, remove license classifier.
References:
Fixes #
Preview:
Reminders
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
.Slash Commands
You can write slash commands (
/command
) in the first line of a comment to performspecific operations. Supported slash command is:
/format
: automatically format and lint the code