The svc-infra CLI wraps common database, observability, jobs, docs, and DX workflows using Typer.
- Entry points:
- Global:
svc-infra ...(installed via Poetry scripts) - Module:
python -m svc_infra.cli ...(works in editable installs and containers)
- Global:
Top-level help
Run:
code
svc-infra --helpYou should see groups for SQL, Mongo, Observability, DX, Jobs, and SDK.
Database (Alembic) commands
- End-to-end setup and migrate (detects async from URL):
- Environment variables (commonly):
SQL_URLor compose partsDB_*.
- Environment variables (commonly):
Example with SQLite for quick smoke tests:
code
python -m svc_infra.cli sql setup-and-migrate --database-url sqlite+aiosqlite:///./accept.db \
--discover-packages "app.models" --with-payments false- Current revision, history, upgrade/downgrade:
code
python -m svc_infra.cli sql current
python -m svc_infra.cli sql-history
python -m svc_infra.cli sql upgrade head
python -m svc_infra.cli sql downgrade -1- Seed fixtures/reference data with your callable:
code
python -m svc_infra.cli sql seed path.to.module:seed_funcNotes:
- The target must be in the format
module.path:callable. - If you previously referenced legacy test modules under
tests.db.*, the CLI shims import totests.unit.db.*when possible.
Jobs
Start the local jobs runner loop:
code
svc-infra jobs runDX helpers
- Generate CI workflow and checks template:
code
python -m svc_infra.cli dx ci --openapi openapi.json- Lint OpenAPI and Problem+JSON samples:
code
python -m svc_infra.cli dx openapi openapi.jsonSDKs
Generate SDKs from OpenAPI (dry-run by default): see docs/docs-and-sdks.md for full examples.