Open mayeut opened 3 years ago
As a partial workaround, a license file specified in project.license.file
(new-style metadata in pyproject.toml
) should always be included in an sdist. This only works for one file per project, though.
If the license files are checked in to the VCS, flit build
should also always include them, although this doesn't apply if you use Flit as a backend for other tools - see #522 and #540 for more discussion about that discrepancy.
FYI, the wheel pulls the LICENSE file via a name-based search: https://github.com/pypa/flit/blob/ee17c70cdef4c9bd2f1d076f2dd8aacabdd38098/flit_core/flit_core/wheel.py#L185. It seems like the default SDist file inclusion should respect this too by including the same pattern. It means that pipx run build --wheel
produces a wheel with the license file(s), but pipx run build
doesn't, since it builds the wheel from the SDist, which is missing these files by default.
Specifying project.license.file
isn't a great idea IMO, since it's changing if PEP 639 is accepted, it seems to indicate that Flit will treat this file as a license file (it doesn't, the wheel still uses a name-based pattern), and it only works for one file.
I ran into this today and found it very surprising. The documentation from PyPA for pyproject.toml
says that project.license.text
should be fine, and suggests that project.license
is even entirely unnecessary for a common license, so requiring project.license.file
feels inconsistent here with the documented standard practices.
It's especially annoying when trying to release a package on conda-forge, which both builds conda packages from SDist and is pretty strict about requiring a LICENSE file. Now I need to do another PyPI release in order to get a valid conda-forge package.
License file are automatically added when building wheel:
https://github.com/takluyver/flit/blob/8f93601d05abe00c833663df541200114dbf3ad1/flit_core/flit_core/wheel.py#L202-L204
However those files are missing in the
sdist
(unless using a specific include config). Shouldn't those license files be included in thesdist
automatically ?xref pypa/packaging#357 / pypa/packaging#358