|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Module Organization |
| 4 | +- `mesa_frames/`: Source package. |
| 5 | + - `abstract/` and `concrete/`: Core APIs and implementations. |
| 6 | + - Key modules: `agents.py`, `agentset.py`, `space.py`, `datacollector.py`, `types_.py`. |
| 7 | +- `tests/`: Pytest suite (`test_*.py`) covering public APIs. |
| 8 | +- `docs/`: MkDocs and Sphinx content for user and API docs. |
| 9 | +- `examples/`: Reproducible demo models and performance scripts. |
| 10 | + |
| 11 | +## Build, Test, and Development Commands |
| 12 | +- Install (dev stack): `uv sync` (always use uv) |
| 13 | +- Lint & format: `uv run ruff check . --fix && uv run ruff format .` |
| 14 | +- Tests (quiet + coverage): `export MESA_FRAMES_RUNTIME_TYPECHECKING = 1 && uv run pytest -q --cov=mesa_frames --cov-report=term-missing` |
| 15 | +- Pre-commit (all files): `uv run pre-commit run -a` |
| 16 | +- Docs preview: `uv run mkdocs serve` |
| 17 | + |
| 18 | +Always run tools via uv: `uv run <command>`. |
| 19 | + |
| 20 | +## Coding Style & Naming Conventions |
| 21 | +- Python 3.11+, 4-space indent, type hints required for public APIs. |
| 22 | +- Docstrings: NumPy style (validated by Ruff/pydoclint). |
| 23 | +- Formatting/linting: Ruff (formatter + lints). Fix on save if your IDE supports it. |
| 24 | +- Names: `CamelCase` for classes, `snake_case` for functions/attributes, tests as `test_<unit>.py` with `Test<Class>` groups. |
| 25 | + |
| 26 | +## Testing Guidelines |
| 27 | +- Framework: Pytest; place tests under `tests/` mirroring module paths. |
| 28 | +- Conventions: One test module per feature; name tests `test_<method_or_behavior>`. |
| 29 | +- Coverage: Aim to exercise new branches and error paths; keep `--cov=mesa_frames` green. |
| 30 | +- Run fast locally: `pytest -q` or `uv run pytest -q`. |
| 31 | + |
| 32 | +## Commit & Pull Request Guidelines |
| 33 | +- Commits: Imperative mood, concise subject, meaningful body when needed. |
| 34 | + Example: `Fix AgentsDF.sets copy binding and tests`. |
| 35 | +- PRs: Link issues, summarize changes, note API impacts, add/adjust tests and docs. |
| 36 | +- CI hygiene: Run `ruff`, `pytest`, and `pre-commit` locally before pushing. |
| 37 | + |
| 38 | +## Security & Configuration Tips |
| 39 | +- Never commit secrets; use env vars. Example: `MESA_FRAMES_RUNTIME_TYPECHECKING=1` for stricter dev runs. |
| 40 | +- Treat underscored attributes as internal. |
0 commit comments