Unable to determine how to use pre-existing virtualenv for a hook
See original GitHub issueSorry, I’m not sure if an issue is the right place to put this, but considering I’ve spent some time reading source and docs and haven’t found the answer it seems fair to consider this a documentation bug.
My use case is this: I have many Python projects I work on. Each one has its own virtualenv where I install the dependencies. I’d like to use pre-commit to run pylint. Pylint needs to run out of the same virtualenv as the project so that it can import the dependencies for its static analysis. When running the pylint hook from https://github.com/pre-commit/mirrors-pylint it appears that the command that is actually run is:
bash -c . '/Users/eliribble/.pre-commit/repoq_elftwa/py_env-default/bin/activate' && xargs -0 -s4000 pylint
Looking at the source and the docs I can’t find a way to indicate to the hook that it should use my virtualenv for the project rather than the virtualenv at /Users/eliribble/.pre-commit/repoq_elftwa/py_env-default
. Is there a way to do that?
Issue Analytics
- State:
- Created 8 years ago
- Comments:12 (7 by maintainers)
Top GitHub Comments
Yeah, I just didn’t want to mutate existing app’s env.
and again, pylint is a bit of a special snowflake here – it does both static analysis and dynamic analysis (which needs to actually import your code)