|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +This guide helps contributors work effectively in the datasmith repository. |
| 4 | + |
| 5 | +## Project Structure & Module Organization |
| 6 | +- Source: `src/datasmith/` — core modules: `agents/`, `docker/`, `scrape/`, `benchmark/`, `detection/`, `execution/`, `collation/`, `core/`. |
| 7 | +- Tests: `tests/` — pytest suites (e.g., `tests/test_docker_*`, `tests/agents/`). |
| 8 | +- Assets/Docs: `static/`, `docs/`. |
| 9 | +- Artifacts: `scratch/` (generated data), `dist/` (wheels). Do not commit contents. |
| 10 | + |
| 11 | +## Build, Test, and Development Commands |
| 12 | +- `make install` — create env with uv and install pre-commit. |
| 13 | +- `make check` — lock check, ruff lint/format, mypy, deptry. |
| 14 | +- `make test` — run pytest with coverage (XML for CI/Codecov). |
| 15 | +- `make build` — build wheel into `dist/`. |
| 16 | +- `uv run <cmd>` — run tools inside the env (e.g., `uv run pytest`). |
| 17 | +- `uvx tox -q` — run the tox matrix (py39–py312) if tox is installed. |
| 18 | +- Optional: `make backup` uses `tokens.env` for `BACKUP_DIR` rsync. |
| 19 | +- To run commands using the same environment variables as the user, use `uv run <command>`. |
| 20 | + |
| 21 | +## Coding Style & Naming Conventions |
| 22 | +- Python 3.9–3.12. 4‑space indentation, type hints required (mypy strict; see `pyproject.toml`). |
| 23 | +- Lint/format via Ruff (line length 120). Run `make check` before pushing. |
| 24 | +- Naming: modules/functions `snake_case`, classes `CamelCase`, constants `UPPER_SNAKE_CASE`. |
| 25 | +- Prefer `logging` (see `src/datasmith/logging_config.py`) over prints. |
| 26 | + |
| 27 | +## Testing Guidelines |
| 28 | +- Framework: pytest + pytest‑cov. Place tests in `tests/` named `test_*.py`. |
| 29 | +- Run locally: `make test` or `uv run pytest`. |
| 30 | +- Coverage: Codecov target 90% (see `codecov.yaml`). Add tests for new code paths. |
| 31 | +- Tests must be deterministic and offline; use fakes for network calls. |
| 32 | + |
| 33 | +## Commit & Pull Request Guidelines |
| 34 | +- History is informal; please use clear, present‑tense summaries, optionally prefixing a subsystem tag: `docker: prune dangling layers`, `agents: improve build plan`. |
| 35 | +- PRs must include: description, rationale, test coverage notes, and any docs updates. Link issues. For CLI/UX changes, include sample output or screenshots. |
| 36 | +- Ensure `make check` and `make test` pass; CI should be green. |
| 37 | + |
| 38 | +## Security & Configuration Tips |
| 39 | +- Create `tokens.env` (ignored) for `GH_TOKEN`, `CODECOV_TOKEN`, `CACHE_LOCATION`, `BACKUP_DIR`. Never commit secrets. |
| 40 | +- Docker tooling exists in `src/datasmith/docker/`; validate locally before pushing remote runs. |
| 41 | + |
| 42 | +## Agent‑Specific Instructions |
| 43 | +- Keep changes small and focused; update/cover adjacent tests. Follow this guide for all files under the repo root. |
0 commit comments