Has there been any progress on this?
setuptools v57.0.0
was just released which includes initial support for the License-File
metadata field.
Secondly, is there any way of fixing this so it stops spamming me (and others)?
IIRC, this was a GitHub regression. Getting notifications like this when forks are updated was NOT an intended behaviour and, a few weeks ago, that regression was fixed again.
@CAM-Gerlach Would you still be open to updating the PEP? https://github.com/python/peps/blob/master/pep-0639.rst
Hey, thanks for the ping and sorry for the lack of engagement lately; I was hoping to get @pombredanne 's feedback and then I was dealing with NASA and family stuff. Yeah, I can take a crack at drafting a PR this weekend, based on the proposals/task list above and the subsequent discussion, though I’ll definitely need feedback from reviewers much more experienced with packaging, like you and @pf-moore , to make sure the details are all in order. This would include the mechanical/reformatting/framing, etc. changes, and implementing and summarizing the rationale for the changes everyone seems to already agree on (e.g. a new License-Expression
field instead of re-using the existing field).
As for remaining issues, it sounds like those who have chimed in so far all basically agree that the goal is for the new License-Expression
field to replace the existing License
field and Trove classifiers, with a some sort of deprecation period followed by removal. However, while I’ve proposed a plan for deprecation in 2.3 followed by a removal in a notional 3.0 that aligns with what people have brought up here so far, it definitely seems like there should be more discussion and feedback on that especially from packaging experts and tool maintainers, and there are a number of details we’ll need to iron out. Given that with the other major changes, the PEP will be incomplete without at least a draft deprecation plan, I guess can add what we have so far as a starting point, any immediate problems ironed out during PR review and then we can iterate further here, but any immediate feedback on that would be most welcome. Thanks!
Could you link the PR here?
@CAM-Gerlach Hello again! I’m not sure if you saw the previous message, but did you have a chance to open that PR?
Hey, sorry for the long delay @ofek and thanks for the ping! I’d drafted a message that I evidently never sent, but aside from NASA stuff I just had a close friend pass away after a battle with cancer and I’ve been kinda disconnected for a while, and didn’t see a notification about your previous one. I’ll try again to allocate some time this weekend for it, and will ping here as soon as I have something somewhere public. Thanks!
Ah no worries, I’m very sorry for your loss.
I’ll be glad to help review whatever you come up with. Again, thank you!
The referenced version number should be updated to 2.3 and the updated version to 2.2 throughout the PEP, and 2.2 added to the references section…
Sorry for this falling off my radar (and thanks for the pings @ofek ); I got a bit overwhelmed with everything that had piled up when I got back and had to incrementally spin things up again project by project. I can start with the more straightforward and mechanical changes listed in my prior comment (aside from the version updates, per @pf_moore 's comment, which will instead be removed entirely) in a PR so we have something to start with, and then can propose one or more on top of that for discussion with the more substantive changes we’ve discussed.
Hey, thanks for getting started on this! I really hate to be the one to mention this when I’ve been so delinquent in helping with this myself until now, and its my fault for not updating that message back when I could and thus misleading you, but @pfmoore 's response to my comment, that is actually the one part that shouldn’t done, and instead all the references to the metadata version should be removed and the PEP reformatted to look like PEP 643. I’ll mention that in a review and drop a PR shortly doing that instead.
Welp, it ended up being far more of a project than I anticipated, but at long last, the big PEP update you’ve all been waiting for (and more)! I ended up reading all the issues, all the specs, this whole discussion and taking a very deep dive into the packaging world and learned way more than I ever thought (though perhaps as much, gained an appreciation for how much deeper still this ocean goes).
I’ve carefully organized the commit history into logical, atomic, high-level changes, to hopefully make it relatively easy to follow and review. Here’s a high-level summary; for the full details, expand the <details>
dropdown on the PEP.
All the requested/needed changes have been implemented, including:
-
Rewrite to reflect adoption of a standalone
License-Expression
field instead of theLicense
field, as agreed here - Add detailed guidance for deprecating the legacy license metadata, as discussed here
- Add requirements for PyPI validation of new fields, per consensus here
- Add full coverage of PEP 621 metadata, as requested by @pf_moore
- Add open issue discussed here regarding filling legacy license field
- Restructure PEP as standalone rather than spec update per @pf_moore
- Update and expand other sections to reflect the changes above
- Implement basic formatting cleanup and fixes mentioned above
In addition, I’ve addressed the following issues I found during the process:
- Add many additional missing ambiguous license classifiers and further guidance on handling them
- Update to reflect tool, spec, link, doc and best practice changes since its drafting two years ago
- Add minor clarifications to document the license files in the sdist, wheel and install project specs
-
Specify that
license_files
should match the subdir layout of the source as requested on wheel and Setuptools issues -
Specify proposed
license_file
subdirectory as suggested on wheel and setuptools issues - Move the examples and other non-normative content out of the specification
- Add, fix and improve links, references and more
- Copyedit PEP for grammar, phrasing, tone, clarity and correctness issues
Finally, I’ve added some additional non-normative content that should be useful here:
- Add terminology section, and use terms consistently
- Describe in detail the rationale for the implemented structure and the alternative ideas proposed here and elsewhere
- Add User Scenarios section with guidance/FAQs for ordinary package authors
- Add/expand both simplified and detailed end to end examples
- Expand several other sections with additional detail and clarifications
@pombredanne since we haven’t heard from you in a long time, do you mind if I add myself as an author so I can help champion, refine and implement your excellent work?
This is awesome, thanks!
I share @uranusjr’s opinion from https://github.com/python/peps/pull/2164#discussion_r758083210
PEP 621 specifically left room in the
license
key, so we don’t need to deprecate it. We only need to deprecatelicense = {text = ...}
andlicense = {file = ...}
, and define meaning tolicense = "MIT"
. No new[project]
keys are needed.
I haven’t followed this thread as closely as you have but I also thought we all only wanted to drop the License
metadata field.
I’m finishing up Hatch v1 beta and currently it follows PEP 621 – Storing project metadata in pyproject.toml | peps.python.org
A practical string value for the
license
key has been purposefully left out to allow for a future PEP to specify support for SPDX [6] expressions (the same logic applies to any sort of “type” field specifying what license thefile
ortext
represents).
So I thought license
key as a string would be the new License-Expression
metadata field.
Also, perhaps most importantly, I don’t want (users) to have to type license-expression
Hey, thanks for your kind words!
As I mentioned in my reply to him there (with a few minor clarifications):
Actually, this was exactly the original approach I took here (see 4871854 ), later revised to split the
license-files
out into a top-level key while keeping theLicense-Expression
field mapped to thelicense
key, and then further revised to split them both (see 88cba0c ). In practice, when I considered it carefully, the first, and to a somewhat lesser extent the second approach provided to be distinctly inferior [to that ultimately taken] for a number of reasons, and quite possibly unworkable (due to the interaction with thedynamic
key, depending on exactly how one interprets a rather imprecisely specified passage in PEP 621), while the only downside of the present approach was 1-2 more top-level keys.I spent a substantial amount of time carefully considering the alternatives here, and thoroughly address both of these in great detail in the Rejected Ideas section; see the Add expression and files subkeys to table and Define license expression as string value items under the
Source metadata license key
subsection.
As for the hybrid approach he then suggested in his subsequent reply (separate license-file
field, but license
string value meaning license expression), which is at least a somewhat more viable alternative:
In fact, following that which you previously proposed, this was my second approach here too
However, upon implementing it, it still ran into less serious versions of some of the same issues as the previous, including mapping two distinct metadata types to the same key, inability to specify which was marked as dynamic, and creating additional inconsistency between core metadata, PEP 621 and
setup.cfg
/other tool formats. On top of that, it creates potential for serious user confusion and ambiguity, since it meanslicense
maps to completely syntactically and semantically different fields depending on the config format, and is much less explicit to authors, readers and consumers that it is intended to be a SPDX identifier/expression. See Define license expression as string value in the Rejected Ideas for more details.
If you’re still not sure about the rationale, I highly encourage reading the Rejected Ideas sections mentioned that explain the reasons for these choices, or if it would be more convenient (for you or anyone), I’m happy to summarize them in bullet point form here. I certainly would appreciate feedback on the flaws you find in that reasoning, points you see differently or things I haven’t yet considered.
Maybe I missed something somewhere when I re-read the thread (I did spend a lot of time doing so, haha), but as far as I’m aware, we haven’t yet discussed what exactly to do for the PEP 621 source metadata, aside from Paul mentioning that it should be added to the PEP. The current approach taken for the source metadata, among other things, most closely matches that agreed upon by all for the core metadata, though as mentioned I myself in fact first tried the exact approach @uranusjr suggested, and then the exact approach he suggested as a followup, and only afterward revised it when the multiple issues and downsides became apparent.
Yeah, but this is just a non-normative potential future suggestion, not part of the specification. That said, if having to revise the Hatch implementation would be a blocker to supporting this, I can offer my help; all other reasons aside, it might be around the same or less of my free time to revise the implementation than to do yet another big re-write to change this, assuming it would take <= a few hours in Hatch.
Hehe, well that was the main positive I cited for that approach. But the other practical problems it entails aside, particularly given the spirit, goal and motivation of this PEP, I strongly feel the value of explicitly, readably and unambiguously making it clear to authors, source code readers and tools that the key value is a license expression (and not the confusingly identically named license
key in setup.cfg, setup.py, or other tool config, or the License
field in core metadata) is worth the extra ≈2-3 seconds required once in a package’s lifetime to type 11 extra characters. After all, per the Zen of Python, “explicit is better than implicit”, “readability counts” and “in the face of ambiguity, resist the temptation to guess”. (Perhaps you could counter with “practicality beats purity”, though I’d argue naming a PEP 621 key the same as a totally different core metadata field than the one it maps too ain’t too practical )
Oh no! I’m mostly just providing feedback from an implementation POV since I’d posit I’m not the only one who misinterpreted the PEP 621 text/this thread.
I’m assuming Python will be around for many more decades so this is fundamentally my issue: say we get the future we want and everyone is only defining license-expression
, why impact UX in perpetuity? It’s small concessions like this that can add up to have an overall negative impact in time.
The vast majority of users do not know the underlying metadata implementation nor do they care (nor should they). They want everything to Just Work in the easiest possible way so they can get along with their day.
I’m happy this is finally happening though, so whatever is decided is more than fine with me!
edit: typo
Oh no, I don’t mean to imply you (or anyone) had misinterpreted it, sorry! What you suggest (and what I initially implemented) does seem to be roughly, what PEP 621 informally contemplated at the time, but reserved for this PEP to actually consider defining.
Mmhm, that’s a really interesting and thought-provoking point! We do want to keep the long future in mind (with the caveat that this spec, the ecosystem and its needs can also evolve too, such that we don’t want to solely optimize for it). From that perspective, the deprecation concerns with the license
key aren’t so important, and with a few changes and restrictions in the spec (including not backfilling the License
field, and specifying that the top-level license
key being specified automatically means that both License
and License-Expression
are not treated as dynamic
), the mixed fields, conversion and dynamic marking issues should mostly go away, at least within the PEP 621 world.
What’s left is weighing saving a couple seconds once per package (not trivial over all packages, true) against the increased clarity and reduced risk of confusion for authors, readers and consumers (especially new ones) who would benefit from knowing explicitly, readily and unambiguously, without having to guess, remember or dig through the spec/docs, that the value is a license expression—not just a single identifier, a license long name, the full license text, a license file path, free text, etc. From that viewpoint, I still find the latter more compelling overall, but its certainly a lot less decisive and more down to judgement whether we want to prioritize explicitness, readability and unambiguity over brevity.
Also, while it will eventually be removed in an unknown number of years, and weaned off for a few more, realistically I don’t think we can entirely ignore the potential confusion due to the license
key in setup.cfg
, setup.py
and other tool configuration having completely different syntax and semantics and maps to a whole different field than in PEP 621.
Yeah, I agree; you’re right that matching the underlying metadata fields (or even the keys used in other widely used tools) isn’t a particularly compelling reason on its own, and indeed several other PEP 621 keys have different names than either. I do think, though, this one is considerably more problematic since it has the exact same name as a different metadata field, and much more importantly, an existing config key used in most other existing tools for something quite different.
Sorry for the double post, but there actually is another, more serious issue with dynamic
and sticking License-Expression
under the same key as License
that I didn’t explicitly describe here on Discourse, but @domdfcoding reminded me of it with his helpful feedback on the PR —unless there’s a way around it that I haven’t thought of, it would mean that build tools would be prohibited from doing anything in the Converting legacy metadata
section unless the existing PEP 621 license
key, including both its text
and file
subkeys, were not only marked dynamic but not present at all (per the specified semantics of the dynamic
key), which prevents it from working at all for many/most existing PEP 621 users.
Also, on a related point that also got brought up there, if we require license
to be listed dynamic
to be backfilled (which, to be fair, causes some serious issues if it does need to be marked as such, to the point where it might be better not to allow backfilling at all), it is inherently mutually exclusive with using the existing license
key for license expressions, for the same reasons.
Or your PEP says license
is allowed to be back-filled (I’m not saying it’s a good idea specifically, but it’s an option).
Hey, thanks for the reply, and sorry for the confusing wording above—I edited the post to try to clarify. Basically, as of my PR, the PEP says that tools MAY backfill License
from License-Expression
, but (in PEP 621 project metadata), license
MUST NOT be marked dynamic if license-expression
is present (to prevent tools unaware of this specification filling it and producing conflicting metadata). Given there doesn’t seem to be a strong reason to not allow tools to do so, but I also haven’t seen a clear, compelling use case where it is strictly necessary, the PEP at present mostly leaves this as an option for tools, while requiring that they not produce conflicting metadata. This seems to be a reasonable balance that fits with the rest of the spec as it is currently, but I left it as an Open Issue to solicit any more feedback on this approach or potential alternatives.
Just to be clear, its originally @pombredanne 's PEP ; I’ve just been championing, updating and implementing what we’ve decided on it since we haven’t heard from him in a while. I reached out to him again through other channels to get his blessing for this and suggest that I be formally added as a co-author, so I can make sure I can officially help ensure his great work gets merged and implemented in tooling.