|
9 | 9 | - **Key Dependencies:** `portalocker`, `watchdog` (optional: `pymongo`, `sqlalchemy`, `redis`) |
10 | 10 | - **Test Framework:** `pytest` with backend-specific markers |
11 | 11 | - **Linting:** `ruff` (replaces black/flake8) |
| 12 | +- **Type Checking:** `mypy` |
12 | 13 | - **CI:** GitHub Actions (matrix for backends/OS with Dockerized services) |
13 | 14 | - **Issue Tracking:** GitHub Issues |
14 | 15 | - **Additional Docs:** `.github/copilot-instructions.md` for contributor guidelines |
@@ -64,10 +65,11 @@ ______________________________________________________________________ |
64 | 65 | pytest -m "not (mongo or sql)" # Exclude external service backends |
65 | 66 | ``` |
66 | 67 |
|
67 | | -3. **Lint:** |
| 68 | +3. **Lint and type-check:** |
68 | 69 |
|
69 | 70 | ```bash |
70 | 71 | ruff check . |
| 72 | + mypy src/cachier/ |
71 | 73 | ``` |
72 | 74 |
|
73 | 75 | 4. **Try an example:** |
@@ -100,6 +102,7 @@ ______________________________________________________________________ |
100 | 102 | - **Type annotations** required for all new code. |
101 | 103 | - **Docstrings:** Use numpy style, multi-line, no single-line docstrings. |
102 | 104 | - **Lint:** Run `ruff` before PRs. Use per-line/file ignores only for justified cases. |
| 105 | +- **Type check:** Run `mypy` before PRs. |
103 | 106 | - **Testing:** All public methods must have at least one test. Use `pytest.mark.<backend>` for backend-specific tests. |
104 | 107 | - **No warnings/errors for missing optional dependencies at import time.** Only raise when backend is used. |
105 | 108 |
|
@@ -501,6 +504,7 @@ ______________________________________________________________________ |
501 | 504 | - **If adding new dependencies, use context7 MCP to get latest versions.** |
502 | 505 | - **Always check GitHub Issues before starting new features/PRs.** |
503 | 506 | - **Create a relevant issue for every new PR.** |
| 507 | +- **Use per-file or per-line ignores for mypy/ruff only when justified.** |
504 | 508 | - **All new code must have full type annotations and numpy-style docstrings.** |
505 | 509 |
|
506 | 510 | ______________________________________________________________________ |
@@ -552,6 +556,7 @@ ______________________________________________________________________ |
552 | 556 | | Test multiple backends | `pytest -m "redis or sql"` | |
553 | 557 | | Exclude backends | `pytest -m "not mongo"` | |
554 | 558 | | Lint | `ruff check .` | |
| 559 | +| Type check | `mypy src/cachier/` | |
555 | 560 | | Format code | `ruff format .` | |
556 | 561 | | Build package | `python -m build` | |
557 | 562 | | Check docs | `python setup.py checkdocs` | |
|
0 commit comments