Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

license metadata is checked but then discarded #525

Open
analog-cbarber opened this issue Feb 5, 2022 · 7 comments
Open

license metadata is checked but then discarded #525

analog-cbarber opened this issue Feb 5, 2022 · 7 comments

Comments

@analog-cbarber
Copy link

You can put a license in your pyproject.toml and flit will check to make sure it has the correct form, but will then just throw it away rather than include it in the metadata.

if 'license' in proj:
_check_type(proj, 'license', dict)
license_tbl = proj['license']
unrec_keys = set(license_tbl.keys()) - {'text', 'file'}
if unrec_keys:
raise ConfigError(
"Unrecognised keys in [project.license]: {}".format(unrec_keys)
)
# TODO: Do something with license info.
# The 'License' field in packaging metadata is a brief description of
# a license, not the full text or a file path. PEP 639 will improve on
# how licenses are recorded.
if 'file' in license_tbl:
if 'text' in license_tbl:
raise ConfigError(
"[project.license] should specify file or text, not both"
)
lc.referenced_files.append(license_tbl['file'])
elif 'text' in license_tbl:
pass
else:
raise ConfigError(
"file or text field required in [project.license] table"
)

@takluyver
Copy link
Member

I'm waiting for PEP 639 before reworking the options for license metadata. The TODO comment in that code explains why it doesn't put the license from pyproject.toml into the current package metadata format.

kaxil added a commit to astronomer/astronomer-providers that referenced this issue Feb 18, 2022
setuptools doesn't work without `setup.cfg`/`setup.py`.

flint had some minor issues - pypa/flit#525 / pypa/flit#488

poetry does not support namespace packages
kaxil added a commit to astronomer/astronomer-providers that referenced this issue Feb 18, 2022
setuptools doesn't work without `setup.cfg`/`setup.py`.

flint had some minor issues - pypa/flit#525 / pypa/flit#488

poetry does not support namespace packages
kaxil added a commit to astronomer/astronomer-providers that referenced this issue Feb 18, 2022
setuptools doesn't work without `setup.cfg`/`setup.py`.

flint had some minor issues - pypa/flit#525 / pypa/flit#488

poetry does not support namespace packages
kaxil added a commit to astronomer/astronomer-providers that referenced this issue Feb 19, 2022
setuptools doesn't work without `setup.cfg`/`setup.py`.

flint had some minor issues - pypa/flit#525 / pypa/flit#488

poetry does not support namespace packages
kaxil added a commit to astronomer/astronomer-providers that referenced this issue Feb 19, 2022
setuptools doesn't work without `setup.cfg`/`setup.py`.

flint had some minor issues - pypa/flit#525 / pypa/flit#488

poetry does not support namespace packages
kaxil added a commit to astronomer/astronomer-providers that referenced this issue Feb 19, 2022
setuptools doesn't work without `setup.cfg`/`setup.py`.

flint had some minor issues - pypa/flit#525 / pypa/flit#488

poetry does not support namespace packages
kaxil added a commit to astronomer/astronomer-providers that referenced this issue Feb 19, 2022
setuptools doesn't work without `setup.cfg`/`setup.py`.

flint had some minor issues - pypa/flit#525 / pypa/flit#488

poetry does not support namespace packages
kaxil added a commit to astronomer/astronomer-providers that referenced this issue Feb 19, 2022
setuptools doesn't work without `setup.cfg`/`setup.py`.

flint had some minor issues - pypa/flit#525 / pypa/flit#488

poetry does not support namespace packages
kaxil added a commit to astronomer/astronomer-providers that referenced this issue Feb 19, 2022
setuptools doesn't work without `setup.cfg`/`setup.py`.

flint had some minor issues - pypa/flit#525 / pypa/flit#488

poetry does not support namespace packages
kaxil added a commit to astronomer/astronomer-providers that referenced this issue Feb 19, 2022
setuptools doesn't work without `setup.cfg`/`setup.py`.

flint had some minor issues - pypa/flit#525 / pypa/flit#488

poetry does not support namespace packages
kaxil added a commit to astronomer/astronomer-providers that referenced this issue Feb 19, 2022
setuptools doesn't work without `setup.cfg`/`setup.py`.

flint had some minor issues - pypa/flit#525 / pypa/flit#488

poetry does not support namespace packages
kaxil added a commit to astronomer/astronomer-providers that referenced this issue Feb 19, 2022
setuptools doesn't work without `setup.cfg`/`setup.py`.

flint had some minor issues - pypa/flit#525 / pypa/flit#488

poetry does not support namespace packages
@pombredanne
Copy link

I am the taking-too-long-to-finish author of PEP639... IMHO you should not wait to include license metadata.

@WolfgangFahl
Copy link

I am also interested how this is supposed to work. I tried a work-around in my project like this:

# flit_core.config.ConfigError: license field should be <class 'dict'>, not <class 'str'>
license = { 
  file="LICENSE" 
}

and end up with a garbled result in pypi when using hatchling.
grafik

I can't find the "official" way how to do this properly and will need to revert to the plain string version of
e.g.

license=Apache-2.0

@takluyver
Copy link
Member

I think Hatchling is doing the wrong thing there, though it's not entirely clear, because there isn't really a right thing. It has chosen to read the file and include the full contents as the License field in the package metadata. The metadata spec suggests that the License field is meant for a brief description to identify the license, not the full text.

Part of PEP 639 is to include a new License-File field for this case.

@takluyver
Copy link
Member

Oh, and there's also an issue open on PyPI for how it displays really long license fields: pypi/warehouse#12392

@RossComputerGuy
Copy link

Is there a solution to this? I get the error described when building Hatchling v1.7.0 with Flit 3.9.0.

@mschoettle
Copy link

Maybe this could be revisited now that [PEP 639] has provisional status.

Some packages already use the license text field to specify the SPDX identifier of the license which results in PyPI returning this information in via the API in the license key. Although I am unsure whether this is documented behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants