This release is a pre-release and may not be stable for production use.
Run pre-commit hook entry. Allow to run pre-commit hooks for text editor formatting / linting needs.
Danger Zone
IMPORTANT: This is highly experimental tool as pre-commit internals does not intend to be used in other scripts. It might be broken after new pre-commit release.
TO USE WITH CAUTION!
Requirements
Python 3.9 or later
pre-commit 4.0 or later
License
pre-commit-run-hook-entry is licensed under the terms of BSD-3-Clause license.
Installation
pip install pre-commit-run-hook-entry
Usage
pre-commit-run-hook-entry HOOK [ARGS]
pre-commit-which-hook-entry HOOK
Prerequisites
pre-commit-run-hook-entry only works in directories, where pre-commit run --all HOOK is executable.
pre-commit Versions Support
pre-commit-run-hook-entry version |
pre-commit version |
|---|---|
1.0.0b0 or lower |
3.8.0 or lower |
1.0.0rc0 or higher |
4.0.0 or higher |
VS Code Integration
Example below illustrates how to configure VS Code to use black, flake8 & mypy pre-commit hooks for formatting & linting,
{
"python.formatting.provider": "black",
"python.formatting.blackPath": "pre-commit-run-hook-entry",
"python.formatting.blackArgs": ["black"],
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.linting.flake8Path": "pre-commit-run-hook-entry",
"python.linting.flake8Args": ["flake8"],
"python.linting.mypyEnabled": true,
"python.linting.mypyPath": "pre-commit-run-hook-entry",
"python.linting.mypyArgs": ["mypy"]
}
Sublime Text 3 Integration
isorted
{
"isorted.isort_command": ["pre-commit-run-hook-entry", "isort"]
}
sublack
From one point sublack has builtin pre-commit integration, but it seems do not respect settings from pyproject.toml, to fix this use pre-commit-run-black-entry as sublack.black_command,
{
"sublack.black_command": "pre-commit-run-black-entry"
}
SublimeLinter-flake8
{
"SublimeLinter.linters.flake8.executable": "pre-commit-run-hook-entry",
"SublimeLinter.linters.flake8.args": ["--", "flake8"]
}
SublimeLinter-contrib-mypy
{
"SublimeLinter.linters.mypy.executable": "pre-commit-run-hook-entry",
"SublimeLinter.linters.mypy.args": ["--", "mypy"]
}
SublimeJsPrettier
First, you need to find out path to prettier hook entry with,
pre-commit-which-hook-entry prettier
Then, paste command output (<OUTPUT>) into plugin config,
{
"js_prettier": {
"prettier_cli_path": "<OUTPUT>"
}
}
SublimeLinter-eslint
First, you need to find out path to eslint hook entry with,
pre-commit-which-hook-entry eslint
Then, paste command output (<OUTPUT>) into plugin config,
{
"SublimeLinter.linters.eslint.executable": "<OUTPUT>",
"SublimeLinter.linters.eslint.env": {
"NODE_PATH": "<OUTPUT>/../../lib/node_modules"
}
}
IMPORTANT: If you’re using any additionalDependencies for eslint hook, you need to configure NODE_PATH, so plugin will be able to find out given dependencies.
Issues & Feature Requests
Feel free to submit new issue or feature request at GitHub
Release files for pre-commit-run-hook-entry 1.0.0rc0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pre_commit_run_hook_entry-1.0.0rc0.tar.gz | 7.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pre_commit_run_hook_entry-1.0.0rc0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.9 kB
Release files / pre_commit_run_hook_entry-1.0.0rc0.tar.gz
| Download URL | pre_commit_run_hook_entry-1.0.0rc0.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e3f9d45cba69698d9ad21f711170d18eee5ab974f8d6d769e9ad77cc658a66f2
|
|
BLAKE2b-256 checksum How to use checksums |
34f00e427b7028624842c8cb86f7dd8345fb23feda8d551a8ce918c7f5633bea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Release files / pre_commit_run_hook_entry-1.0.0rc0-py3-none-any.whl
| Download URL | pre_commit_run_hook_entry-1.0.0rc0-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9a7e5e3e89490538e3f17f571492a5282b1db97522d62b63e1bf3ef4fd8a3878
|
|
BLAKE2b-256 checksum How to use checksums |
c1d96a21eed2ff2fb262321fe1f5db27060adda55483f8db307e3e4d2135354f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|