---
title: Python SDK overview
description: Use the governed Python SDK in Relpin FastAPI apps.
section: SDK
sidebarLabel: Python / Overview
order: 120
updated: "2026-06-11"
status: beta
llms: true
keywords:
  - Python
  - FastAPI
  - RelpinDb
  - readiness
---

The Python SDK supports governed FastAPI apps in Relpin. It gives the app database access through a platform-controlled transport and exposes the preview readiness signal.

## Install surface

Relpin templates include the SDK. In generated apps, import from `relpin_sdk`.

```python
from relpin_sdk import RelpinDb, RelpinReadinessMiddleware
```

## Database access

`RelpinDb` sends queries over the governed runtime transport. In preview, that transport points at the sidecar. In published Workers, the generated shim uses the runtime DB service binding.

The app does not read `DATABASE_URL`.

## Readiness

FastAPI apps should add `RelpinReadinessMiddleware`. The preview sidecar uses `/__relpin/ready` to know when the app imported and can serve the current revision.

## Related pages

- [Python table helpers](/docs/sdk/python/table-helpers)
- [Python readiness middleware](/docs/sdk/python/readiness-middleware)
- [Governed data access](/docs/concepts/governed-data-access)
