clearlydefined / clearlydefined/crawler

QUESTION: Rationale for classifiers taking precedence over license info

Open
#523 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
60
Forks
38
Avg merge
1h 49m
Merged PRs (30d)
1

Description

### Description

It appears that for pypi, classifiers take precedence over the license field when extracting the license information. It is clear from the code how this is happening. I'm wondering about the rationale for this approach. Also if it is determined that one is correct and the other is not, is there a process for updating the license or the classifier as needed?

### Test

```
it('parses the correct license information from classifiers in registry data', () => {
const registryData = JSON.parse(fs.readFileSync('test/fixtures/pypi/registryData_lgpl2.json'))
const declared = fetch._extractDeclaredLicense(registryData)
expect(declared).to.be.equal('LGPL-2.0-only')
})
```

### Fixture Data

[classifiers](https://github.com/clearlydefined/crawler/blob/a28303b6f729fbd2a61c38eb44c5f57402396bcc/test/fixtures/pypi/registryData_lgpl2.json#L6-L21)

```
"classifiers": [
...
"License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)",
...
],
```

[license](https://github.com/clearlydefined/crawler/blob/a28303b6f729fbd2a61c38eb44c5f57402396bcc/test/fixtures/pypi/registryData_lgpl2.json#L33)

```
"license": "LGPL 2.1",
```

### Expected

With a specific license given in `info.license`, I would expect the license to be either `LGPL-2.0-or-later` or `LGPL-2.1-only`.

### Actual

Precedence is given to classifiers in [function _extractDeclaredLicense](https://github.com/clearlydefined/crawler/blob/master/providers/fetch/pypiFetch.js#L89-L94), which produces license `LGPL-2.0-only`.

```
_extractDeclaredLicense(registryData) {
const licenseFromClassifiers = this._extractLicenseFromClassifiers(registryData)
if (licenseFromClassifiers) return licenseFromClassifiers
const license = get(registryData, 'info.license')
return license && spdxCorrect(license)
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.