Skip to content

Make it easier to run pre-commit hooks #549

@hombit

Description

@hombit

Currently "jupyter-nb-clear-output", "pylint", "mypy" (see also #531), "sphinx-build", and "pytest" pre-commit hooks assume that a Python environment with numerous Python executables is activated. It causes two sorts of problems: 1) CI and local versions of packages may be different, making runs inconsistent, and 2) in some cases, it is tricky to have the right environment active when git commit is being run, e.g., in an IDE, or when using uv-based setup without an active environment (i.e., via uv run pytest instead of python -m pytest, etc.).

It is a multi-factor problem, and maybe a solution is excluding some slow and environment-dependent hooks, such as pytest and sphinx-build, entirely, while switching to pre-commit-controlled environments for things like jupyter-nb-clear-output, pylint, and mypy.

This is based on observations of the problems people have in the team and external users: a lot of people do not run pre-commit because it is slow, or because of mypy's inconsistent behavior, or because they didn't install Sphinx dependencies and sphinx-build fails even if they haven't touched any code or documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions