Open
Description
Describe the use case
The exec
hook has a downside compared to the console_scripts
hook — I have to either give a path to my virtual environment, or rely on it being found on PATH
.
In contrast, the console_scripts
hook doesn't need to do this because it uses sys.executable
to find the installed package – whether that's black
or something else.
All formatters/linters I'm aware of can be run using python -m <module>
, which is what the new hook would do using sys.executable
.
Databases / Backends / Drivers targeted
N/A
Example Use
hooks = ruff
ruff.type = module
ruff.module = ruff
ruff.options = format REVISION_SCRIPT_FILENAME
hooks = black
black.type = module
black.module = black
black.options = REVISION_SCRIPT_FILENAME
Additional context
PR incoming
Have a nice day!