|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Module Organization |
| 4 | +- Core Python package lives in `src/dstack`; internal modules (including server) sit under `_internal`, API surfaces under `api`, and plugin integrations under `plugins`. |
| 5 | +- Tests reside in `src/tests` and mirror package paths; add new suites alongside the code they cover. |
| 6 | +- Frontend lives in `frontend` (React/webpack) and is built into `src/dstack/_internal/server/statics`. |
| 7 | +- Docs sources are in `docs` with extra contributor notes in `contributing/*.md`; examples for users sit in `examples/`. |
| 8 | + |
| 9 | +## Build, Test, and Development Commands |
| 10 | +- Install deps (editable package with extras): `uv sync --all-extras` (uses `.venv` in repo). |
| 11 | +- Run CLI/server from source: `uv run dstack ...` (e.g., `uv run dstack server --port 8000`). |
| 12 | +- Lint/format: `uv run ruff check .` and `uv run ruff format .`. |
| 13 | +- Type check: `uv run pyright -p .`. |
| 14 | +- Test suite: `uv run pytest`. |
| 15 | +- Frontend: from `frontend/` run `npm install`, `npm run build`, then copy `frontend/build` into `src/dstack/_internal/server/statics/`; for dev, `npm run start` with API on port 8000. |
| 16 | + |
| 17 | +## Coding Style & Naming Conventions |
| 18 | +- Python targets 3.9+ with 4-space indentation and max line length of 99 (see `ruff.toml`; `E501` is ignored but keep lines readable). |
| 19 | +- Imports are sorted via Ruff’s isort settings (`dstack` treated as first-party). |
| 20 | +- Prefer pydantic-style models in `core/models`. |
| 21 | +- Tests use `test_*.py` modules and `test_*` functions; fixtures live near usage. |
| 22 | + |
| 23 | +## Testing Guidelines |
| 24 | +- Default to `uv run pytest`. Use markers from `tests/conftest.py` like `--runpostgres` if need to include specific tests. |
| 25 | +- Group tests for the same unit (function/class) using `Test*` classes that mirror unit's name. |
| 26 | +- Keep tests hermetic (network disabled except localhost per `pytest.ini`); stub cloud calls with mocks. |
| 27 | + |
| 28 | +## Commit & Pull Request Guidelines |
| 29 | +- Commit messages follow the existing style: short, imperative summaries (e.g., “Fix exclude_not_available ignored”); include rationale in the body if needed. |
| 30 | +- For PRs, describe behavior changes and link related issues. |
| 31 | +- Include screenshots or terminal output when touching UX/CLI messages or frontend flows. |
| 32 | +- Always disclose AI Assistance in PRs. |
0 commit comments