Skip to content

Commit 81cc2f2

Browse files
committed
Add hooks/ and scripts/ for auto-wiring pre-commit
1 parent dcf6c3d commit 81cc2f2

File tree

7 files changed

+25
-42
lines changed

7 files changed

+25
-42
lines changed

cookiecutter.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"project_name": "My Project Name",
3+
"project_slug": "{{ cookiecutter.project_name.lower().replace(' ', '_') }}",
4+
"author_name": "Your Name",
5+
"author_email": "[email protected]",
6+
"description": "A short description of the project",
7+
"python_version": "3.11"
8+
}

hooks/post_gen_project.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env python3
2+
import subprocess, sys
3+
4+
def main():
5+
try:
6+
subprocess.check_call(["pre-commit", "install", "--install-hooks"])
7+
print("✅ pre-commit hooks installed")
8+
except subprocess.CalledProcessError as e:
9+
print("❌ pre-commit install failed:", e)
10+
sys.exit(1)
11+
12+
if __name__ == "__main__":
13+
main()

scripts/install_hooks.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
echo "🔧 Installing/updating pre-commit hooks…"
4+
pre-commit install --install-hooks

src/my_package/__init__.py

Whitespace-only changes.

src/my_package/main.py

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/my_package/my_cli.py

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/my_package/rich_demo.py

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)