2.8 KiB
2.8 KiB
AGENTS.md
Project
Wrenn Python SDK — a client library for the Wrenn microVM platform. e2b drop-in replacement.
Package name: wrenn. Python 3.13+, managed with uv.
Commands
uv sync # install deps
make lint # ruff check + format check (no auto-fix)
make test # unit tests only (tests/test_client.py)
make test-integration # all tests including integration (needs live server)
make generate # regenerate models from OpenAPI spec (fetches from remote)
make check # lint + unit test
make testonly runstests/test_client.py, not all unit tests. To run a specific test file:uv run pytest tests/test_capsule_features.py -v- No typecheck step in Makefile or CI.
mypyis a dev dependency but not wired up — do not assume it runs.
Architecture
src/wrenn/— the library packagecapsule.py/async_capsule.py— high-levelCapsule/AsyncCapsule(main user-facing classes)client.py— low-levelWrennClient/AsyncWrennClientcommands.py— command execution and streamingfiles.py— filesystem operationspty.py— interactive terminal (PTY) over WebSocketexceptions.py— typed error hierarchy (WrennErrorbase)models/_generated.py— auto-generated from OpenAPI spec viadatamodel-codegen(never edit directly; runmake generate)sandbox.py— deprecatedSandboxalias forCapsulecode_interpreter/— specialized capsule for stateful Jupyter kernel execution
tests/— unit tests userespxto mockhttpx; integration tests are intests/integration/api/openapi.yaml— downloaded OpenAPI spec used for code generation
Key Conventions
- Generated code lives in
src/wrenn/models/_generated.py. Never edit it. Runmake generateto update. Sandboxis a deprecated alias forCapsule. New code should useCapsule/AsyncCapsule.- Dual sync/async API: every major class has an
Asynccounterpart. - Uses
httpxfor HTTP,httpx-wsfor WebSockets,pydanticfor models. __init__.pyuses__getattr__for lazy deprecated aliases (Sandbox,WrennHostHasSandboxesError).
Testing
- Unit tests mock HTTP via
respx(httpx mocking library). - Integration tests require env vars:
WRENN_API_KEY(orWRENN_TOKEN), optionallyWRENN_BASE_URL. - Integration test fixtures in
tests/integration/conftest.pycreate real capsules and clean them up. pytestmarker:@pytest.mark.integrationfor tests needing a live server.
CI
Woodpecker CI (.woodpecker/check.yml) runs on push to main and dev:
make lintmake test(unit tests only — integration tests are not in CI)