File size: 2,430 Bytes
89aa2b4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1589e06
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Development Tools

This directory contains local development infrastructure that mirrors the GitHub Actions CI/CD pipeline to prevent failures and improve development workflow.

## πŸ› οΈ Available Tools

### `local-ci-check.sh`
Complete CI/CD pipeline simulation that runs all checks that GitHub Actions will perform:
- **Black formatting** check (88-character line length)
- **isort import sorting** check (black-compatible profile)
- **flake8 linting** (excludes E203/W503 for black compatibility)
- **pytest test suite** (runs all 45+ tests)
- **Git status check** (warns about uncommitted changes)

```bash
./dev-tools/local-ci-check.sh
```

### `format.sh`
Quick formatting utility that automatically fixes common formatting issues:
- Runs `black` to format code
- Runs `isort` to sort imports
- Checks `flake8` compliance after formatting

```bash
./dev-tools/format.sh
```

## πŸš€ Makefile Commands

For convenience, all tools are also available through the root-level Makefile:

```bash
make help        # Show available commands
make format      # Quick format (uses format.sh)
make check       # Check formatting only
make test        # Run test suite only
make ci-check    # Full CI pipeline (uses local-ci-check.sh)
make install     # Install development dependencies
make clean       # Clean cache files
```

## βš™οΈ Configuration Files

The development tools use these configuration files (located in project root):

- **`.flake8`**: Linting configuration with black-compatible settings
- **`pyproject.toml`**: Tool configurations for black, isort, and pytest
- **`Makefile`**: Convenient command aliases

## πŸ”„ Recommended Workflow

```bash
# 1. Make your changes
# 2. Format code
make format

# 3. Run full CI check
make ci-check

# 4. If everything passes, commit and push
git add .
git commit -m "Your commit message"
git push origin your-branch
```

## 🎯 Benefits

- **Prevent CI/CD failures** before pushing to GitHub
- **Consistent code quality** across all team members
- **Fast feedback loop** (~8 seconds for full check)
- **Team collaboration** through standardized development tools
- **Automated fixes** for common formatting issues

## πŸ“ Notes

- All tools respect the project's virtual environment (`./venv/`)
- Configuration matches GitHub Actions pre-commit hooks exactly
- Scripts provide helpful error messages and suggested fixes
- Designed to be run frequently during development