Skip to content

feat: Use license-expression as fallback for license (PEP-639)#229

Closed
g3n35i5 wants to merge 1 commit into
raimon49:masterfrom
vorausrobotik:feat/use-license-expression-as-fallback
Closed

feat: Use license-expression as fallback for license (PEP-639)#229
g3n35i5 wants to merge 1 commit into
raimon49:masterfrom
vorausrobotik:feat/use-license-expression-as-fallback

Conversation

@g3n35i5

@g3n35i5 g3n35i5 commented Apr 4, 2025

Copy link
Copy Markdown
Contributor

PEP-639 allows declaring the license in the License-Expression metadata field. Using this as fallback fixes resolving the licenses of some packages, e.g. termcolor==3.0.1, prettytable==3.16.0 and typing_extensions==4.13.1

Verifying the change

pip-licenses -p prettytable typing-extensions termcolor -a -s -u -d -f json

Before

[
  {
    "Author": "Luke Maurits <luke@maurits.id.au>",
    "Description": "A simple Python library for easily displaying tabular data in a visually appealing ASCII table format",
    "License": "UNKNOWN",
    "Name": "prettytable",
    "URL": "https://github.com/prettytable/prettytable",
    "Version": "3.16.0"
  },
  {
    "Author": "Konstantin Lepa <konstantin.lepa@gmail.com>",
    "Description": "ANSI color formatting for output in terminal",
    "License": "UNKNOWN",
    "Name": "termcolor",
    "URL": "https://github.com/termcolor/termcolor",
    "Version": "3.0.1"
  },
  {
    "Author": "\"Guido van Rossum, Jukka Lehtosalo, \u0141ukasz Langa, Michael Lee\" <levkivskyi@gmail.com>",
    "Description": "Backported and Experimental Type Hints for Python 3.8+",
    "License": "UNKNOWN",
    "Name": "typing_extensions",
    "URL": "https://github.com/python/typing_extensions",
    "Version": "4.13.1"
  }
]

After

[
  {
    "Author": "Luke Maurits <luke@maurits.id.au>",
    "Description": "A simple Python library for easily displaying tabular data in a visually appealing ASCII table format",
    "License": "BSD-3-Clause",
    "Name": "prettytable",
    "URL": "https://github.com/prettytable/prettytable",
    "Version": "3.16.0"
  },
  {
    "Author": "Konstantin Lepa <konstantin.lepa@gmail.com>",
    "Description": "ANSI color formatting for output in terminal",
    "License": "MIT",
    "Name": "termcolor",
    "URL": "https://github.com/termcolor/termcolor",
    "Version": "3.0.1"
  },
  {
    "Author": "\"Guido van Rossum, Jukka Lehtosalo, \u0141ukasz Langa, Michael Lee\" <levkivskyi@gmail.com>",
    "Description": "Backported and Experimental Type Hints for Python 3.8+",
    "License": "PSF-2.0",
    "Name": "typing_extensions",
    "URL": "https://github.com/python/typing_extensions",
    "Version": "4.13.1"
  }
]

This resolves #225
This relates to #89

[PEP-639](https://peps.python.org/pep-0639/) allows declaring the license
in the `License-Expression` metadata field. Using this as fallback fixes
resolving the licenses of some packages, e.g. `termcolor==3.0.1`,
`prettytable==3.16.0` and `typing_extensions==4.13.1`

**Verifying the change**
```bash
pip-licenses -p prettytable typing-extensions termcolor -a -s -u -d -f json
```

Before
```json
[
  {
    "Author": "Luke Maurits <luke@maurits.id.au>",
    "Description": "A simple Python library for easily displaying tabular data in a visually appealing ASCII table format",
    "License": "UNKNOWN",
    "Name": "prettytable",
    "URL": "https://github.com/prettytable/prettytable",
    "Version": "3.16.0"
  },
  {
    "Author": "Konstantin Lepa <konstantin.lepa@gmail.com>",
    "Description": "ANSI color formatting for output in terminal",
    "License": "UNKNOWN",
    "Name": "termcolor",
    "URL": "https://github.com/termcolor/termcolor",
    "Version": "3.0.1"
  },
  {
    "Author": "\"Guido van Rossum, Jukka Lehtosalo, \u0141ukasz Langa, Michael Lee\" <levkivskyi@gmail.com>",
    "Description": "Backported and Experimental Type Hints for Python 3.8+",
    "License": "UNKNOWN",
    "Name": "typing_extensions",
    "URL": "https://github.com/python/typing_extensions",
    "Version": "4.13.1"
  }
]
```

**After**
```json
[
  {
    "Author": "Luke Maurits <luke@maurits.id.au>",
    "Description": "A simple Python library for easily displaying tabular data in a visually appealing ASCII table format",
    "License": "BSD-3-Clause",
    "Name": "prettytable",
    "URL": "https://github.com/prettytable/prettytable",
    "Version": "3.16.0"
  },
  {
    "Author": "Konstantin Lepa <konstantin.lepa@gmail.com>",
    "Description": "ANSI color formatting for output in terminal",
    "License": "MIT",
    "Name": "termcolor",
    "URL": "https://github.com/termcolor/termcolor",
    "Version": "3.0.1"
  },
  {
    "Author": "\"Guido van Rossum, Jukka Lehtosalo, \u0141ukasz Langa, Michael Lee\" <levkivskyi@gmail.com>",
    "Description": "Backported and Experimental Type Hints for Python 3.8+",
    "License": "PSF-2.0",
    "Name": "typing_extensions",
    "URL": "https://github.com/python/typing_extensions",
    "Version": "4.13.1"
  }
]
```
@g3n35i5
g3n35i5 marked this pull request as ready for review April 4, 2025 18:15
@codecov

codecov Bot commented Apr 4, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.13%. Comparing base (3fbf20f) to head (9505066).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #229   +/-   ##
=======================================
  Coverage   99.13%   99.13%           
=======================================
  Files           1        1           
  Lines         462      462           
=======================================
  Hits          458      458           
  Misses          4        4           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@stefan6419846

Copy link
Copy Markdown

Duplicate of #213.

@g3n35i5

g3n35i5 commented Apr 4, 2025

Copy link
Copy Markdown
Contributor Author

Oops my bad

@g3n35i5 g3n35i5 closed this Apr 4, 2025
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.

request: support PEP 639

2 participants