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

[FEATURE] Add comment to identified license if match is not perfect #303

Open
jaimergp opened this issue Feb 17, 2022 · 5 comments · Fixed by #305
Open

[FEATURE] Add comment to identified license if match is not perfect #303

jaimergp opened this issue Feb 17, 2022 · 5 comments · Fixed by #305
Labels
enhancement New feature or request feature good first issue Good for newcomers

Comments

@jaimergp
Copy link
Contributor

Is your feature request related to a problem? Please describe.
grayskull will identify licenses by fuzzy match in some cases and then suggest the best result. However, sometimes the fuzzy match scores a bit lower than average because some people modify popular licenses like BSD or MIT and add their own clauses. This kind of change will turn those into a different license altogether, which should be named as LicenseRef-packagename.

Describe the solution you'd like
I suggest:

  • Adding a comment next to the suggested identifier, saying that its match % was lower than usual license: MIT # warning! license might have been modified; search match is XX%.
  • If no clear license was found, generate a LicenseRef-packagename identifier with a comment next to it like # license could not be identified, please review.

Describe alternatives you've considered

Erroring out seems excessive.

Additional context

A recent example I found on a conda-forge submission.

@jaimergp jaimergp added enhancement New feature or request feature labels Feb 17, 2022
@marcelotrevisani
Copy link
Member

The match will never be perfect, so it will always need to add that comment

@marcelotrevisani
Copy link
Member

Reopening that just because it still needs to add the comment
But @ForgottenProgramme already added a warning about it. :)

@bilderbuchi
Copy link

It seems to me that grayskull should not put too weak assumptions into the generated recipe.

In my case, I'm running grayskull over an sdist with a proprietary license, but grayskull does

Matching license file with database from Grayskull...
Match percentage of the license is 9%. Low match percentage could mean that the license was modified.
License type: BSD-2-Clause
License file: ['LICENSE.txt']

and puts

about:
license: BSD-2-Clause
license_file: LICENSE.txt

into the recipe.

While of course the LICENSE.txt should be the final (correct) truth, putting this down as a BSD-2-Clause in the package metadata is very far away from the truth.
I think the second bullet above about what to do when no clear license could be identified is very relevant, I'd expect a license: LicenseRef-LICENSE.txt or similar in my case.

@bilderbuchi
Copy link

Additionally, I've found no way to override the license detector when invoking grayskull, which could be a stopgap measure to avoid putting wrong metadata in the recipe. Is there one already that I missed?

@bilderbuchi
Copy link

Additionally, I've found no way to override the license detector when invoking grayskull, which could be a stopgap measure to avoid putting wrong metadata in the recipe. Is there one already that I missed?

For anybody finding this in the future, one workaround I found when using conda build afterwards, one can use this option to override the wrong license entry with an appropriate file, so at least the built package is correct:

  --clobber-file CLOBBER_SECTIONS_FILE
                        Clobber data in meta.yaml with fields from this file. Jinja2 is not done on clobbered fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants