|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Module Organization |
| 4 | +- `src/project_x_py/`: Library source (async client, order/position managers, indicators, utils). |
| 5 | +- `tests/`: Pytest suite (`test_*.py`) with unit/integration markers. |
| 6 | +- `examples/`: Usage patterns and reference strategies. |
| 7 | +- `scripts/`: Dev utilities (`check_quality.sh`, docs, build helpers). |
| 8 | +- `docs/` and `site/`: MkDocs docs and built site. |
| 9 | +- `dist/`: Built wheels/sdists. Do not edit by hand. |
| 10 | + |
| 11 | +## Build, Test, and Development Commands |
| 12 | +- Setup: `uv sync` (or `pip install -e ".[dev]"`). |
| 13 | +- Test all: `uv run pytest` (coverage and reports are enabled via config). |
| 14 | +- Lint/format: `uv run ruff format .` then `uv run ruff check . --fix`. |
| 15 | +- Type check: `uv run mypy src/`. |
| 16 | +- Full quality gate: `./check_quality.sh`. |
| 17 | +- Build artifacts: `uv run python -m build` (outputs to `dist/`). |
| 18 | +- Docs (MkDocs): `./scripts/serve-docs.sh` (local) or `./scripts/deploy-docs.sh`. |
| 19 | + |
| 20 | +## Coding Style & Naming Conventions |
| 21 | +- Python 3.12+, async-first I/O; prefer `async/await` APIs. |
| 22 | +- Formatting/linting via Ruff; line length 88, double quotes, space indentation. |
| 23 | +- Use comprehensive type hints; prefer modern syntax (`dict[str, Any]`, `A | B`). |
| 24 | +- Import order managed by Ruff/isort; first-party is `project_x_py`. |
| 25 | +- Keep public APIs backward compatible; add deprecations before removals. |
| 26 | + |
| 27 | +## Testing Guidelines |
| 28 | +- Framework: Pytest with markers: `unit`, `integration`, `slow`, `realtime`. |
| 29 | +- Naming: files `tests/test_*.py`, functions `test_*`. |
| 30 | +- Run subsets: `uv run pytest -m "unit and not slow"`. |
| 31 | +- Coverage runs by default; maintain or improve coverage for PRs. |
| 32 | + |
| 33 | +## Commit & Pull Request Guidelines |
| 34 | +- Prefer Conventional Commits (`feat:`, `fix:`, `docs:`). Version bumps use `vX.Y.Z: ...`. |
| 35 | +- PRs must: describe changes, link issues, include tests/docs, and pass CI/`check_quality.sh`. |
| 36 | +- Keep changes focused; update `CHANGELOG.md` when user-facing behavior changes. |
| 37 | + |
| 38 | +## Security & Configuration Tips |
| 39 | +- Never commit secrets. Use `.env` (see `.env.example`) and environment vars like `PROJECT_X_API_KEY`. |
| 40 | +- Enable hooks: `uv run pre-commit install` then `uv run pre-commit run -a` before pushing. |
| 41 | +- Run `uv run bandit -r src/` for security scans when touching critical paths. |
0 commit comments