File tree Expand file tree Collapse file tree 4 files changed +102
-2
lines changed Expand file tree Collapse file tree 4 files changed +102
-2
lines changed Original file line number Diff line number Diff line change
1
+ # See https://pre-commit.com for more information
2
+ repos :
3
+ - repo : https://github.com/astral-sh/ruff-pre-commit
4
+ rev : v0.8.4
5
+ hooks :
6
+ # Run the linter
7
+ - id : ruff
8
+ args : [--fix]
9
+ # Run the formatter
10
+ - id : ruff-format
11
+
12
+ - repo : https://github.com/pre-commit/pre-commit-hooks
13
+ rev : v5.0.0
14
+ hooks :
15
+ - id : trailing-whitespace
16
+ - id : end-of-file-fixer
17
+ - id : check-yaml
18
+ - id : check-added-large-files
19
+ - id : check-json
20
+ - id : check-toml
21
+ - id : check-merge-conflict
22
+ - id : debug-statements
23
+ language_version : python3.13
24
+
25
+ - repo : https://github.com/pre-commit/mirrors-mypy
26
+ rev : v1.14.1
27
+ hooks :
28
+ - id : mypy
29
+ additional_dependencies : [types-requests]
30
+ args : [--ignore-missing-imports]
31
+ files : ^src/
Original file line number Diff line number Diff line change @@ -35,8 +35,11 @@ dependencies = [
35
35
dev = [
36
36
" pytest>=8.0" ,
37
37
" pytest-cov>=4.0" ,
38
- " pytest-anyio >=0.21" ,
38
+ " pytest-asyncio >=0.21" ,
39
39
" python-dotenv>=1.0.0" ,
40
+ " pre-commit>=3.5.0" ,
41
+ " ruff>=0.8.0" ,
42
+ " mypy>=1.14.0" ,
40
43
]
41
44
42
45
[project .urls ]
@@ -90,4 +93,4 @@ python_version = "3.13"
90
93
warn_return_any = true
91
94
warn_unused_configs = true
92
95
disallow_untyped_defs = false
93
- ignore_missing_imports = true
96
+ ignore_missing_imports = true
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # Setup script for pre-commit hooks
3
+
4
+ echo " 🔧 Setting up pre-commit hooks for code formatting..."
5
+
6
+ # Install pre-commit if in virtual environment
7
+ if [[ " $VIRTUAL_ENV " != " " ]]; then
8
+ echo " ✓ Virtual environment detected"
9
+ else
10
+ echo " ⚠️ No virtual environment detected. It's recommended to use one."
11
+ echo " Run: python3 -m venv .venv && source .venv/bin/activate"
12
+ read -p " Continue anyway? (y/N) " -n 1 -r
13
+ echo
14
+ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
15
+ exit 1
16
+ fi
17
+ fi
18
+
19
+ # Install dev dependencies
20
+ echo " 📦 Installing development dependencies..."
21
+ pip install -e " .[dev]"
22
+
23
+ # Install pre-commit hooks
24
+ echo " 🪝 Installing pre-commit hooks..."
25
+ pre-commit install
26
+
27
+ # Run against all files for the first time (optional)
28
+ echo " 🧹 Running formatters on all files..."
29
+ pre-commit run --all-files || true
30
+
31
+ echo " ✅ Setup complete!"
32
+ echo " "
33
+ echo " Now ruff will automatically:"
34
+ echo " - Format your code on every commit"
35
+ echo " - Fix common linting issues"
36
+ echo " - Ensure consistent code style"
37
+ echo " "
38
+ echo " To manually run formatters: pre-commit run --all-files"
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # Setup script for pre-commit hooks
3
+
4
+ echo " Setting up pre-commit hooks for divine-thegraph-token-api..."
5
+
6
+ # Install dev dependencies (including pre-commit)
7
+ echo " Installing dev dependencies..."
8
+ pip install -e " .[dev]"
9
+
10
+ # Install pre-commit hooks
11
+ echo " Installing pre-commit hooks..."
12
+ pre-commit install
13
+
14
+ # Run pre-commit on all files to show what it will do
15
+ echo " Running pre-commit on all files (this will show and fix any formatting issues)..."
16
+ pre-commit run --all-files
17
+
18
+ echo " "
19
+ echo " ✅ Pre-commit hooks are now installed!"
20
+ echo " "
21
+ echo " From now on, every time you commit:"
22
+ echo " - Ruff will automatically fix code style issues"
23
+ echo " - Ruff formatter will format your code"
24
+ echo " - MyPy will check types"
25
+ echo " - Various file checks will run"
26
+ echo " "
27
+ echo " To manually run pre-commit: pre-commit run --all-files"
28
+ echo " To bypass pre-commit (not recommended): git commit --no-verify"
You can’t perform that action at this time.
0 commit comments