Skip to main content

Light-weight pythonic db integration - powered by the best of all time: sqlite and pydantic

Project description

lythonic

PyPI version Documentation

Lythonic
Lightweight, reliable tools for database management and job scheduling in Python — built atop powerful industry standards: SQLite and Pydantic.

Lythonic helps you easily manage persistent data and scheduled tasks in your Python applications, no matter their size or complexity. It combines the trusted simplicity of SQLite (the world’s most used database) with Pydantic (the gold standard for data validation and modeling) to provide an effortless, modern development experience.

Why use lythonic?

  • Zero setup: No need to run a database server or learn new dialects. SQLite is embedded and self-contained.
  • Reliable models: Define your data models with clear type-checking, validation, and conversion using Pydantic.
  • Easy scheduling: Integrates simple, robust job/task scheduling primitives (coming soon) for recurring or deferred operations.
  • Pythonic APIs: Focus on productivity, safety, and clarity, following modern Python best practices throughout.

Quick Start for Developers

from pathlib import Path
from lythonic.state import DbModel, open_sqlite_db
from pydantic import Field

# Define your Pydantic-based model with automatic DDL generation
class Note(DbModel["Note"]):
    note_id: int = Field(default=-1, description="(PK) Unique identifier")
    content: str = Field(description="Note content")

# Create a new SQLite database or connect to existing:
db_path = Path("notes.db")
with open_sqlite_db(db_path) as conn:
    # Setup schema if it's new
    conn.execute(Note.create_ddl())
    conn.commit()

    # Insert a note
    n = Note(content="Hello world!")
    n.save(conn)   # Auto-assigns primary key
    conn.commit()

    # Query by id
    loaded = Note.load_by_id(conn, n.note_id)
    print(loaded.content)

You get:

  • Seamless storage and retrieval of strongly-typed Python objects.
  • No boilerplate: No need to hand-write SQL or adapters for most basic use.
  • Atomic, testable operations: See tabula_rasa_path and test files for utilities on prepping file/db state for clean test runs.

At a Glance

  • Models are defined as Pydantic classes — strict types, clear defaults, easy serialization.
  • Data is stored in local, portable .db files using SQLite.
  • Utilities for file and directory lifecycle, safe test/cleanup (see misc.py).
  • Test suite demonstrates end-to-end use: see /tests.
  • No heavy dependencies or servers; the whole stack is pure Python.

Suitable for scripts, data apps, bot backends, experiments, quick prototypes, or serious projects where simplicity and reliability win.

See project docs and modules for advanced usage and extension patterns.


Project Docs

For how to install uv and Python, see installation.md.

For development workflows, see development.md.

For instructions on publishing to PyPI, see publishing.md.

For documentation strategy and MkDocs setup, see documenting.md.


This project was built from simple-modern-uv.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lythonic-0.0.8.tar.gz (124.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lythonic-0.0.8-py3-none-any.whl (40.4 kB view details)

Uploaded Python 3

File details

Details for the file lythonic-0.0.8.tar.gz.

File metadata

  • Download URL: lythonic-0.0.8.tar.gz
  • Upload date:
  • Size: 124.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.13

File hashes

Hashes for lythonic-0.0.8.tar.gz
Algorithm Hash digest
SHA256 de6e965bab79890ac40a12d1c7f8760caad983082902c80a534e20d3b2467133
MD5 97c54677469f837e03fcedd6f711b217
BLAKE2b-256 90e1cd101832c6d015110b3191e12f662123d135fbb570c8e2786aaa07ae48c8

See more details on using hashes here.

File details

Details for the file lythonic-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: lythonic-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 40.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.13

File hashes

Hashes for lythonic-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 195141b56561dfd83fd5ca7c4e61d083dd1ebce317a3352c4d931d03f0cfa971
MD5 a4139d4343688f773734589e4b053efe
BLAKE2b-256 37872078e575038c628b56335bff4a2dc9e60fbe463642d538fcd3c16fa9e48f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page