Thanks for considering a contribution. yapi is small and intentionally
opinionated; this guide explains the workflow so changes can land smoothly.
git clone https://github.com/TokenRollAI/yapi.git
cd yapi
uv sync --extra dev # creates .venv with runtime + dev deps
uv run pytest # offline test matrix; live tests are skipped by defaultPython 3.12+ is required. The lockfile (uv.lock) is committed and should be
kept in sync; if you change pyproject.toml dependencies, run uv sync and
commit the updated lockfile.
# Offline smoke (no API key, no network):
YAPI_MODEL=test uv run uvicorn examples.wish_api:app --reload
# Against a real provider — see README.md "Configuration":
uv run uvicorn examples.wish_api:app --reload --env-file .envThe model must support OpenAI Function Calling's tool_choice — see the
warning in README.md under YAPI_MODEL.
tests/live/ runs end-to-end against the configured provider — useful when
changing prompt composition, <context> wrapping, or PydanticAI integration.
Skipped by default; requires both a CLI flag and a real YAPI_MODEL:
set -a; source .env; set +a # or otherwise export YAPI_MODEL etc.
uv run pytest tests/live --run-live -vCI does not run them (provider creds + nondeterministic LLM output). See
llmdoc/reference/run-and-test.md §8 for the gating logic and assertion
style.
- No automated formatter / linter is wired up yet (intentional, see
docs/superpowers/specs/2026-05-24-yapi-v2.2-design.md§10). Match the surrounding style: PEP 8, type annotations on public surface, no trailing whitespace. - Public symbols live in
yapi/__init__.py__all__. If you add one, re-export it explicitly and updatellmdoc/must/api-surface.md. - Errors that the user can hit raise
YapiDeclarationErrorat decoration time (preferred) orRuntimeExecutionErrorat request time. Don't add a new error type without updatingllmdoc/reference/error-catalog.md.
Conventional-commit style is used throughout the history:
feat: short summary
fix: short summary
docs: short summary
chore: short summary
chore(deps): short summary # dependabot
chore(actions): short summary # dependabot for github-actions
Keep the subject under ~70 chars. A body is optional but encouraged for non-trivial changes — explain the why, not the what.
Before opening a PR:
uv run pytestpasses locally.- New behavior has at least one test in
tests/. The breakdown of test files is documented inllmdoc/reference/run-and-test.md. - If the change touches the public contract (router, runner, errors),
update the relevant
llmdoc/file(s). Seellmdoc/index.mdfor the doc map. - Examples in
examples/still import without errors:uv run python -c "import examples.wish_api, examples.mixed_router, examples.with_depends, examples.state_via_depends, examples.custom_runner"
CI (GitHub Actions) runs the test matrix on Python 3.12 + 3.13. No secrets are required.
Bump [project].version in pyproject.toml, commit, tag vX.Y.Z, push
the tag. The release pipeline (.github/workflows/release.yml) verifies
the tag matches the pyproject version, builds sdist + wheel, publishes
to PyPI via Trusted Publishing, and creates a GitHub Release with
autogenerated notes. See llmdoc/guides/release.md for the full flow.
yapi is not a chat platform, agent framework, or prompt-management
tool. See llmdoc/overview/project-overview.md "明确不做的事" and
docs/superpowers/specs/2026-05-24-yapi-v2.2-design.md §10 for the full
list of out-of-scope items before proposing large features. In particular,
yapi does not integrate state stores (Redis / Mongo / SQL) — use FastAPI
Depends(...) and pass results to PromptContext; see
examples/state_via_depends.py.
Open a GitHub issue at https://github.com/TokenRollAI/yapi/issues with a
minimal reproduction or a concrete proposal. For security issues, see
SECURITY.md instead.