Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add license to package installation metadata #705

Merged
merged 1 commit into from Apr 12, 2021

Conversation

RobbeSneyders
Copy link
Contributor

This PR adds the license name to the package installation metadata so it can be checked automatically with importlib.metadata. We automatically check the license of all our dependencies this way, and bandit currently fails since it returns "UNKNOWN".

@lukehinds lukehinds merged commit 0e23506 into PyCQA:master Apr 12, 2021
Copy link
Member

@ericwb ericwb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://packaging.python.org/specifications/core-metadata/#license

This field is to denote licenses that differ from the License Trove classifiers. It's also used to distinguish a particular version. Since our classifier just notes as Apache Software License, this field is properly adding the 2.0 context.

@@ -6,6 +6,7 @@ description-file =
author = PyCQA
author-email = code-quality@python.org
home-page = https://bandit.readthedocs.io/en/latest/
license = Apache-2.0 license
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I remember later. According to https://packaging.python.org/specifications/core-metadata/#license, this field is to denote licenses that differ from the License Trove classifiers. It's also used to distinguish a particular version. Since our classifier just notes as Apache Software License, this field is properly adding the 2.0 context.

@ericwb
Copy link
Member

ericwb commented Apr 12, 2021

Please see my comments above. Although this fix is approved, it has nothing to do with a tool that shows UNKNOWN for the license. A separate bug should be opened on that tool as it is incorrectly determining licenses.

@lukehinds
Copy link
Member

Please see my comments above. Although this fix is approved, it has nothing to do with a tool that shows UNKNOWN for the license. A separate bug should be opened on that tool as it is incorrectly determining licenses.

Good catch, I did not know about the trove classifiers, does need to be reverted?

@ericwb
Copy link
Member

ericwb commented Apr 12, 2021

Please see my comments above. Although this fix is approved, it has nothing to do with a tool that shows UNKNOWN for the license. A separate bug should be opened on that tool as it is incorrectly determining licenses.

Good catch, I did not know about the trove classifiers, does need to be reverted?

No need to revert. It's fine to included a version in this example, but not for the reasons stated in the PR. Any code looking for a license should start with the classifiers, then this license field. Using importlib.metadata and only looking at "license" is the incorrect way of determining a license for a Python module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants