This release is a pre-release and may not be stable for production use.
korbase
An async ORM for Postgres and SQLite, built the Korvex way. It is pure Python. Models are msgspec Structs, dataclasses or TypedDicts. The driver is asyncpg. It has SQL migrations, written for you and applied after review.
Alpha: the API may change before 1.0. Python 3.10 and later.
Install
pip install --pre "korbase[asyncpg]"
SQLite needs no extra. Documentation: https://3d3n-pyc.github.io/korbase/
Example
This runs on a scratch database. The first statement drops the tables
users and posts.
from __future__ import annotations
import asyncio
from typing import Annotated, Optional
import msgspec
from korbase import FK, PK, Database, Rel, cols, insert, select, table
DSN = "postgresql://user:password@localhost:5432/scratch"
@table("users")
class User(msgspec.Struct):
id: Annotated[int, PK()]
name: str
@table("posts")
class Post(msgspec.Struct):
id: Annotated[int, PK()]
author_id: Annotated[int, FK("users.id")]
title: str
author: Annotated[Optional[User], Rel("author_id")] = None
async def main() -> None:
async with await Database.connect(DSN) as db:
await db.execute(
"""
DROP TABLE IF EXISTS posts; DROP TABLE IF EXISTS users;
CREATE TABLE users (id bigint GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, name text NOT NULL);
CREATE TABLE posts (id bigint GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
author_id bigint NOT NULL REFERENCES users(id), title text NOT NULL);
"""
)
[ada] = await db.run(insert(User).values(name="Ada")) # insert returns the new row
await db.run(insert(Post).values(author_id=ada.id, title="Hello"))
users = await db.run(select(User).where(name="Ada"))
print(users) # [User(id=1, name='Ada')]
posts = await db.run(select(Post).load(cols(Post).author))
print([(x.title, x.author.name if x.author else None) for x in posts])
asyncio.run(main())
Docs
The guide is in docs/ in the repository. Start with
docs/tutorial.md: it builds a small blog database
with migrations, from zero. The docs site is at
https://3d3n-pyc.github.io/korbase/, with llms.txt for AI assistants.
Status
Working today: models, queries, transactions, relations loaded with
.load(), the Korvex integration (pip install --pre "korbase[korvex]") and
SQL migrations with python -m korbase.migrate. SQLite works through the
standard library, with a sqlite:///app.db DSN: see docs/sqlite.md.
Not yet: the korpg driver (its extra is empty). .load() raises KorbaseError on tables with a composite
primary key.
Tests
eval "$(bash tests/pg/start.sh | grep '^export')" # Postgres in Docker, port 55433
uv run pytest
Contributor rules are in AGENTS.md. Changes are listed in CHANGELOG.md.
Metadata
Release files for korbase 0.1.0a4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| korbase-0.1.0a4.tar.gz | 237.8 kB | With provenance | Details for korbase-0.1.0a4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| korbase-0.1.0a4-py3-none-any.whl | Python 3 | none | any | Details for korbase-0.1.0a4-py3-none-any.whl |
Total release size: 307.6 kB
Release files / korbase-0.1.0a4.tar.gz
| Download URL | korbase-0.1.0a4.tar.gz |
|---|---|
| Size | 237.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
342f32e9921a13f15b139f567129c124e4a1dc7a27d03567b396f925e2d275d2
|
|
BLAKE2b-256 checksum How to use checksums |
8b9e5d4e1e5bbe9adb5747932ad70837c5280a892dc69f48cdcdf5fa31a410e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logRelease files / korbase-0.1.0a4-py3-none-any.whl
| Download URL | korbase-0.1.0a4-py3-none-any.whl |
|---|---|
| Size | 69.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e3b94dc641953cb7fd1220b4a7ee9300836616a97bc4da9a5b965ad132022f72
|
|
BLAKE2b-256 checksum How to use checksums |
1c588e3dc63decf39936d4a5f5a3994ebff319e95c26b50736c3925bb340b73b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logSecurity for korbase 0.1.0a4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for korbase-0.1.0a4.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.