|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Module Organization |
| 4 | +- Source: `src/project_x_py/` (core SDK: client, realtime, orderbook, indicators, utils, etc.). |
| 5 | +- Tests: `tests/` (pytest; async tests supported). |
| 6 | +- Examples: `examples/` (runnable end-to-end samples). |
| 7 | +- Docs: `docs/` (Sphinx); helper script `scripts/build-docs.py`. |
| 8 | +- Scripts: `scripts/` (build, docs, versioning). Build artifacts in `dist/` and coverage in `htmlcov/`. |
| 9 | + |
| 10 | +## Build, Test, and Development Commands |
| 11 | +- Install dev env: `uv sync` (or `pip install -e ".[dev]"`). |
| 12 | +- Run tests + coverage: `uv run pytest` (HTML at `htmlcov/index.html`). |
| 13 | +- Lint: `uv run ruff check .` Format: `uv run ruff format .` Types: `uv run mypy src`. |
| 14 | +- Docs: `uv run python scripts/build-docs.py --clean --open`. |
| 15 | +- CLI helpers: `uv run projectx-check` and `uv run projectx-config`. |
| 16 | +- Run an example: `uv run python examples/01_basic_client_connection.py`. |
| 17 | + |
| 18 | +## Coding Style & Naming Conventions |
| 19 | +- Python 3.12+, 4-space indents, max line length 88. |
| 20 | +- Format with Ruff formatter (Black-compatible); import order via Ruff/isort. |
| 21 | +- Naming follows PEP 8; uppercase class names allowed in `indicators/` (see Ruff per-file ignores). |
| 22 | +- Keep functions small, typed, and documented where behavior is non-obvious. |
| 23 | + |
| 24 | +## Testing Guidelines |
| 25 | +- Framework: pytest (+ pytest-asyncio). Place tests under `tests/` as `test_*.py`. |
| 26 | +- Marks: `unit`, `integration`, `slow`, `realtime` (see `pyproject.toml`). |
| 27 | +- Aim for meaningful coverage of public APIs; coverage reports are produced automatically. |
| 28 | +- Prefer async-safe patterns; use fixtures and markers to isolate realtime or networked tests. |
| 29 | + |
| 30 | +## Commit & Pull Request Guidelines |
| 31 | +- Use Conventional Commits: `feat:`, `fix:`, `perf:`, `docs:`, `chore:`, etc. Add scope when helpful: `fix(orderbook): ...`. |
| 32 | +- Keep subject ≤ 72 chars; body explains what/why and migration notes if breaking. |
| 33 | +- Before PR: run `uv run ruff format . && uv run ruff check . && uv run mypy src && uv run pytest`. |
| 34 | +- PRs include: clear description, linked issues, test updates, docs updates (if user-facing), and screenshots/logs when relevant. |
| 35 | + |
| 36 | +## Security & Configuration Tips |
| 37 | +- Auth via env vars `PROJECT_X_API_KEY`, `PROJECT_X_USERNAME`, or config at `~/.config/projectx/config.json`. |
| 38 | +- Avoid committing secrets; prefer `.env` locally and CI secrets in GitHub. |
| 39 | +- When adding realtime features, guard network calls in tests with markers. |
0 commit comments