Skip to main content

pytypehintstore

PyPI version Python License

Rows of one validated dataclass, in memory, shadowed by a JSON file you can open and edit. The class is the database.

The rows live in a dict and every read answers from there; a writer thread carries them to a file named for the class and the fingerprint of its compiled schema — Task.a50534e4.json. Change one character of the contract, a type, a limit, a default, a Label, and it is a different database: a new file, with the old one left beside it, whole and readable.

That is the whole of it, and it is what buys the guarantee: if the file opens, every row in it is valid against this exact schema.

Install

pip install pytypehintstore

That brings pytypehint with it, the only dependency, pinned to the exact version this release was built against. Stdlib otherwise. Python 3.11+, py.typed included.

Quick start

from dataclasses import dataclass
from enum import Enum
from typing import Annotated

from pytypehint import Max, Min
from pytypehintstore import store_of


class Priority(Enum):
    LOW = "low"
    HIGH = "high"


@dataclass
class Task:
    title: Annotated[str, Min(1), Max(80)]
    priority: Priority = Priority.LOW
    done: bool = False


tasks = store_of(Task, "data")
tasks.path.name                        # 'Task.a50534e4.json'

first = tasks.add(Task(title="Buy milk", priority=Priority.HIGH))   # 1
second = tasks.add(Task(title="Write the store"))                   # 2

tasks.get(first)                       # Task(title='Buy milk', priority=<Priority.HIGH: 'high'>, done=False)
tasks.put(second, Task(title="Write the store", done=True))
tasks.remove(first)

len(tasks)                             # 1
second in tasks                        # True
tasks.all()                            # [(2, Task(title='Write the store', ...))]

tasks.close()                          # the file is on disk when this returns

Reopen it and the rows are there with the same ids. Ids are spent, never recycled, so the next add gives 3.

Documentation

  • The guarantee: every row a store opens was rebuilt through your schema.
  • The identity: the file name, and why any change to the class is a new database.
  • The file: the JSON on disk, editing it by hand, and every load error.
  • Writing: debounced, atomic dumps, rotated copies and close().
  • The lock: one process per store, and how orphaned lockfiles are taken over.
  • API: store_of, its methods and its exceptions.
  • Known limits: what the store does not do, stated plainly.
  • Changelog

Ecosystem

  • pytypehint compiles standard Python type hints into strict, inspectable schemas. It is the validation this store defers to, and the schema it fingerprints.
  • pytypehintweb compiles the same schemas into a browser runtime for forms — the transport this store writes to disk is the shape it speaks.
  • FuncToWeb exposes typed Python functions through generated web interfaces. A store is the small persistence such an app usually wants, without adding a database to it.

Metadata

Release files for pytypehintstore 1.0.1

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

Source distribution (sdist)

Source distribution for pytypehintstore 1.0.1
File Size Uploaded
pytypehintstore-1.0.1.tar.gz 104.7 kB Details

Built distribution (wheel)

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

Total release size: 119.2 kB

Release files / pytypehintstore-1.0.1.tar.gz

Download URL pytypehintstore-1.0.1.tar.gz
Size 104.7 kB
Tags Source
SHA-256 checksum
How to use checksums
42b4b3437fa1df8068923f0358af588d11b3de41f3ebb26d1831b2af7f6f54c3
BLAKE2b-256 checksum
How to use checksums
ed91f525ea6b89cfa8a0d015d3821e871342302496960832cfdbe3d99109f58e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 29, 2026.

Transparency log

Release files / pytypehintstore-1.0.1-py3-none-any.whl

Download URL pytypehintstore-1.0.1-py3-none-any.whl
Size 14.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8c37b6a89da5312ab56273be5d1e0297231b3857c7adb4a58eda6f59fe0ba67d
BLAKE2b-256 checksum
How to use checksums
bcd20e43c5293f9def5e9ff0981b591c2fab61c00871ef5869954a578fccbc3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 29, 2026.

Transparency log

Release history Release notifications | RSS feed

1.0.3

2 release files

1.0.2

2 release files

This release

1.0.1 This release

2 release files

1.0.0

2 release files

0.0.4

2 release files

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