Pyproject.toml license field value is incorrect (should be mapping not string)

Bug #2032848 reported by Louis Maddox
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Beautiful Soup
Fix Released
Undecided
Unassigned

Bug Description

As per the spec here: https://packaging.python.org/en/latest/specifications/declaring-project-metadata/#license

> 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>" },
```

Revision history for this message
Louis Maddox (lmmx) wrote :
Revision history for this message
Leonard Richardson (leonardr) wrote :

Thanks for the patch. This is committed as revision 30c58a1.

Changed in beautifulsoup:
status: New → Fix Committed
Revision history for this message
Leonard Richardson (leonardr) wrote :

Released in 4.12.3.

Changed in beautifulsoup:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.