PEP 639: Improving license clarity with better package metadata

Ah, my mistake, I have sdists on the mind lately :sweat_smile:.

It might be worth its own thread to work out the details. The main thing I’d be concerned with about including it in METADATA would be that you’d need to either have a relative or absolute path to the files, which might make it so that the METADATA file is not trivially portable (can’t move around if you have paths relative to METADATA, can’t move around how files are arranged as part of the installation if it’s relative to repo root, need to generate a new METADATA file in each installation location if it’s an absolute path).

I’d expect the relative path to be of the same value as the first column in RECORD, i.e. relative to the installed site-packages directory, or the wheel’s archive root. Wheels are constructed as such that the relative path won’t change on installation, although I’m not sure whether it is a guarenteed feature.

1 Like

I would expect the paths would be relative to the METADATA file itself, because they exist in the same directory. In most cases I can imagine, they would simply be filenames. E.g. for pip:

.../site-packages/pip-20.1.1.dist-info/LICENSE.txt
.../site-packages/pip-20.1.1.dist-info/METADATA

In METADATA it would say: LICENSE.txt. You can move the dist info directory around. Technically, if you just move the METADATA file in isolation to a random place, suddenly you no longer know the path for the licenses, but that applies to a lot more things (such as you no longer know the paths to files installed by the project if you move the RECORD file). So I don’t consider this a big issue.

Hi @hroncok ! this makes complete sense and yes this can be done together and in fact the draft PEP has something that may be what you want?
See [new PEP] Use SPDX license expressions in Core package metadata by pombredanne · Pull Request #2 · pombredanne/spdx-pypi-pep · GitHub

The other changes include:
specifying a License-File field which is already used by wheel and setuptools to include license files in built distributions.
defining how tools can validate license expressions and report warnings to users for invalid expressions (but still accept any string as License).

1 Like

License-File is what I have in the draft PEP for now

Note that the License-File is already de-facto in use in wheels (except it does not show up yet in the METADATA).

The proposed specification is a relative path as explained at [new PEP] Use SPDX license expressions in Core package metadata by pombredanne · Pull Request #2 · pombredanne/spdx-pypi-pep · GitHub

That’s exactly what I suggested in the PEP draft… this is also just recognizing the way this works today in wheels with the license_files as explained https://github.com/pombredanne/spdx-pypi-pep/blob/metadata-2.2-spdx-license/pep-9999.rst#the-license-files-in-wheels-and-setuptools

Awesome! Thank You @pombredanne.

The PEP draft says:

The License-File is a string that is a package-root relative path to a license file.

Not sure what is meant by package-root here, but my understanding was that it would best be relative to the .dist-info directory.

You are correct. See also this review thread by @merwok triggered by your original questions and suggestions: https://github.com/pombredanne/spdx-pypi-pep/pull/2#pullrequestreview-450171597

Any update on the PEP?

Is there anything I can help with?

Respectful bump :slightly_smiling_face:

I see @pradyunsg made a suggestion in the PEP pull request.

1 Like

Let me finalize the PEP submission at last! sorry for taking so much time!

2 Likes

Just to be clear, a repeated License-File field is what I have in the PEP draft

The PEP PR has been at last submitted at https://github.com/python/peps/pull/1625 !
I will also follow up on the python-dev ML

At last the PR is posted.

1 Like

Cool :slight_smile:

You shouldn’t need to do anything particular on python-dev, as it’s a packaging PEP the discussion on here is sufficient.

1 Like

FYI, the draft PEP has been assigned a number: https://github.com/python/peps/pull/1625 is now PEP-639

2 Likes

Thanks @pombredanne! ^>^


I’ve taken the liberty of retitling this topic, since the PEP points here for discussions.

Rendered PEP is here: https://www.python.org/dev/peps/pep-0639/

1 Like