Thanks for your interest in improving stata-code! This document explains how to
set up a development environment, run the checks CI runs, and get a change merged.
- Report a bug / request a feature → open an issue
- Ask a question / seek support → open a GitHub issue with the
questionlabel - Security concern → see SECURITY.md
Before opening a PR, please also read LICENSE-POLICY.md, which explains how this project relates to the wider Stata tooling ecosystem.
Python 3.10+ is required. Stata 17+ is optional — the majority of the test suite runs without it.
git clone https://github.com/brycewang-stanford/stata-code.git
cd stata-code
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev,mcp,kernel]"CI runs four gates on every PR. Run them locally first:
# 1. Tests (no Stata needed for this subset; CI runs exactly this)
pytest -m "not stata_required"
# 2. Lint
ruff check stata_code tests scripts
# 3. Types (the package is mypy-clean; please keep it that way)
mypy stata_code
# 4. Generated artifacts in sync
python scripts/export_schema.py --check # JSON Schema artifact
python scripts/check_versions.py # version literals alignedIf you have Stata 17+ installed, pytest with no marker filter also runs the
real-Stata integration tests (-m stata_required).
The VS Code extension has its own checks:
cd vscode && npm ci && npm test- Tests are required for any new schema field, runner behavior, MCP tool, or
error-taxonomy change. Offline tests (no Stata) are strongly preferred; use the
stata_requiredmarker only when a real Stata session is genuinely needed. - Schema changes:
RunResultand friends live instata_code/core/schema.py. After editing, regenerate the JSON Schema artifact withpython scripts/export_schema.pyand commit the result, and update SCHEMA.md if the shape changed. - Version literals: do not bump versions in a feature PR. Releases move
eight version literals across six files together; the process is documented in
PUBLISHING.md and guarded by
scripts/check_versions.py. - Style:
ruff(line length 100) andmypysettings are inpyproject.toml. Match the style of the surrounding code. - First PR: add a one-line acknowledgement to your PR description; the template is in LICENSE-POLICY.md.
| Path | What lives there |
|---|---|
stata_code/core/ |
Runner pipeline, session pool, schema, error taxonomy |
stata_code/mcp/ |
MCP server frontend |
stata_code/kernel/ |
Jupyter kernel frontend |
vscode/ |
VS Code extension (TypeScript) |
schema/ |
Exported JSON Schema artifact |
tests/ |
Python test suite (stata_required marks real-Stata tests) |
examples/ |
End-to-end walkthroughs |
See PUBLISHING.md. Contributors never need to tag or publish.