Skip to main content

Arcanus

Tests Codecov CodSpeed Docs Python 3.11+ License: MIT

Arcanus is a small library that binds Pydantic schemas to your datasource. The idea is to let you work with one set of typed, validated objects that are backed by your real backend records — so the templates, factories, and converters that usually sit between validation and persistence mostly fall away. If that boilerplate has bothered you too, this is the approach Arcanus takes to it.

It's a different take from SQLModel, which fuses the Pydantic model and the ORM table into one class. Arcanus instead keeps them separate and binds a schema to your existing ORM model with bless(), so your SQLAlchemy models stay untouched and your validation schema stays your own.

⚠️ Work in progress. Arcanus is at an early, minimum-viable stage — expect bugs and breaking changes. SQLAlchemy is currently the only supported backend.

Features

  • 🔄 Unified objects — transmuters are backed by ORM objects; changes sync both ways, no manual conversion.
  • 🛡️ Type safety — full Pydantic validation, plus typed column references like Author["name"].
  • 🔗 Relationships — one-to-one, one-to-many, many-to-many, and keyed maps that respect lazy loading.
  • ⚡ Async — native async/await via AsyncSession.
  • 🎯 Pluggable backends — NoOpMateria for tests, SqlalchemyMateria for databases.
  • 📦 Partial models — built-in Create / Update shapes for API boundaries.

Installation

pip install "arcanus[sqlalchemy]"

The base pip install arcanus ships the in-memory NoOpMateria (no backend needed) — ideal for tests and prototyping.

Quickstart

from arcanus.base import BaseTransmuter, Identity
from arcanus.association import (
    Relation,
    RelationCollection,
    Relationship,
    Relationships,
)
from arcanus.materia.sqlalchemy import SqlalchemyMateria, Session
from pydantic import Field
from sqlalchemy import create_engine, select
from typing import Annotated, Optional

materia = SqlalchemyMateria()


@materia.bless(AuthorModel)  # bind to your existing SQLAlchemy model
class Author(BaseTransmuter):
    id: Annotated[Optional[int], Identity] = Field(default=None, frozen=True)
    name: str
    books: RelationCollection["Book"] = Relationships()


@materia.bless(BookModel)
class Book(BaseTransmuter):
    id: Annotated[Optional[int], Identity] = Field(default=None, frozen=True)
    title: str
    author: Relation[Author] = Relationship()


with Session(create_engine("sqlite://")) as session:
    author = Author(name="Isaac Asimov")
    session.add(Book(title="Foundation", author=Relation(author)))
    session.commit()

    # Plain SQLAlchemy reads — only the results come back as transmuters
    found = session.execute(
        select(Author).filter_by(name="Isaac Asimov")
    ).scalar_one()  # a transmuter, not a raw ORM row
    for book in found.books:  # loads on access
        print(book.title, book.author.value is found)  # identity preserved

See the Quickstart guide for the full walkthrough including the ORM model definitions and async usage.

Documentation

Full documentation lives at kalynnka.github.io/arcanus:

Contributing

See CONTRIBUTING.md for branch naming, conventional commits, and the release flow.

License

MIT

Metadata

Release files for arcanus 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for arcanus 0.1.4
File Size Uploaded Provenance Actions
arcanus-0.1.4.tar.gz 383.5 kB With provenance Details for arcanus-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for arcanus 0.1.4
File Interpreter ABI Platform Actions
arcanus-0.1.4-py3-none-any.whl Python 3 none any Details for arcanus-0.1.4-py3-none-any.whl

Total release size: 453.1 kB

Release files / arcanus-0.1.4.tar.gz

Download URL arcanus-0.1.4.tar.gz
Size 383.5 kB
Tags Source
SHA-256 checksum
How to use checksums
02dc58260a0e9d4f3915feb31f7e7d63b2733858bfeefb072661e2c5d2cfaa1c
BLAKE2b-256 checksum
How to use checksums
cb43e081658e7fcf9e20edd9a9db94d0c556a7d9ec948fca6c8ae5c4cf804f2c
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 12, 2026.

Transparency log

Release files / arcanus-0.1.4-py3-none-any.whl

Download URL arcanus-0.1.4-py3-none-any.whl
Size 69.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f757d3f5bb5e881b5ea517f96f6b603739ab6809e40841d435389090e4a496cd
BLAKE2b-256 checksum
How to use checksums
ae47fb18e4f9a3ab9a1ab54d383cf23d6f7f90bb42bd2aca50b452e335e7ecda
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 12, 2026.

Transparency log

Security for arcanus 0.1.4

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.

Select from 2 files

Attestation for arcanus-0.1.4.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 12, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page