-
-
Notifications
You must be signed in to change notification settings - Fork 162
Description
Summary
The behavior of repo: local between pre-commit and prek is different
In prek, the cwd during virtualenv installation of repo: local is the current repo.
In pre-commit, the cwd during virtualenv installation of repo: local is a pseudo repo.
For repo: local,
The pre-commit creates pseudo directory inside ~/.cache/pre-commit,
with pseduo setup scripts, such as setup.py
from setuptools import setup
setup(name='pre-commit-placeholder-package', version='0.0.0', py_modules=[])
During the installation of virtualenv, the cwd is inside that pseudo directory,
so that specify . in additional_dependencies does not work in the same way as many people expected,
and so specify python extra dependencies like .[foo] does not work either.
I think this is a good design of pre-commit that should be maintained,
that need to ensure additional_dependencies: does not depend on the content of local repository,
otherwise it is not safe to reuse the cached virtualenv, as the content of local repository may change.
Platform
Linux 6.6.87.2-microsoft-standard-WSL2 x86_64 GNU/Linux
Version
prek 0.3.2
.pre-commit-config.yaml
repos:
- repo: local
hooks:- id: pseudo-hook-additional-dep-is-dot
name: Additional Dependencies Is Dot
entry: "true"
language: python
stages: [pre-commit]
additional_dependencies:- .
- id: pseudo-hook-additional-dep-is-dot
Log file
Not needed