Open fizyk opened 1 year ago
Hi @fizyk, the field License-File
is a non-standard field that is different from License
.
If you set license
in pyproject.toml
, the existing standards mandate that the License
field reflects that, but not to License-File
.
The meaning of setting [project] license = {file = "..."}
is that setuptools should read this file and embed its contents into the PKG-INFO
/METADATA
files. The meaning of License-File
however is different: it tells setuptools to copy the file to the .dist-info
folder.
By default setuptools will consider the following glob patterns to populate License-File
when it is not given: ['LICEN[CS]E*', 'COPYING*', 'NOTICE*', 'AUTHORS*']
. Note that this is inline with the draft version of PEP 629.
Sorry if that is a complicated topic, it took me a long time to wrap my head around this.
You can have a look on the valuable comments by C.A.M Gerlach (the person that is currently heading the standardisation on License-File
) on the Python discourse about this:
I am afraid that until PEP 639 comes out in it's final form and is approved, we are not going to touch License-File
(to avoid reworking the implementation multiple times).
If you wish to omit License-File
please set something like the following:
[tool.setuptools]
license-files = ["LICENSE"]
Configuration reference: https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html#setuptools-specific-configuration
(Although I haven't tested it myself... It might be the case that even if setuptools
does not add the default files, pypa/wheel
will).
Okay.... but if I have the license = {file = "COPYING.lesser"}
entry correctly configured - it points to correct, existing file,
The License-File
field is not present in the package metadata ( see https://github.com/ClearcodeHQ/pytest-redis/tree/v3.0.1 )
Interesting. Thank you very much for pointing that out. It seems that there is a problem with the JSON schema used to generate the validation code:
That is why "COPYING" and "NOTICE" are not matching but "LI[CS]ENSE" and "AUTHORS" are matching... There are wrong whitespaces in the JSON schema.
I didn't thought it would add the default value (I thought it would use it only as documentation). I will try to fix the discrepancy tomorrow morning. But then, License-File
should be present anyway.
setuptools version
67.6.0 (=>61.0.0)
Python version
3.11.0
OS
ubuntu
Additional environment information
This happens when I build package with build/setuptools
Description
I recently moved packages configuration to the pyproject.toml from setup.cfg, and pointed to the bad LICENSE file (instead of COPYING.lesser).
Building package gave me this warning:
But the wheel's METADATA file had this entry instead:
License-File: AUTHORS.rst
Link to the build:
https://github.com/ClearcodeHQ/pytest-redis/actions/runs/4513863420
Expected behavior
Build will either fail, or will not include any information about the license file.
How to Reproduce
pipenv install --dev
pipenv run python -m build .
cat pytest_redis.egg-info/PKG-INFO | grep License-File
Output