classification
Title: distutils check command: warn if license is specified in both the License and Classifier metadata fields
Type: enhancement Stage:
Components: Distutils Versions: Python 3.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: alexis, eric.araujo, kelsey.hightower, tarek
Priority: normal Keywords: easy

Created on 2011-02-16 03:22 by kelsey.hightower, last changed 2014-03-13 20:54 by eric.araujo.

Messages (10)
msg128624 - (view) Author: Kelsey (kelsey.hightower) Date: 2011-02-16 03:22
Distutils2 should produce a warning when the license is specified in both the License and Classifier metadata fields
msg128625 - (view) Author: Kelsey (kelsey.hightower) Date: 2011-02-16 03:25
Changes and additional tests can be reviewed on my patch queue.

https://bitbucket.org/khightower/distutils2-patch-queue/changeset/d7dff88ab524
msg128644 - (view) Author: Alexis Metaireau (alexis) * (Python triager) Date: 2011-02-16 10:36
Hi, 

I was more thinking about something like: if the license is specified in the "License" metadata, then check that it's not a well known license (which can and must be provided by the classifiers instead).

At the end, the code you've wrote is useful, but not complete.

Additionally, it seems that your patch make check complaining if you just have *defined* classifiers and license (even if the license is not provided in the classifiers: it complains if there is both defined, regardless what is defined). It should check instead if the classifier field contain the same thing than the license field.
msg128646 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-02-16 10:49
PEP 345 actually defines two fields that should be used only when a suitable Trove classifier does not exist:

> Platform (multiple use)
> A Platform specification describing an operating system supported by
> the distribution which is not listed in the "Operating System" Trove
> classifiers.

> License (optional)
> Text indicating the license covering the distribution where the
> license is not a selection from the "License" Trove classifiers. See
> "Classifier" below. This field may also be used to specify a
> particular version of a licencse which is named via the Classifier
> field, or to indicate a variation or exception to such a license.
msg128660 - (view) Author: Kelsey (kelsey.hightower) Date: 2011-02-16 11:47
Based on the feedback, I will rework the patch to include the following:

* Produce a warning only if the user supplied Platform or License metadata is listed in Trove classifiers (Exact match?).
msg128661 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-02-16 11:53
That’s not quite what the PEP says.  Please read it again and try to follow the text in your code.  Thanks for your work :)
msg128662 - (view) Author: Alexis Metaireau (alexis) * (Python triager) Date: 2011-02-16 11:57
That's almost what the PEP says, or at least what I understand of it.

The platform and license fields should be used only if no matching classifier exists for them.
msg128664 - (view) Author: Kelsey (kelsey.hightower) Date: 2011-02-16 12:06
Eric, I am not sure we can check for more than an exact match on Platform and License metadata fields.

D2 maintains a list of all Trove Classifiers which can be searched for an exact match; if a match is found warn the user that a Classifier should be used instead.
msg128694 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-02-16 20:39
> That's almost what the PEP says, or at least what I understand of it.
I’ve probably misused “not quite”; I meant “not exactly”.  Allow me to try to translate the PEP text to pseudo-code:

> Platform (multiple use)
> A Platform specification describing an operating system supported by
> the distribution which is not listed in the "Operating System" Trove
> classifiers.

if 'platform' in meta:
    if 'Operating System' in meta['classifiers']:
        warnings.append('the "platform" keyword duplicates the "Platform" classifier')
    else:
        warnings.append('using a "platform" keyword instead of a classifier, please make sure there is no classifier for this platform')

> License (optional)
> Text indicating the license covering the distribution where the
> license is not a selection from the "License" Trove classifiers. See
> "Classifier" below. This field may also be used to specify a
> particular version of a licencse which is named via the Classifier
> field, or to indicate a variation or exception to such a license.

if 'license' in meta:
    if 'License' in meta['classifiers']:
        warnings.append('using a "license" keyword with a "License" classifier, please make sure the keyword does not duplicate the classifier but precises it')
    else:
        warnings.append('using a "license" keyword instead of a classifier, please make sure there is no classifier for this license')


My pseudo-code assumes that meta['classifiers'].__contains__ can get all matching classifiers (for example all classifiers of the 'Operating System' category), not just perform exact matching against a list of strings.  I’ve just sent a message to the fellowship ML to brainstorm about a better data structure to model and work with classifiers; if we reach agreement, I’ll open another bug about that and make this one depend on the other.
msg128710 - (view) Author: Kelsey (kelsey.hightower) Date: 2011-02-17 03:21
Eric, thanks for the example. This clarifies things.

+1 on the new data structure for the classifiers
History
Date User Action Args
2014-03-13 20:54:27eric.araujosetkeywords: + easy
assignee: tarek ->
title: Produce a warning when the license is specified in both the License and Classifier metadata fields -> distutils check command: warn if license is specified in both the License and Classifier metadata fields
components: + Distutils, - Distutils2
versions: + Python 3.5, - 3rd party
2011-02-17 03:21:40kelsey.hightowersetnosy: tarek, eric.araujo, alexis, kelsey.hightower
messages: + msg128710
2011-02-16 20:39:33eric.araujosetnosy: tarek, eric.araujo, alexis, kelsey.hightower
messages: + msg128694
2011-02-16 12:06:00kelsey.hightowersetnosy: tarek, eric.araujo, alexis, kelsey.hightower
messages: + msg128664
2011-02-16 11:57:59alexissetnosy: tarek, eric.araujo, alexis, kelsey.hightower
messages: + msg128662
2011-02-16 11:53:11eric.araujosetnosy: tarek, eric.araujo, alexis, kelsey.hightower
messages: + msg128661
2011-02-16 11:47:03kelsey.hightowersetnosy: tarek, eric.araujo, alexis, kelsey.hightower
messages: + msg128660
2011-02-16 10:49:36eric.araujosetnosy: tarek, eric.araujo, alexis, kelsey.hightower
messages: + msg128646
2011-02-16 10:36:44alexissetnosy: tarek, eric.araujo, alexis, kelsey.hightower
messages: + msg128644
2011-02-16 03:25:42kelsey.hightowersetnosy: tarek, eric.araujo, alexis, kelsey.hightower
messages: + msg128625
2011-02-16 03:22:49kelsey.hightowercreate