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

Provide hints when an invalid license id is input #1634

Merged
merged 1 commit into from Jun 21, 2020

Conversation

JJJollyjim
Copy link
Contributor

@JJJollyjim JJJollyjim commented Nov 26, 2019

  • Added tests for changed code.
  • [n/a?] Updated documentation for changed code.

Currently, the poetry new/init license field can be a little opaque to new users -- here is the actual output from my first time using poetry a few hours ago:

This command will guide you through creating your pyproject.toml config.

Package name [projects]: attoate  
Version [0.1.0]: 
Description []: 
Author [Jamie McClymont <jamie@kwiius.com>, n to skip]: 
License []: GPLv3+ 
 Invalid license id: GPLv3+ 
License []: help
 Invalid license id: help 
License []: ?
 Invalid license id: ? 
License []: gpl-3-or-later
 Invalid license id: gpl-3-or-later 
License []: ?
 Invalid license id: ? 

-------- Some googling later --------

License []: GPL-3.0-or-later

This PR improves the error message to show a link to the SPDX license list, and in common cases, a best-effort guess at which license ids you might be looking for. For example:

invalid license id: some-wacky-license
Poetry uses SPDX license identifiers: https://spdx.org/licenses/

Or, if a common license id is recognised:

Invalid license id: that one from the apache web server
Poetry uses SPDX license identifiers: https://spdx.org/licenses/
Did you mean one of the following?
 * Apache-1.0
 * Apache-1.1
 * Apache-2.0

I'm not a python dev (as evidenced by the fact I didn't know what a license id was :P), feedback is welcome :)

Copy link
Member

@finswimmer finswimmer left a comment

Hello @JJJollyjim ,

thanks a lot for this improvement of the user experience. I really like it!

I think it is ok if we integrate it into the master branch. Could your rebase your commit on that branch?

fin swimmer

@JJJollyjim JJJollyjim changed the base branch from develop to master Dec 19, 2019
@JJJollyjim
Copy link
Contributor Author

@JJJollyjim JJJollyjim commented Dec 19, 2019

Done, I believe :)

finswimmer
finswimmer previously approved these changes Dec 19, 2019
Copy link
Member

@finswimmer finswimmer left a comment

Perfect!

@finswimmer finswimmer added the Error Handling label Dec 23, 2019
@finswimmer finswimmer requested a review from sdispater Jan 5, 2020
sdispater
sdispater previously requested changes Jan 6, 2020
poetry/spdx/__init__.py Outdated Show resolved Hide resolved
@JJJollyjim
Copy link
Contributor Author

@JJJollyjim JJJollyjim commented Feb 8, 2020

Anything else I can do on this?

@brechtm
Copy link

@brechtm brechtm commented Jun 18, 2020

This message is just a friendly reminder, since this PR seems ready to be included.

@finswimmer
Copy link
Member

@finswimmer finswimmer commented Jun 20, 2020

@JJJollyjim may I ask you to add a minor change and push again, so that the checks will run again? Afterwards I will be able to merge it.

@finswimmer finswimmer self-requested a review Jun 20, 2020
Copy link
Member

@finswimmer finswimmer left a comment

Great. Thanks a lot 👍

@finswimmer finswimmer removed the request for review from sdispater Jun 21, 2020
@finswimmer finswimmer dismissed sdispater’s stale review Jun 21, 2020

change is included

@finswimmer finswimmer merged commit cd6da2c into python-poetry:master Jun 21, 2020
16 checks passed
@sdispater sdispater mentioned this pull request Jul 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error Handling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants