Pyproject.toml license field value is incorrect (should be mapping not string)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Beautiful Soup |
Fix Committed
|
Undecided
|
Unassigned |
Bug Description
As per the spec here: https:/
> license
>
> - TOML type: table
> - Corresponding core metadata field: License
>
> The table may have one of two keys. The file key has a string value that is a file path relative to pyproject.toml to the file which contains the license for the project. Tools MUST assume the file’s encoding is UTF-8. The text key has a string value which is the license of the project. These keys are mutually exclusive, so a tool MUST raise an error if the metadata specifies both keys.
```toml
[project]
# A single pyproject.toml file can only have one of the following.
license = {file = "LICENSE"}
license = {text = "MIT License"}
```
However in the beautifulsoup repo's pyproject.toml file it's just given as a string which is invalid (without a mapping).
To fix:
```diff
-license = "MIT"
+license = { text = "MIT License" }
```
I found this when trying to use the `pdm` package management tool (to run the code without activating a virtual env manually etc), and this invalid config crashed its `init`! I fixed this manually and `pdm init` accepted it fine.
I've attached the full patch which can be applied with `git apply` (never done this before but the UI on the site seems to indicate that's how you prefer to receive them: happy to send another way if more convenient).
```
diff --git a/pyproject.toml b/pyproject.toml
index 31b0b7f..b4c2da9 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -7,7 +7,7 @@ name = "beautifulsoup4"
dynamic = ["version"]
description = "Screen-scraping library"
readme = "README.md"
-license = "MIT"
+license = { text = "MIT License" }
requires-python = ">=3.6.0"
authors = [
{ name = "Leonard Richardson", email = "<email address hidden>" },
```
Thanks for the patch. This is committed as revision 30c58a1.