-
Notifications
You must be signed in to change notification settings - Fork 1
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
License checker extensions #284
Conversation
Pull Request Test Coverage Report for Build 6354777482
💛 - Coveralls |
…to include regexps. Add a lot of licenses.
… line of run-license-checker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes look good and the tool in general looks super useful and extendable as needed
def simplify_license_versions(licenses_spec: str, *, for_package_name) -> str: | ||
m = _GPL_VERSION_CHOICE.match(licenses_spec) | ||
if m: | ||
version_a, version_b = m.groups() | ||
return f"GPL-{version_a}-or-{version_b}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could use some docstring as the function name reads like its generic but you've got some GPL specific things going on here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's true that it might not actually matter a lot if someone else used it. I can look at that.
dcicutils/license_utils.py
Outdated
@@ -646,6 +954,109 @@ class C4InfrastructureLicenseChecker(LicenseChecker): | |||
'Zope Public License', | |||
] | |||
|
|||
EXCEPTIONS = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be read from a file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to look into that. The trade-off is that these are really things that should be matters of fixed policy, at least insofar as the validator functions are, and people should not be thinking they can just casually edit this stuff to make it go away. It requires a lot of thought about legalities. But, that said, the command line form allows someone to explore whether they're compliant and to work toward getting things in order. For that it can be useful to evolve something and propose it as a coherent whole. So it's not a technical matter but a social, workflow, and legal issue. I'll do a little more functionality on that, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This got done and is now merged to this PR.
dcicutils/license_utils.py
Outdated
|
||
|
||
@LicenseCheckerRegistry.register_checker('scan2-pipeline') | ||
class Scan2PipelineLicenseChecker(ParkLabGplPipelineLicenseChecker): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain why this needs a separate class? Is this because it uses mixed software not living under one language?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We only have this one worked case of someone new working on things, but my definite sense from the experience is that this is one of those places where exceptions are the most likely. Every now and then you can make exceptions on a broad basis, like for docutils, because it's simply the nature of docutils that people mostly use those at dev time. But for other libraries, the thing is that you only know you can make an exception if the use is conforming because of how that particular repo uses something, like we know we only use it in some maintenance script and it's not part of the core library that gets delivered to pypi, or something like that. So I can't put that kind of exception in the main classes. But there could be some other place these are kept. Maybe someplace maintained by an employer or a corporate division (in our case dbmi or hms).
…driven License checker changes to make license support data-driven
…n called from code.
Some additions to license checkers.
run-license-checker
for people to use this without installing it in code.Having done this, though, we removed the
scan2-pipeline
policy definition because it can now be modularly added elsewhere, in that code. Such a definition can be added in an external module and then invoked interactively by:or from code by:
Note that if the conda checkers do not run, you may be in the wrong directory or Conda may not have set its
CONDA_PREFIX
environment variable. You can specify the directory by:or you can override the search for Conda's
CONDA_PREFIX
environment variable by setting theCONDA_LICENSE_CHECKER_PREFIX
environment variable, which can be used to overrideCONDA_PREFIX
.