Skip to content

Add "module" post-write hook #1686

Open
@RazerM

Description

@RazerM

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    requires triageNew issue that requires categorizationuse casenot quite a feature and not quite a bug, something we just didn't think of

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions