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

support check licences as pre-commit hook #107

Open
Niccolum opened this issue Aug 6, 2021 · 2 comments
Open

support check licences as pre-commit hook #107

Niccolum opened this issue Aug 6, 2021 · 2 comments

Comments

@Niccolum
Copy link

Niccolum commented Aug 6, 2021

No description provided.

@jmtatsch
Copy link

I tried to get this going:

https://github.com/jmtatsch/pip-licenses/blob/master/.pre-commit-hooks.yaml

and called from pre-commit like this:

-   repo: https://github.com/jmtatsch/pip-licenses
    rev: 0b6176619a8314c88e7817e3b51c59b1ffd4943a
    hooks:
    -   id: update-pip-licenses
        additional_dependencies: [prettytable]

However, the dependency prettytable doesn't seem to get installed correctly.

An unexpected error has occurred: CalledProcessError: command: ('/home/tatsch/.cache/pre-commit/repoijlcclt_/py_env-python3.10/bin/python', '-mpip', 'install', '.', 'prettytable')
return code: 1
stdout:
    Processing /home/tatsch/.cache/pre-commit/repoijlcclt_
      Preparing metadata (setup.py): started
      Preparing metadata (setup.py): finished with status 'error'
stderr:
      error: subprocess-exited-with-error
      
      × python setup.py egg_info did not run successfully.
      │ exit code: 1
      ╰─> [8 lines of output]
          Traceback (most recent call last):
            File "<string>", line 2, in <module>
            File "<pip-setuptools-caller>", line 34, in <module>
            File "/home/tatsch/.cache/pre-commit/repoijlcclt_/setup.py", line 34, in <module>
              from piplicenses import __author__ as AUTHOR
            File "/home/tatsch/.cache/pre-commit/repoijlcclt_/piplicenses.py", line 43, in <module>
              from prettytable import ALL as RULE_ALL
          ModuleNotFoundError: No module named 'prettytable'
          [end of output]
      
      note: This error originates from a subprocess, and is likely not a problem with pip.
    error: metadata-generation-failed
    
    × Encountered error while generating package metadata.
    ╰─> See above for output.
    
    note: This is an issue with the package mentioned above, not pip.
    hint: See above for details.
Check the log at /home/tatsch/.cache/pre-commit/pre-commit.log

Does anyone have an idea why this doesn't work?

@jmtatsch
Copy link

Ok, got a step further.
It runs pip-licenses but produces an empty output file.
Maybe because everything is running in a separated pre-commit environment?

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

No branches or pull requests

2 participants