3

I'm setting up a python project for my team using pipenv, I've installed the pre-commit library in the Pipfile and when a new developer clone my repo and runs pipenv install then the pre-commit doesn't work. It's necessary to run pre-commit install and pre-commit run --all-files to make it work.

this is my .pre-commit-config.yaml file that I want to run in pre-commit.

repos:
-   repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v1.4.0
    hooks:
    -   id: trailing-whitespace
    -   id: end-of-file-fixer
    -   id: check-json
    -   id: requirements-txt-fixer
    -   id: flake8
        exclude: migrations
-   repo: local
    hooks:
    -   id: system
        name: PyLint
        entry: python -m pylint.__main__
        language: system
        files: \.py$
        exclude: migrations

There is a way to run the pre-commit after a clean pipenv install and avoid to run pre-commit install and pre-commit run?

Hernan Acosta
  • 377
  • 5
  • 19
  • 3
    `pre-commit run` shouldn't be necessary to make it work -- are you asking for a way to automate `pre-commit install`? maybe [`pre-commit init-templatedir`](https://pre-commit.com/#automatically-enabling-pre-commit-on-repositories) would be helpful? – anthony sottile Sep 03 '19 at 00:10
  • Script hooks for pipenv are already discussed at github. https://github.com/pypa/pipenv/issues/2817 – krema Jul 21 '21 at 09:45

0 Answers0