pre-commit hook requires deptry to be globally installed
kumekay opened this issue · 2 comments
kumekay commented
Describe the bug
We run pre-commit for all changes in a merge request in GitLab CI. pre-commit
is the only python package-
pre-commit hook requires deptry to be globally installed.
To Reproduce
Steps to reproduce the behavior:
- Create
.pre-commit-config.yml
like:
repos:
- repo: https://github.com/fpgmaas/deptry.git
rev: "0.11.0"
hooks:
- id: deptry
- Install the only package
pip install pre-commit
- Make some changes in python code and stage changes
- Run
pre-commit
- An error will be returned
[INFO] Initializing environment for https://github.com/fpgmaas/deptry.git.
deptry.................................................................................................Failed
- hook id: deptry
- exit code: 1
Executable `deptry` not found
Expected behavior
Pre-commit installs dependencies by itself.
System [please complete the following information]:
- OS: e.g. [Debian bullseye]
- Language Version: [Python 3.10]
- Poetry version: NA
Additional context
fpgmaas commented
Hi @kumekay, thanks for raising the issue! deptry
does not need to be installed globally, but it does need to be installed within the virtual environment of the project. pre-commit
creates it's own virtual environment, and thus AFAIK the approach proposed in #415 will not work.
See also the discussion here for more information: #124 (comment)