Skip to main content

MetaObjects (Python)

The Python port of the MetaObjects cross-language metadata standard: declare your typed entity model once, then generate idiomatic, drift-checked code across TypeScript, Java, C#, Python, and Kotlin. The metamodel is the durable spine; generated code is the disposable artifact.

Behavior is verified byte-for-byte against the same shared conformance corpora as every other language port.

Install

Requires Python 3.11+.

pip install metaobjects

The only runtime dependency is PyYAML.

Quick start

Load a directory of metadata (*.json canonical or sigil-free *.yaml):

from metaobjects import load_directory

result = load_directory("metaobjects/")   # your *.json / *.yaml metadata files

if result.errors:
    for err in result.errors:
        print(err)          # structured MetaError with a stable ErrorCode
else:
    root = result.root      # the merged metadata tree (a MetaData node)
    print(root)

load_directory, load_uris, and load_string are module-level shortcuts over MetaDataLoader; all return a LoadResult with the same field shape as the other ports.

What's in the package

The primary public API is the loader (load_directory / load_uris / load_string, MetaDataLoader, LoadResult, ErrorCode, MetaError). The distribution also ships the Python implementations of the other pillars used by the CLI and tooling: codegen (Pydantic + FastAPI emit — reference generators you own: metaobjects eject <name> copies one into your repo), render (Mustache, or Jinja with pip install metaobjects[jinja] — ADR-0061 — + payload-VO + verify), and runtime (a DB-API 2 ObjectManager — pg8000 / psycopg on Postgres, the standard library's sqlite3 on SQLite, PyMySQL on MySQL 8 (pip install metaobjects[mysql]) — no SQLAlchemy). Schema migrations are owned by the TypeScript meta CLI (ADR-0015); there is no migrate module in this distribution.

Physical names

Table and column names are one project setting, naming in .metaobjects/config.json (columns and tables, each snake_case by default or literal). metaobjects gen and verify read it, and so do load_directory, load_uris and load_string(..., project_dir=...): they search upward from the metadata directory for that file, so the ObjectManager queries the names the code was generated for. If you keep a database whose columns are named exactly like the fields, add "naming": { "columns": "literal" }. With no config file found the loader warns once and uses snake_case; metaobjects.naming.attach_naming(root, project_dir) sets it explicitly and wins. See the upgrade guide and physical naming.

Authoring formats

  • Canonical JSON (*.json) — the cross-language interchange shape.
  • Sigil-free YAML (*.yaml / *.yml) — the AI-first authoring front-end (ADR-0006). Desugared to canonical JSON at load time. A directory may mix both freely.

AI assistant context

To scaffold MetaObjects context files (.metaobjects/AGENTS.md, .metaobjects/CLAUDE.md, and .claude/skills/metaobjects-*/) into your project so your AI assistant understands how to author metadata and run codegen, use the Node meta CLI:

npx meta agent-docs --server python

(Running metaobjects agent-docs in the Python CLI prints this redirect and exits.)

License

Apache-2.0. See LICENSE.

Metadata

Release files for metaobjects 1.2.3

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

Source distribution (sdist)

Source distribution for metaobjects 1.2.3
File Size Uploaded Provenance Actions
metaobjects-1.2.3.tar.gz 1.3 MB Without provenance Details for metaobjects-1.2.3.tar.gz

Built distribution (wheel)

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

Total release size: 2.1 MB

Release files / metaobjects-1.2.3.tar.gz

Download URL metaobjects-1.2.3.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
fb36c19694347389cdb8581f4b1d4ab3e9751cd6fb9eb0641ea6facd625dd996
BLAKE2b-256 checksum
How to use checksums
04d160a68ba7df6a185922a1aa9fdbdb9c7b42b827f14b712731c48c885afcef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / metaobjects-1.2.3-py3-none-any.whl

Download URL metaobjects-1.2.3-py3-none-any.whl
Size 803.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
43a32b09a0c068177445081179524569385cb6e486e57e31b359eb844b82ca12
BLAKE2b-256 checksum
How to use checksums
d3749373cb24a8e337d5c77945aa9bf84bfa672b0412a00c7d72d3c5f5699a85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for metaobjects 1.2.3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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

1.2.3 This release

2 release files No 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