Support for License-Expression field#465
Conversation
gaborbernat
left a comment
There was a problem hiding this comment.
You'll need to add test for your change 👍
for more information, see https://pre-commit.ci
|
Done |
kemzeb
left a comment
There was a problem hiding this comment.
Thanks for your contribution! The implementation and tests appear fine, but from testing I did notice the following:
pipdeptree --license -d 0
. . .
tox==4.24.1 (MIT, MIT License)
. . .
We have both the License-Expression and a Classifier field that represent the same license. I'm not sure if this is fine.
I think we could just use the License-Expression field if there are license classifiers also defined. Otherwise use the license classifiers.
Reading this section in the PEP, it explains that "if the License-Expression field is present, build tools MAY raise an error if one or more license classifiers is included in a Classifier field". Not too big of a fan of the use of "MAY", but in my opinion it is the responsibility of project maintainers to define their licenses correctly in their project metadata. To me it would be weird if some licenses were defined in one place and some in another.
|
No, it's not fine, judging by the fact that setuptools v77 doesn't allow you to install a package where license expression and license classifier are specified at the same time. I also think that only license expression should be returned if it is available. That's why I placed the code for getting it above the old code. Since you think the same, I've reworked the code. |
Allows to display a license for projects with a new License-Expression field. For example, pipdeptree itself.
https://peps.python.org/pep-0639/#add-license-expression-field