Skip to content

Commit

Permalink
Remove license and license-files from dynamic in setuptools plugin (#27)
Browse files Browse the repository at this point in the history
Now that we clarified that PEP 621 does not specify anything about the (non-standard) core metadata field License-file and that it is not necessary to add license to dynamic to be able to automatically fill it, there is no motivation for keeping this field in tool.setuptools.dynamic instead of tool.setuptools (directly).
  • Loading branch information
abravalheri authored Mar 9, 2022
2 parents dd8820b + 404c354 commit 6e2236c
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 20 deletions.
29 changes: 11 additions & 18 deletions src/validate_pyproject/plugins/setuptools.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,20 @@
"^.*$": {"type": "string", "format": "python-qualified-identifier"}
}
},
"license-files": {
"type": "array",
"items": {"type": "string"},
"$$description": [
"PROVISIONAL: List of glob patterns for all license files being distributed.",
"(might become standard with PEP 639)."
],
"default": ["LICEN[CS]E*", " COPYING*", " NOTICE*", "AUTHORS*"],
"$comment": "TODO: revise if PEP 639 is accepted. Probably ``project.license-files``?"
},
"dynamic": {
"type": "object",
"description": "Instructions for loading :pep:`621`-related metadata dynamically",
"additionalProperties": false,
"properties": {
"version": {
"$$description": [
Expand All @@ -195,24 +206,6 @@
{"properties": {"content-type": {"type": "string"}}}
],
"required": ["file"]
},
"license": {
"type": "string",
"$$description": [
"PROVISIONAL: A string specifying the license of the package",
"(might change with PEP 639)"
],
"$comment": "TODO: revise if PEP 639 is accepted. Maybe ``license-expression``?"
},
"license-files": {
"type": "array",
"items": {"type": "string"},
"$$description": [
"PROVISIONAL: List of glob patterns for all license files being distributed.",
"(might change with PEP 639)"
],
"default": ["LICEN[CS]E*", " COPYING*", " NOTICE*", "AUTHORS*"],
"$comment": "TODO: revise if PEP 639 is accepted. Maybe ``license-files.glob``?"
}
}
}
Expand Down
1 change: 1 addition & 0 deletions tests/examples/pretend-setuptools/04-pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ readme = "README.md"
dynamic = ["version"]
requires-python = ">=3.8"
dependencies = ["numpy>=1.18.5"]
license.file = "LICENSE.txt"

[project.entry-points]
pandas_plotting_backends = {matplotlib = "project.plotting:matplotlib_plot"}
Expand Down
4 changes: 2 additions & 2 deletions tests/examples/pretend-setuptools/07-pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[project]
name = "myproj"
keywords = ["some", "key", "words"]
license = {text = "MIT"}
dynamic = [
"version",
"description",
Expand Down Expand Up @@ -37,6 +38,7 @@ build-backend = "setuptools.build_meta"
package-dir = {"" = "src"}
zip-safe = true
platforms = ["any"]
license-files = ["LICENSE*", "NOTICE*"]

[tool.setuptools.packages.find]
where = ["src"]
Expand All @@ -46,8 +48,6 @@ namespaces = true
sdist = "pkg.mod.CustomSdist"

[tool.setuptools.dynamic]
license = "MIT"
license-files = ["LICENSE*", "NOTICE*"]
version = {attr = "pkg.__version__.VERSION"}
description = {file = ["README.md"]}
readme = {file = ["README.md"], content-type = "text/markdown"}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`project.license` must be valid exactly by one definition (0 matches found)
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[project]
name = "some-project"
author = { name = "Anderson Bravalheri" }
description = "Some description"
readme = "README.rst"
license = {}
classifiers = [
"Development Status :: 5 - Production/Stable",
"Topic :: Utilities",
]
dynamic = ["version"]
requires-python = ">=3.6"
dependencies = [
"importlib-metadata; python_version<\"3.8\"",
"appdirs>=1.4.4,<2",
]

[tool.setuptools]
zip-safe = false
include-package-data = true
exclude-package-data = { "pkg1" = ["*.yaml"] }
package-dir = {"" = "src"} # all the packages under the src folder
platforms = ["any"]

[tool.setuptools.packages]
find = { where = ["src"], exclude = ["tests"], namespaces = true }

0 comments on commit 6e2236c

Please sign in to comment.