You have MUMPS, friend
Typed Python models for YottaDB, stored as ordinary globals that M code can read.
YHMF aims to give YottaDB what Odoo's ORM gives Postgres: declared models, validation, relationships, indexes, and migrations. You declare models with Pydantic. YHMF does not map them to tables. A record's owned data lives under that record's own subscripts, so each global keeps the shape of the data.
This is a pre-1.0 development candidate. These docs describe the development branch. Qualified artifacts have an exact commit and tested environment matrix. Compatibility requires explicit notes and upgrade paths for breaking changes. It is not on PyPI yet. See what works today.
Example
The first application built on YHMF is the warehouse inventory example, which tests the ORM against a stock-keeping workload. This example uses a cut-down version of its models.
from decimal import Decimal
from mccann_hub.yhmf import ChildField, Children, Database, Field, MemoryStore, Model, Registry
class Lot(Model):
number: str = Field(primary_key=True)
quantity: Decimal = Field(default=Decimal("0"), ge=0)
class Bin(Model):
code: str = Field(primary_key=True)
lots: Children[Lot] = ChildField(key="number")
class Warehouse(Model):
__global__ = "^Warehouse"
id: int = Field(primary_key=True)
name: str = "Main"
bins: Children[Bin] = ChildField(key="code")
db = Database(MemoryStore(), Registry(Warehouse)) # Use NativeStore() for YottaDB.
db.insert(
Warehouse(
id=7,
bins={"A01": Bin(code="A01", lots={"L-001": Lot(number="L-001", quantity=Decimal("12.50"))})},
)
)
def receive_one(tx): # YottaDB runs this again if another transaction conflicts.
at = ("bins", "A01", "lots", "L-001")
lot = tx.get(Warehouse, 7, at=at)
tx.patch(Warehouse, 7, at=at, changes={"quantity": lot.quantity + 1})
db.atomic(receive_one)
Before that transaction runs, NativeStore holds these nodes in YottaDB, plus four %m
metadata nodes:
^Warehouse(7,"bins")="c:1"
^Warehouse(7,"bins","s:A01")="o:1"
^Warehouse(7,"bins","s:A01","code")="s:A01"
^Warehouse(7,"bins","s:A01","lots")="c:1"
^Warehouse(7,"bins","s:A01","lots","s:L-001")="o:1"
^Warehouse(7,"bins","s:A01","lots","s:L-001","number")="s:L-001"
^Warehouse(7,"bins","s:A01","lots","s:L-001","quantity")="d:12.50"
^Warehouse(7,"id")="i:7"
^Warehouse(7,"name")="s:Main"
How it differs from an ORM on SQL
- Ownership is part of the data model. Owned records are stored under their parent. A patch to one owned record writes only that record's changed nodes, however many siblings it has.
- M code can reach the data. A plain
zwriteor$orderloop sees every record. YHMF exports M routines for flat models and keyed hierarchies. Each routine validates its write and updates indexes, references, counts, and stored sums in one transaction. Raw writes bypass those checks. - Queries have bounded plans. A filter on an unindexed field raises
QueryError, andexplain()shows the plan. There is no fallback scan. - Schema changes are explicit. A declaration that differs from the installed schema
raises
SchemaMismatchuntil you review and run a migration.
What works today
This table includes unreleased changes on main. See the changelog for release boundaries.
| Area | Works today | Not yet |
|---|---|---|
| Models | Primitive scalars, dates, UTC datetimes, UUID values, Enum/Literal choices, scalar lists, optional fields, embedded objects, keyed children, Python field inheritance, virtual computed values, root and owned Decimal stored sums | General compute callbacks, sums of derived sums, shared-global variants |
| Relationships | Enforced references, explicit resolution, bounded inverse reads, owned many-to-many links, bounded restrict/set_null/cascade deletion |
Unbounded or background cascades |
| Queries | Indexed equality, bounded predicate intersections, ordered range/prefix reads in either direction, ordered root cursors, typed query fields, unique indexes, root and child paging, occurrence projections, collection counts | Filters on unindexed fields, by design |
| Writes | Whole-record save, scalar patch, explicit patch_many groups, child insert and delete, restart-safe transactions |
Change tracking, callback-wide deferred unique checks |
| Migrations | Scalar defaults, index changes, validation-only revisions, explicit record transforms, resume after interruption, model-scoped access | Root identity/layout changes; only one maintenance job at a time |
| M access | Read every node, generated writer routines for UTF-8 str, int, Decimal, choices, dates, UTC datetimes, nullable scalars, references, and embedded objects, with equality, unique, and ordered indexes; root and child insert, patch, and delete, including populated subtree deletion; caller-transaction participants |
Populated tree construction and whole-tree replacement, nullable child collections, scalar lists, custom validators |
Known limitations lists current defects and their workarounds. Read it before you build on this project.
Try it
You need Python 3.12 or later and uv. The inventory example runs in memory, so you do not need YottaDB:
git clone https://github.com/jabez007/you-have-mumps-friend
cd you-have-mumps-friend
uv sync
uv run python -m examples.inventory
To use YHMF in your own project, follow get started. To store data durably, follow set up a YottaDB database.
Documentation
- Get started: a short tutorial.
- Documentation map: every guide, reference, and design record.
- Warehouse inventory example: a complete application.
- Architecture: goals and open questions.
- Changelog and contributing.
License
YHMF is licensed under
GPL-3.0-or-later.
The distribution is mccann-hub-yhmf, imported as mccann_hub.yhmf.
YottaDB and YDBPython have separate upstream AGPLv3 notices. See the component licenses for their terms. This repository gives no legal advice or deployment guidance.
Metadata
Release files for mccann-hub-yhmf 0.5.0
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 |
|---|---|---|---|---|
| mccann_hub_yhmf-0.5.0.tar.gz | 742.9 kB | With provenance | Details for mccann_hub_yhmf-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mccann_hub_yhmf-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for mccann_hub_yhmf-0.5.0-py3-none-any.whl |
Total release size: 893.1 kB
Release files / mccann_hub_yhmf-0.5.0.tar.gz
| Download URL | mccann_hub_yhmf-0.5.0.tar.gz |
|---|---|
| Size | 742.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5edd9ba60b5a6c51d434ce1895ed3efa425347cf5e95ed2828b869703a087409
|
|
BLAKE2b-256 checksum How to use checksums |
0814cb1f701eb89df11d9138fb85690ff3491d07ac0cecf16f693d520207366e
|
| 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 11, 2026.
Transparency logRelease files / mccann_hub_yhmf-0.5.0-py3-none-any.whl
| Download URL | mccann_hub_yhmf-0.5.0-py3-none-any.whl |
|---|---|
| Size | 150.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
09d4035b1f4e931bd43de49c0a4bec4374a80427fc91c76daef031420c0c3bc2
|
|
BLAKE2b-256 checksum How to use checksums |
85b3acd155eaf8ffad69320824552612d058c5ca8be9cacbf8cdc584fa72df3e
|
| 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 11, 2026.
Transparency logSecurity for mccann-hub-yhmf 0.5.0
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 mccann_hub_yhmf-0.5.0.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 11, 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.