Skip to main content

meridian-euid (Python)

Python CI GitHub Release License: MIT

Python reference implementation of the Meridian EUID specification.

The v0.4.0 line is strict and canonical:

  • one syntax: DOMAIN-PREFIX-BODYCHECKSUM
  • one validation mode
  • no sandbox aliases
  • no absent-domain form
  • no tolerant normalization

Requirements

  • Python 3.10+

Installation

From source (development)

git clone https://github.com/lsmc-bio/meridian-euid.git
cd meridian-euid/reference-implementations/python

pip install -e .
pip install -e ".[dev]"

CLI Usage

The meridian-euid command provides four subcommands.

validate

Validate a canonical EUID.

meridian-euid validate A1-Z9-3V9

encode

Encode an integer as a canonical EUID.

meridian-euid encode 123 Z9 --domain-code A1
Argument/Option Required Description
integer Yes Integer in 1..9223372036854775807
prefix Yes Prefix token (1-4 uppercase Crockford Base32 characters)
--domain-code Yes Domain token (1-4 uppercase Crockford Base32 characters)

parse

Parse a validated EUID into its components.

meridian-euid parse A1-Z9-3V9

compute-check

Compute the check character for a payload.

# Payload is DOMAIN + PREFIX + BODY, with no hyphens
meridian-euid compute-check A1Z93V

Programmatic API

Canonical functions

from meridian_euid import (
    BIGINT_MAX,
    compute_check_character,
    encode,
    is_valid,
    parse,
    validate,
)

assert validate("A1-Z9-3V9") == "A1-Z9-3V9"
assert is_valid("A1-Z9-3V9") is True
assert encode(123, "Z9", domain_code="A1") == "A1-Z9-3V9"
assert parse("A1-Z9-3V9") == {
    "domain_code": "A1",
    "prefix": "Z9",
    "body": "3V",
    "checksum": "9",
    "integer": 123,
}
assert compute_check_character("A1Z93V") == "9"
assert BIGINT_MAX == 9223372036854775807

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()

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.

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

Running Tests

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

Tests use shared vectors from test-vectors/v3.json.

Metadata

Release files for meridian-euid 0.4.8

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 0.4.8
File Size Uploaded Provenance Actions
meridian_euid-0.4.8.tar.gz 19.4 kB Without provenance Details for meridian_euid-0.4.8.tar.gz

Built distribution (wheel)

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

Total release size: 34.7 kB

Release files / meridian_euid-0.4.8.tar.gz

Download URL meridian_euid-0.4.8.tar.gz
Size 19.4 kB
Tags Source
SHA-256 checksum
How to use checksums
54a67bf831088f52c395119d2cacac9354a60c3a1b084817d9b1d90f718a4b3d
BLAKE2b-256 checksum
How to use checksums
3433599f4ce7a6d018ac307cadc604cdb32f02c5b4678fb9503b7216fd8a8d91
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-0.4.8-py3-none-any.whl

Download URL meridian_euid-0.4.8-py3-none-any.whl
Size 15.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c36e96b36c78da427b200bda7f76c23bd7db74dbe32b54a473134e2f1f61b946
BLAKE2b-256 checksum
How to use checksums
f067c6a33b4af287d8b9951f1d69ce7d62bf73cc83541272f7728c2118c14dfc
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 0.4.8

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