Skip to main content

Contributing

Thank you for contributing to Metacrafter.

Development setup​

Prerequisites: Python 3.10+, Git, pip, Node.js 18+ (for the docs site).

git clone https://github.com/apicrafter/metacrafter.git
cd metacrafter
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e '.[dev,llm,mongodb,duckdb,server,mcp,formats]'

Tests​

pytest tests/
pytest --cov=metacrafter --cov-report=term-missing # CI requires 60%

Tests are hermetic:

  • tests/conftest.py resolves the rule pack once, from METACRAFTER_RULES_DIR, the cache or the archive bundled in metacrafter/rules/bundled/;
  • each test then gets an empty home directory and no network access;
  • the registry comes from the offline snapshot in tests/fixtures/registry_snapshot. Tests for optional integrations skip when their extra is not installed. Measured on Python 3.11 with all extras: 400 passed, 10 skipped, about 71% line coverage, about 20 seconds.

CI jobs (.github/workflows/ci.yml):

JobChecks
testpytest with coverage on Python 3.10–3.13
qualityruff (syntax errors, undefined names), mypy on the report contracts
installationbuilds the wheel and scans data from a clean environment outside the checkout (core, llm, catalogs)
ecosystemrule keys, registry examples and checksum names against the live registry (Ecosystem contract)

Code style​

ruff check metacrafter tests scripts
mypy metacrafter/reports.py metacrafter/report --ignore-missing-imports

Follow existing patterns, add tests for new behavior, and keep changes backward compatible when possible. Type hints are welcome.

Documentation​

User-facing docs live in docs/docs/ (Docusaurus). After editing markdown:

cd docs
npm install
npm start # live preview
npm run build # fails on broken links

See docs/README.md.

Larger features should go through OpenSpec (openspec/AGENTS.md and openspec/ROADMAP.md).