Skip to content

Aura API v1 Python SDK (sync and async) - #1

Merged
LackOfMorals merged 8 commits into
mainfrom
phase-8-async
Sep 29, 2026
Merged

LackOfMorals merged 8 commits into
mainfrom
phase-8-async

Conversation

@LackOfMorals

@LackOfMorals LackOfMorals commented Sep 29, 2026 •

Copy link
Copy Markdown
Owner

Adds a Python SDK for the Neo4j Aura API v1, modelled on aura-go-sdk and covering the whole v1 spec. The design and every decision are recorded in PLAN.md. The commits follow its phases, so reviewing commit by commit is the easiest way through.

What's included

  • Clients: AuraClient, plus AsyncAuraClient for asyncio. Both have the services tenants, instances, snapshots, cmek, graph_analytics and prometheus.
  • Spec coverage: all 26 v1 operations. Beyond the Go SDK, this adds instance sizing and upgrade, CMEK get/create/delete, the list filters, and the full set of update fields.
  • One runtime dependency (httpx). Only one module imports it, behind the SDK's own HttpTransport interface. A test fails if any other module imports a third-party package, or if a public signature exposes an httpx type.
  • Models: frozen dataclasses with StrEnums. A value the SDK doesn't know yet stays a plain string instead of breaking parsing.
  • Errors: one exception class per status (NotFoundError, RateLimitError with retry_after, and so on), keeping the Go SDK's helpers.
  • Prometheus: a stdlib text-format parser. Its output was checked against Go's expfmt on the same input and is identical.

Testing

  • 531 tests pass locally on Python 3.11 and 3.14, with 100% line and branch coverage. ruff and mypy --strict are clean.
  • Every success-response example in the spec is parsed through its model, and a test fails if the spec gains an operation with no SDK method.
  • Parity test: every async method runs against the same responses as its sync version, and must send identical requests and return identical results.
  • Black-box tests use the real httpx transport against a local HTTP server.
  • ** run against the live Aura API.** uv run pytest -m integration

Before the first release

  • Configure a PyPI trusted publisher for workflow release.yml and environment pypi, and create that environment in the repo settings.
  • Set __version__, add a matching ## vX.Y.Z section to CHANGELOG.md, and push the tag. release.yml then tests, builds, publishes and creates the GitHub release.

🤖 Generated with Claude Code

Jonathan Giffard and others added 8 commits September 29, 2026 19:46
Phase 2 of PLAN.md. Adds AuraClient (options, from_env, context manager),
the AuraError exception hierarchy, the HttpTransport protocol with an httpx
implementation, network-only retries with a per-call deadline, OAuth token
caching, and the authenticated request service.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Phase 3 of PLAN.md. Adds frozen dataclass models for every v1 request and
response, StrEnums with tolerant parsing, a stdlib-only serde module, and a
test that parses every 2xx example in the OpenAPI spec with its model.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Phase 4 of PLAN.md: every method of the Go SDK's v1 service interfaces,
wired onto AuraClient, with Go's client-side ID and config validation run
before any request. Overwrite responses and list filters follow the spec.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Phase 5 of PLAN.md. Adds instance sizing and upgrade, CMEK get/create/delete,
tenant/instance/organization list filters, and the storage, vector and graph
analytics update fields. A test now maps every spec operation to a method.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Phase 6 of PLAN.md. Adds client.prometheus (fetch_raw_metrics,
get_metric_value, get_instance_health) with Go's thresholds, a text-format
parser whose output matches Go's expfmt, and a guard that only sends the
Aura token to https://*.neo4j.io metrics URLs. Drops the prometheus extra.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Phase 7 of PLAN.md. Full README, Python ports of the Go v1 examples, a
black-box suite over real sockets with the httpx transport, opt-in live
integration tests (read-only unless writes are enabled), a changelog, and a
tag-triggered workflow that tests, builds and publishes to PyPI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Phase 8 of PLAN.md. Service operations are now pure Call descriptions run by
sync and async executors; retry policy, token handling and request building
are shared. Adds AsyncAuraClient, AsyncHttpTransport and an httpx async
transport, plus tests that every async method matches its sync twin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The first live run showed GET /instances/{id} returning connection_url: null
for some instances, which the spec marks required; Instance.connection_url
is now optional. SDK errors now print under their public name and their
tracebacks stop at the public method instead of listing internal frames.
Live CMEK and session tests skip on 403 instead of failing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LackOfMorals
LackOfMorals merged commit 0bb6c37 into main Sep 29, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant