pip-licenses
pip-licenses copied to clipboard
support check licences as pre-commit hook
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?
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?