odin-foundation
Official Python SDK for ODIN (Open Data Interchange Notation) — a canonical data model for transporting meaning between systems, standards, and AI.
Install
pip install odin-foundation
Requires Python 3.8+
Quick Start
import odin
doc = odin.parse("""
{policy}
number = "PAP-2024-001"
effective = 2024-06-01
premium = #$747.50
active = ?true
""")
print(doc["policy.number"]) # "PAP-2024-001"
print(doc["policy.premium"]) # 747.50
text = odin.dumps(doc)
Core API
| Function | Description | Example |
|---|---|---|
odin.parse(text) |
Parse ODIN text into a document | doc = odin.parse(src) |
odin.dumps(doc) |
Serialize document to ODIN text | text = odin.dumps(doc) |
odin.loads(text) |
Alias for parse (Python-idiomatic) |
doc = odin.loads(src) |
odin.stringify(doc) |
Alias for dumps |
text = odin.stringify(doc) |
odin.canonicalize(doc) |
Deterministic bytes for hashing/signatures | b = odin.canonicalize(doc) |
odin.validate(doc, schema) |
Validate against an ODIN schema | result = odin.validate(doc, schema) |
odin.parse_schema(text) |
Parse a schema definition | schema = odin.parse_schema(src) |
odin.diff(a, b) |
Structured diff between two documents | changes = odin.diff(doc_a, doc_b) |
odin.patch(doc, diff) |
Apply a diff to a document | updated = odin.patch(doc, changes) |
odin.parse_transform(text) |
Parse a transform specification | tx = odin.parse_transform(src) |
odin.execute_transform(tx, source) |
Run a transform on data | out = odin.execute_transform(tx, doc) |
doc.to_json() |
Export to JSON | json_str = doc.to_json() |
doc.to_xml() |
Export to XML | xml_str = doc.to_xml() |
doc.to_csv() |
Export to CSV | csv_str = doc.to_csv() |
odin.dumps(doc) |
Export to ODIN | odin_str = odin.dumps(doc) |
odin.builder() |
Fluent document builder | odin.builder().section("policy")... |
Schema Validation
import odin
schema = odin.parse_schema("""
{policy}
!number : string
!effective : date
!premium : currency
active : boolean
""")
doc = odin.parse(source)
result = odin.validate(doc, schema)
if not result.valid:
for error in result.errors:
print(error)
Transforms
import odin
transform = odin.parse_transform("""
map policy -> record
policy.number -> record.id
policy.premium -> record.amount
""")
result = odin.execute_transform(transform, doc)
Export
odin_str = odin.dumps(doc) # ODIN string
json_str = doc.to_json() # JSON string
xml_str = doc.to_xml() # XML string
csv_str = doc.to_csv() # CSV string
Builder
doc = (odin.builder()
.section("policy")
.set("number", "PAP-2024-001")
.set("effective", date(2024, 6, 1))
.set("premium", odin.currency(747.50))
.set("active", True)
.build())
Testing
Tests use pytest and the shared golden test suite:
pytest
Links
Release files for odin-foundation 1.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| odin_foundation-1.2.3.tar.gz | 351.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| odin_foundation-1.2.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 589.4 kB
Release files / odin_foundation-1.2.3.tar.gz
| Download URL | odin_foundation-1.2.3.tar.gz |
|---|---|
| Size | 351.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a564be3885484142ca4e6f77044b44d5cd5094c7a9b8703529ed51325f71cb34
|
|
BLAKE2b-256 checksum How to use checksums |
9bd957a5b61e9d1923be596f4d653df3dab736c4dc31c113a43eeddef255136f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jul 1, 2026.
Transparency logRelease files / odin_foundation-1.2.3-py3-none-any.whl
| Download URL | odin_foundation-1.2.3-py3-none-any.whl |
|---|---|
| Size | 237.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c7362ba94f7ecad16da0c5b3b0507750510d0440a894d3b678cbf035d12182f7
|
|
BLAKE2b-256 checksum How to use checksums |
5f6323fa9de34bb7b891c0a4fb58c8b929e9163550d552aa4d6fab11876f43ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jul 1, 2026.
Transparency log