Skip to content

Instantly share code, notes, and snippets.

@hugovk
Last active September 14, 2025 15:30
Show Gist options
  • Select an option

  • Save hugovk/d601e651e08d229714a86fb5b04bc6c9 to your computer and use it in GitHub Desktop.

Select an option

Save hugovk/d601e651e08d229714a86fb5b04bc6c9 to your computer and use it in GitHub Desktop.
Run "prek install" in all subdirectories with a .pre-commit-config.yaml
"""
uv run https://gist.github.com/hugovk/d601e651e08d229714a86fb5b04bc6c9
"""
import subprocess
from pathlib import Path
for directory in sorted(Path(".").iterdir(), key=lambda x: x.name.lower()):
if directory.is_dir() and (directory / ".pre-commit-config.yaml").is_file():
print(directory)
subprocess.run(
["prek", "install", "--allow-missing-config"], cwd=directory, check=True
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment