How to use flake8 plugins with pre-commit
See original GitHub issueflake8 plugins are usually distributed through a standalone python package on PyPI, e.g. flake8-print
flake8-docstring
.
In theory, I can locate where pre-commit’s venv is and install plugin packages into that venv by myself, but it’s really hacky and hard to be deterministically done for all other teammates and CI.
Does pre-commit provide some kind of mechanism to install extra packages into the venv it creates?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Using Version Control Hooks — flake8 6.0.0 documentation
pre-commit creates an isolated environment for hooks. To use ; flake8 plugins, use the ; additional_dependencies setting.
Read more >Correctly using pre-commit with flake8 plugins - Stack Overflow
Running it from local , the versions of the plugins are managed by poetry, and can be easily modified in pyproject.toml while locking...
Read more >Automate Python workflow using pre-commits: black and flake8
The pre-commit Python framework · Install pre-commit: pip install pre-commit · Add pre-commit to requirements.txt (or requirements-dev.txt ) ...
Read more >Automated linting with flake8 and pre-commit hooks
Using a pre-commit Git hook is an excellent way of maintaining ... e.g. through a vim plugin, or a Git pre-commit hook, checking...
Read more >How to setup your project with pre-commit, black, and flake8
Now that we have the proper files in place we can start using pre-commit to run black and flake8 git hooks. Create a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You’re looking for
additional_dependencies
.Please excuse me for commenting on a closed ticket but I have a question that is related to this issue and you hopefully can clear up easily.
Right now, our flake8 version-pins that we have in
requirements.txt
are duplicated in.pre-commit-config.yaml
(see below). How do you make sure that they’re not getting out of sync?A perhaps more elegant solution could be to use a repository local hook. That way, no
additional_dependencies
need to be specified. The problem with this approach is that I’d need to hardcode the path to the projects virtualenv into.pre-commit-config.yaml
and this path is not necessarily the same on my colleagues computers.Is there an easy solution to this that i’m overlooking?