- Core Python package lives in
src/dstack; internal modules (including server) sit under_internal, API surfaces underapi, and plugin integrations underplugins. - Tests reside in
src/testsand mirror package paths; add new suites alongside the code they cover. - Frontend lives in
frontend(React/webpack) and is built intosrc/dstack/_internal/server/statics. - Docs sources are in
docswith extra contributor notes incontributing/*.md; examples for users sit inexamples/.
- Install deps (editable package with extras):
uv sync --all-extras(uses.venvin repo). - Run CLI/server from source:
uv run dstack ...(e.g.,uv run dstack server --port 8000). - Lint/format:
uv run ruff check .anduv run ruff format .. - Type check:
uv run pyright -p .. - Test suite:
uv run pytest. - Frontend: from
frontend/runnpm install,npm run build, then copyfrontend/buildintosrc/dstack/_internal/server/statics/; for dev,npm run startwith API on port 8000.
- Python targets 3.9+ with 4-space indentation and max line length of 99 (see
ruff.toml;E501is ignored but keep lines readable). - Imports are sorted via Ruff’s isort settings (
dstacktreated as first-party). - Keep primary/public functions before local helper functions in a module section.
- Prefer pydantic-style models in
core/models. - Tests use
test_*.pymodules andtest_*functions; fixtures live near usage.
- Default to
uv run pytest. Use markers fromtests/conftest.pylike--runpostgresif need to include specific tests. - Group tests for the same unit (function/class) using
Test*classes that mirror unit's name. - Keep tests hermetic (network disabled except localhost per
pytest.ini); stub cloud calls with mocks.
- Commit messages follow the existing style: short, imperative summaries (e.g., “Fix exclude_not_available ignored”); include rationale in the body if needed.
- For PRs, describe behavior changes and link related issues.
- Include screenshots or terminal output when touching UX/CLI messages or frontend flows.
- Always disclose AI Assistance in PRs.