Skip to content

try-repo doesn't utilize already existing environment #1309

@ulgens

Description

@ulgens

Summary

I'm developing a tool and I need to test it while developing. Initially, I was setting up the .pre-commit-config.yaml file to use the latest commit in the repo:

  - repo: .
    rev: <commit_hash>
    hooks:
        ...

This approach installs the referenced commit in the first call, and the next calls uses the installed env and runs instantly.

Then I found out try-repo exists,

prek try-repo . -v --all-files

Install the hooks every time I call the command, even when nothing has changed. From the command's output, it looks like prek creates a new environment for each call and doesn't reuse the previous one. The following fragmants are extracted from consequent calls with no change in the repo:

- repo: .../.cache/prek/scratch/try-repo-H9WAQM/shadow-repo
- repo: .../.cache/prek/scratch/try-repo-Q3ywIR/shadow-repo
- repo: .../.cache/prek/scratch/try-repo-SLeW5H/shadow-repo

This adds an extra ~5 seconds to each run in my case. While creating a new env, I believe it also installs additional_dependencies from scratch.

This makes development process slower than it should be, and it becomes frustrating very quickly when you are trying to get quick results.

Platform

macOS 15.7 / Darwin 24.6.0 arm64

Version

0.2.25

.pre-commit-config.yaml

No response

Log file

No response

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