PEP 639 gave Python packaging a single field for licensing. An SPDX expression in License-Expression, instead of a free-text blob or a pile of classifiers. Core metadata 2.4 carries it.

A packaging tool does not adopt a field like that in one commit. It adopts it wherever somebody noticed, and the rest of the commands keep doing what they did before. Three of my merged pdm pull requests this month were the same field missing from a different place. I found the first one by accident, then went looking, filed an issue for each and fixed all three.

// write back what you read

#3930. Re-running pdm init on a project that already declared a license would rewrite it into a different shape. An expression string came back as a table. The fix was to write the license back in the form it was found in, so a string stays a string and a file table stays a file table when the answer has not changed.

There was a second half to it. Merging the new metadata into the old one left you with both keys present, so a project with {file = "LICENSE"} given --license MIT ended up carrying the file and the text at once. Replacing the field whole rather than merging into it is the correct move, because license is one answer and not an accumulation.

Any tool that rewrites a config file someone else hand-wrote has this bug waiting in it somewhere. Reading is lossy, and whatever the reader discarded is what the writer silently changes.

// the reader lags the writer

#3949. pdm show and pdm list --fields licenses did not know License-Expression existed. They read the old License field and fell back to classifiers. So a package published correctly under the new spec displayed as having no license at all, which is the worst possible answer for that particular question.

Adding the new field is only half the work. The fallback has to stay, because most of the index is still old metadata, and a tool that reads only the current spec breaks for everything published before it. After the change the example from the issue report shows real values for idna, packaging and urllib3, including the one with an OR in it that no classifier could ever have expressed.

// match the ecosystem, not the spec

#3953 was the interesting one. pdm publish was not sending the licensing fields to the index at all, so a correctly built wheel arrived with an empty license.

Sending them is easy. The part worth knowing is that license_file has to be skipped below Metadata-Version 2.4, because setuptools writes License-File under 2.1 where the spec does not define it, and twine drops it there. Following the specification alone would have produced an upload that disagrees with what every other tool sends.

That is the general shape of packaging work. The document tells you what is correct and the installed base tells you what is accepted, and when they disagree you match the installed base and leave a comment saying why.

// why these are good contributions

Nobody has to agree with me about anything here. There is a published spec and a command that does not follow it, so the design argument is finished before I open the editor. Writing the issue first is part of that. It forces me to state the expected behaviour in plain terms and gives a maintainer somewhere to say no before I have written anything.

The work is in the tests. Each of these needed cases that fail on main and cases that pass on main, the second kind there to prove the old behaviour survived. That is most of the diff and all of the reason it merged quickly.