Skip to content

prek install fails to install all configured hook types #1774

@stewartadam

Description

@stewartadam

Summary

prek install always installs only the pre-commit hook, even if the prek/pre-commit configuration has other hook types like pre-commit and pre-push.

I suggest prek install install hooks for all configured hooks in the configuration file, which is closer to what users will expect but does diverse from pre-commit behavior. If prek aims for 100% compatibility then pehaps a new CLI flag can be introduced like -t auto.

Willing to submit a PR?

  • Yes — I’m willing to open a PR to fix this.

Platform

MacOS 15

Version

prek 0.3.5 (46cb7ba 2026-03-09)

.pre-commit-config.yaml

# Pre-commit configuration for multi-package repository with uv

repos:
  - repo: https://github.com/scop/pre-commit-shfmt
    rev: v3.10.0-2
    hooks:
      - id: shfmt
        args: [--diff]

  # strip output from notebooks
  - repo: https://github.com/kynan/nbstripout
    rev: 0.8.1
    hooks:
      - id: nbstripout
        args: [--verify]

  # Ruff linting - runs separately from formatting
  # Each package uses its own pyproject.toml configuration
  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.14.0
    hooks:
      # Run the linter.
      - id: ruff-check
        types_or: [python, pyi, jupyter]

      # Run the formatter.
      - id: ruff-format
        types_or: [python, pyi, jupyter]

  - repo: https://github.com/astral-sh/uv-pre-commit
    # uv version.
    rev: 0.5.22
    hooks:
      # Update the uv lockfile
      - id: uv-lock

  - repo: https://github.com/adrienverge/yamllint.git
    rev: v1.29.0
    hooks:
      - id: yamllint

  - repo: local
    hooks:
      # python tests
      - id: pytest
        name: pytest
        stages: ["pre-push"]
        language: system
        types: [python]
        pass_filenames: false
        entry: uv run pytest

Log file

2026-03-10T20:36:10.981322Z DEBUG prek: 0.3.5 (46cb7bad1 2026-03-09)
2026-03-10T20:36:10.981512Z DEBUG Args: ["prek", "-vvv", "install"]
2026-03-10T20:36:10.981745Z TRACE Executing `/opt/homebrew/bin/git config --get core.hooksPath`
2026-03-10T20:36:10.992814Z TRACE Executing `/opt/homebrew/bin/git config --get core.sharedRepository`
2026-03-10T20:36:11.012780Z TRACE get_root: close time.busy=9.23ms time.idle=4.96µs
2026-03-10T20:36:11.012916Z DEBUG Git root: /Users/stewartadam/my-project
2026-03-10T20:36:11.012964Z DEBUG Found workspace root at `/Users/stewartadam/my-project`
2026-03-10T20:36:11.012977Z DEBUG Found project root at ``
2026-03-10T20:36:11.013008Z DEBUG Loading project configuration path=.pre-commit-config.yaml
2026-03-10T20:36:11.015005Z TRACE Executing `/opt/homebrew/bin/git rev-parse --git-common-dir`
2026-03-10T20:36:11.022618Z TRACE Include selectors: ``
2026-03-10T20:36:11.022668Z TRACE Skip selectors: ``
prek installed at `/Users/stewartadam/my-project/.git/hooks/pre-commit

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions