The celerity-sdk package for building Celerity applications in Python. Celerity's Python
runtime image starts applications through it, the Celerity CLI runs its celerity-extract tool
and generates AWS Lambda entry files that import its adapter, and it uses the runtime binding
celerity-runtime-sdk from celerity's libs/runtime/sdk/python.
This repo is one of NewStack's. NewStack's maintainers develop it alongside the others in a shared workspace, using the NewStack Claude Code plugin for how work is planned, reviewed, committed and coordinated across repos. The plugin isn't public, and nothing here depends on it: this file and the repo's own docs cover what a contribution needs.
One package in src/celerity/ (src layout); CONTRIBUTING.md lists its
subpackages. Tests are flat in tests/ (test_*.py), with Docker-backed tests in
tests/integration/. Optional dependencies are extras in pyproject.toml (runtime, aws,
cache, resources-sql, telemetry, gcp, azure, test, and an empty cli that the
Celerity CLI tells users to install); dev pulls in all but gcp and azure. A development
dependency goes in the dev extra: uv add --dev writes a dependency group that
--extra dev never installs.
docs/design/ isn't in the repo: maintainers keep working notes there, untracked and not
gitignored, so stage files by path rather than with git add -A.
Commands are in CONTRIBUTING.md.
- Tools: Python 3.13 (
.python-version), uv, docker for integration tests, and Node with Yarn classic for commitlint. Runuv sync --extra devfirst; plainuv syncinstalls no test or lint tools.uv.lockis gitignored: each checkout keeps its own, while CI and new worktrees resolve the latest versions, so an upstream release can break CI with no change here. - Tests:
./scripts/run-tests.sh unit|integration|all(defaultunit), extra arguments passed to pytest. It loads.env.test(dummy AWS credentials,AWS_ENDPOINT_URLset to LocalStack) and always writescoverage.xmlandtest-results.xml.integrationandallstartdocker-compose.yml(Valkey on 6399, LocalStack on 4566, Postgres on 5499) and stop it withdocker compose down -von exit. The tests reach only these containers.- Run one stack at a time. The compose project name is fixed
(
celerity-python-sdk-integration), so a run in another worktree shares the stack and its teardown removes it, and the Node SDK's stack binds the same three ports. If startup fails, the containers it started are left running.
- Lint and types:
uv run ruff format --check src/ tests/,uv run ruff check src/ tests/,uv run mypy src/(strict). - Gates:
- With
git config core.hooksPath .githooks, pre-commit runs ruff format and lint over the working tree (not mypy or tests) when Python files are staged. commit-msg runs commitlint onceyarn installhas run in that checkout, so each worktree needs its own; without it, a regex checks the type and the scope's syntax but not the allowed scopes. - CI (
ci.yml) runspip-audit, ruff format and lint, mypy,run-tests.sh alland SonarCloud on pull requests and pushes tomain.codeql.ymlruns CodeQL on the same triggers and weekly, andsecurity.ymlruns actionlint on pull requests.
- With
- Package API: pre-1.0. release-please here doesn't set
bump-minor-pre-major, so a breaking change releases 1.0.0; don't mark one as breaking without agreeing the release first. Resource contracts are kept at parity with the Node and Go SDKs; a contract change says what each other SDK needs. - Runtime image: celerity's Python runtime image tracks this package on major.minor, and
the Celerity CLI picks the image from the SDK version a project declares
(
apps/runtime/python/RELEASING.mdin celerity). Each minor release here needs a runtime release at the same minor, and breaking changes stay out offix:releases. - Entry points other repos import: celerity's
apps/runtime/pythoncallscelerity.bootstrap.runtime_orchestrator.start_runtime, and the Lambda entry file the Celerity CLI generates callscelerity.serverless.aws.create_lambda_handler(). Renaming or moving either, or changing its signature, needs a matching celerity change first. Lambda deployments install the package with no extras, soimport celerity.serverless.aws(andcelerity/__init__.pywith it) must not import an optional dependency at module level. - Handler manifest and
celerity-extract: the Celerity CLI runscelerity-extract --module <path> --project-root <dir>from the project's.venv/binorvenv/binand parses all of stdout as the handler-manifest.v1 JSON the Node SDK's extractor also writes, so anything else printed to stdout, at import time included, breaks extraction; warnings go to stderr. Additive only. Nothing here validates the output: a new field goes in the schema in the Node SDK (packages/cli/schemas/) and in the Go structs in celerity'sapps/cli/internal/preprocess/manifest.go, or the CLI drops it. - Runtime binding:
celerity-runtime-sdk(theruntimeextra) is published from celerity; a change there reaches this repo by raising the minimum version inpyproject.toml. - Persisted state: none.
- Commits: conventional, with the types in
commitlint.config.js. Its scopes are allowed but optional, and history is almost entirely unscoped;src/celerity/confighas no scope. - Releases: release-please opens one release pull request; merging it publishes to PyPI. The
release workflow can also be run by hand to publish. Don't edit
CHANGELOG.md, the version inpyproject.tomlor.release-please-manifest.jsonby hand. - Dependency updates: Dependabot (
.github/dependabot.yml), for pip and GitHub Actions. - Async-first: handlers and DI resolution are async.
- Dataclasses for internal types, Pydantic for user-facing validation. ABCs for behavioural
contracts (
CelerityLayer,ServiceContainer, resource interfaces);Protocolonly for structural ones (Schema). - Decorators are snake_case and store metadata in a
__celerity_metadata__dict attribute. PascalCase is for classes only, including parameter types (Body,Query,Param). - Google-style docstrings on public APIs. No wildcard imports.
- New code and comments don't mention the Node SDK: this SDK documents itself, and parity
notes belong in the design notes.
layers/validate.pypredates this.
- Don't publish to PyPI, create tags or releases, or merge release pull requests.