Skip to content

Set license and license-files key in project metadata to follow PEP639 #3699

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

Merged
merged 6 commits into from
Apr 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools>=64", "setuptools_scm[toml]>=6.2"]
requires = ["setuptools>=77", "setuptools_scm[toml]>=6.2"]
build-backend = "setuptools.build_meta"

[project]
Expand All @@ -8,6 +8,8 @@ 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 = "BSD-3-Clause"
license-files = ["LICENSE.txt"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's likely we can also remove license-files = ["LICENSE.txt"] from the tool.setuptools section (xref: https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html#setuptools-specific-configuration).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, running make package at commit 88784d0 with setuptools>=77 will result in this error:

$ make package
python -m build
* Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
  - setuptools>=77
  - setuptools_scm[toml]>=6.2
* Getting build dependencies for sdist...
Traceback (most recent call last):
  File "/home/user/mambaforge/envs/pygmt/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
    main()
  File "/home/user/mambaforge/envs/pygmt/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 "/home/user/mambaforge/envs/pygmt/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-xnpt97lo/lib/python3.11/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-xnpt97lo/lib/python3.11/site-packages/setuptools/build_meta.py", line 304, in _get_build_requires
    self.run_setup()
  File "/tmp/build-env-xnpt97lo/lib/python3.11/site-packages/setuptools/build_meta.py", line 320, in run_setup
    exec(code, locals())
  File "<string>", line 1, in <module>
  File "/tmp/build-env-xnpt97lo/lib/python3.11/site-packages/setuptools/__init__.py", line 117, in setup
    return distutils.core.setup(**attrs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/build-env-xnpt97lo/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 160, in setup
    dist.parse_config_files()
  File "/tmp/build-env-xnpt97lo/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-xnpt97lo/lib/python3.11/site-packages/setuptools/config/pyprojecttoml.py", line 73, in apply_configuration
    return _apply(dist, config, filepath)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/build-env-xnpt97lo/lib/python3.11/site-packages/setuptools/config/_apply_pyprojecttoml.py", line 55, in apply
    _apply_tool_table(dist, config, filename)
  File "/tmp/build-env-xnpt97lo/lib/python3.11/site-packages/setuptools/config/_apply_pyprojecttoml.py", line 95, in _apply_tool_table
    raise InvalidConfigError(
setuptools.errors.InvalidConfigError: 'project.license-files' is defined already. Remove 'tool.setuptools.license-files'.

so I removed tool.setuptools.license-files in commit 2d30dcc.

keywords = [
"cartography",
"geodesy",
Expand All @@ -31,7 +33,6 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"License :: OSI Approved :: BSD License",
]
dependencies = [
"numpy>=1.25",
Expand All @@ -58,9 +59,6 @@ all = [
"Changelog" = "https://www.pygmt.org/latest/changes.html"
"Issue Tracker" = "https://github.com/GenericMappingTools/pygmt/issues"

[tool.setuptools]
license-files = ["LICENSE.txt"]

[tool.setuptools.packages.find]
include = ["pygmt*"]
exclude = ["doc"]
Expand Down