Skip to main content

meridian-euid (Python)

Python CI GitHub Release License: MIT

Python reference implementation of the Meridian EUID specification.

Installation

Python 3.10 or newer is required.

pip install meridian-euid==1.0.0

Format contract

Shape (abstract grammar) Result
DOMAIN-PREFIX-BODY-CHECKSUM v3: separator-aware checksum
DOMAIN-PREFIX-BODYCHECKSUM v2: original checksum
One hyphen, other counts, or empty components Reject

Reject leading/trailing/consecutive hyphens, lowercase, whitespace, non-ASCII, and noncanonical characters. Existing identifiers are returned unchanged. New encode() output always uses v3. Package version 1.0.0 and wire-format numbers 2/3 are separate concepts.

CLI

meridian-euid validate "$PERSISTED_EUID"
meridian-euid parse "$PERSISTED_EUID"
# DOMAIN, PREFIX and ALLOCATED_INTEGER must come from the owning allocator.
meridian-euid encode "$ALLOCATED_INTEGER" "$PREFIX" --domain-code "$DOMAIN"
# V3_PAYLOAD contains DOMAIN-PREFIX-BODY-, including its final hyphen.
meridian-euid compute-check "$V3_PAYLOAD" --format-version 3
# V2_PAYLOAD contains DOMAIN+PREFIX+BODY with no separators.
meridian-euid compute-check "$V2_PAYLOAD" --format-version 2

compute-check defaults to format 3. validate and parse select the contract from the input's structure; no flag or trial of alternative algorithms is needed.

Programmatic API

from meridian_euid import encode, parse, validate, compute_check_character

canonical = validate(persisted_euid)  # unchanged string, or EUIDError
parts = parse(persisted_euid)
# Keys: domain_code, prefix, body, checksum, integer, format_version (2 or 3).

# Formatting does not allocate or persist an identity.
rendered = encode(allocated_integer, owned_prefix, domain_code=owned_domain)

new_check = compute_check_character(v3_payload)  # includes all three hyphens
old_check = compute_check_character(v2_payload, format_version=2)

The v3 checksum uses the existing MOD 32 arithmetic. Each hyphen contributes zero and consumes an alternating-weight position. Include the final separator before CHECKSUM. The v2 algorithm remains byte-for-byte unchanged.

Upgrade

Upgrade readers before issuing the new format. Do not relabel or rewrite existing stored IDs. The same allocator continues advancing; IDs of both formats can coexist. The checksum remains one error-detection layer and does not promise detection of every rearrangement.

Governance helpers

from meridian_euid import (
    MERIDIAN_REGISTRY_INDEX_URL,
    check_domain_availability,
    assert_prefix_issuer_app_code,
    assert_registered_domain,
    load_domain_registry,
    load_prefix_ownership_registry,
    resolve_prefix_issuer_app_code,
    validate_issuer_app_code,
    validate_registries_consistent,
)

domains = load_domain_registry()
ownership = load_prefix_ownership_registry()

assert_registered_domain("A1", registry=domains)
assert_registered_domain(
    "M",
    reserved_for="LSMC",
    deployment_environment="production",
)
assert_registered_domain(
    "M",
    reserved_for="LSMC",
    deployment_environment="staging",
    approval_tokens=["approval-a", "approval-b", "approval-c"],
)
assert validate_issuer_app_code("meridian.lims") == "meridian.lims"
assert resolve_prefix_issuer_app_code("A1", "Z9", registry=ownership) == "meridian.lims"
assert_prefix_issuer_app_code("A1", "Z9", "meridian.lims", registry=ownership)
validate_registries_consistent()

Domain and hosted prefix requests must be PRs targeting main in lsmc-bio/meridian-registry. Reserved namespaces require their current authority's approval. Only an authorized merge grants an assignment; local files and open PRs do not.

The public domain-code authority is lsmc-bio/meridian-registry. The current pinned generated index URL is available as MERIDIAN_REGISTRY_INDEX_URL, but the library does not fetch it at runtime. Pass an explicit local path:

result = check_domain_availability(
    "N",
    registry_index_path="/path/to/registry/generated/domains.json",
)
assert result["available"] is False

The CLI exposes the same explicit check:

meridian-euid domain-check N --registry-index /path/to/registry/generated/domains.json

When called without path=..., the legacy helper functions load bundled JSON fixtures shipped inside the wheel. Pass path= to point at an alternate local registry file. These fixtures are not the public domain-code authority. Use the hosted registry's generated prefix_ownership.json with load_prefix_ownership_registry(path=...) only after explicitly adopting an accepted snapshot. It exports assigned prefixes and starts empty until holders import grants. An explicitly supplied empty mapping stays empty; it does not select the bundled example claims.

The public domain-availability index is not the runtime domain-policy metadata format. Keep the deployment's explicit domain-authorization configuration. assert_registered_domain rejects retired and disputed domains for issuance; ordinary parsing and checksum validation of existing identifiers are unchanged.

issuer_app_code values are governance tokens, not part of the canonical EUID grammar. They MUST match:

^[a-z0-9]+(?:[._-][a-z0-9]+)*$

Exceptions

from meridian_euid import (
    EUIDChecksumError,
    EUIDDomainCodeError,
    EUIDError,
    EUIDFormatError,
    EUIDGovernanceError,
    EUIDIssuerAppCodeError,
    EUIDPrefixOwnershipError,
)
Exception Raised when
EUIDFormatError Canonical syntax, prefix, BODY, or checksum-token validation fails
EUIDChecksumError The checksum does not match
EUIDDomainCodeError The domain token is syntactically invalid
EUIDGovernanceError Registry-backed governance checks fail
EUIDIssuerAppCodeError An issuer_app_code fails grammar validation
EUIDPrefixOwnershipError A prefix is unclaimed or claimed by a different issuer_app_code

Historical test suite

pytest --cov --cov-report=term-missing
ruff check meridian_euid tests
mypy meridian_euid --ignore-missing-imports

The shared test-vectors/v3.json filename refers to a historical vector-set revision for the two-hyphen contract, not wire format v3. No tests were run for release 1.0.0; this suite is not release acceptance evidence.

Metadata

Release files for meridian-euid 1.0.0

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

Source distribution (sdist)

Source distribution for meridian-euid 1.0.0
File Size Uploaded Provenance Actions
meridian_euid-1.0.0.tar.gz 21.5 kB Without provenance Details for meridian_euid-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for meridian-euid 1.0.0
File Interpreter ABI Platform Actions
meridian_euid-1.0.0-py3-none-any.whl Python 3 none any Details for meridian_euid-1.0.0-py3-none-any.whl

Total release size: 38.1 kB

Release files / meridian_euid-1.0.0.tar.gz

Download URL meridian_euid-1.0.0.tar.gz
Size 21.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e873e31d8ab85e04a5e63271024314e8bf2776dc01b410a06081614fc0f87245
BLAKE2b-256 checksum
How to use checksums
64dae0013a9ca854d1433304768d123c7969fb715b48a3367c892e7a9d6867d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / meridian_euid-1.0.0-py3-none-any.whl

Download URL meridian_euid-1.0.0-py3-none-any.whl
Size 16.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3669fba604b8b170a73aedc0733f731e372b942049040b7fec148ae15f1624be
BLAKE2b-256 checksum
How to use checksums
14c88d4a7b18d327c9e8210aaaadd3582ed965bcd4efcff66735ce726bffed4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Security for meridian-euid 1.0.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.

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.

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