pypa / hatch

Modern, extensible Python project management
https://hatch.pypa.io/latest/
MIT License
6.06k stars 306 forks source link

Recommended License configuration leaves license null in project meta data #1690

Open facelessuser opened 2 months ago

facelessuser commented 2 months ago

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.

ofek commented 2 months ago

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

facelessuser commented 2 months ago

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

facelessuser commented 2 months ago

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?

ofek commented 2 months ago

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

mschoettle commented 2 months ago

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 <Isaac.Muse@gmail.com>
License: 
Location: <...>
Requires: 
Required-by: beautifulsoup4
mschoettle commented 2 months ago

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