hatch icon indicating copy to clipboard operation
hatch copied to clipboard

Recommended License configuration leaves license null in project meta data

Open facelessuser opened this issue 1 year ago • 6 comments

So I had an issue opened here: https://github.com/facelessuser/soupsieve/pull/275.

The author of the PR claimed that the license was configured incorrectly in the toml file and references the latest spec: https://packaging.python.org/en/latest/specifications/pyproject-toml/#license.

Hatch, in its current documentation, seems to indicate you can configure it like so:

[project]
...
license = "MIT"

But it seems the specification seems to suggest:

[project]
...
license = { text = "MIT" }

The original complaint was that the project meta data is left with license defined as null if doing it the way Hatch recommends: https://pypi.org/pypi/soupsieve/json.

facelessuser avatar Aug 24 '24 02:08 facelessuser

The API has to begin supporting PEP 639 https://github.com/pypi/warehouse/issues/12585

ofek avatar Aug 24 '24 17:08 ofek

Just to make sure I understand: hatch does not support this syntax because warehouse does not support this in their API yet either?

facelessuser avatar Aug 24 '24 21:08 facelessuser

Okay, I think I understand a bit better. It seems PEP 639 is a draft, but that is what hatch supports? Warehouse won't support the PEP until it is accepted. What I'm hazy on is whether there is an issue if we use license = { text = "MIT" }? Does this break the display of license in PyPI or does it work fine? Does it fix the null value in the meta data or will it still be broken regardless?

facelessuser avatar Aug 25 '24 13:08 facelessuser

I believe that would fix the issue although maybe the API depends on the license classifier, I can't remember.

ofek avatar Aug 25 '24 14:08 ofek

Based on my understanding hatch already supports PEP 639 as the first build backend. And that's why the syntax is license = "<SPDX_identifier>". Is that correct?

I wonder if hatch in the meantime could output that license identifier in the metadata under License:?

$ pip show soupsieve
Name: soupsieve
Version: 2.5
Summary: A modern CSS selector implementation for Beautiful Soup.
Home-page: https://github.com/facelessuser/soupsieve
Author: 
Author-email: Isaac Muse <[email protected]>
License: 
Location: <...>
Requires: 
Required-by: beautifulsoup4

mschoettle avatar Sep 03 '24 14:09 mschoettle

Seems like hatch also supports the old/current way of defining it: https://github.com/psf/black/blob/98a580bbdc217a8b1a47b772d2140ed29cdc587a/pyproject.toml#L36 (PyPI API response)

$ pip show black
Name: black
Version: 24.8.0
[...]
License: MIT
[...]

In any case, work on supporting PEP 639 has started: https://github.com/pypi/warehouse/issues/16620

mschoettle avatar Sep 09 '24 14:09 mschoettle