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.

Related Documentation

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

meridian_euid-0.4.8.tar.gz (19.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

meridian_euid-0.4.8-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file meridian_euid-0.4.8.tar.gz.

File metadata

  • Download URL: meridian_euid-0.4.8.tar.gz
  • Upload date:
  • Size: 19.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for meridian_euid-0.4.8.tar.gz
Algorithm Hash digest
SHA256 54a67bf831088f52c395119d2cacac9354a60c3a1b084817d9b1d90f718a4b3d
MD5 0e832259a01043139910cf8af9376b89
BLAKE2b-256 3433599f4ce7a6d018ac307cadc604cdb32f02c5b4678fb9503b7216fd8a8d91

See more details on using hashes here.

File details

Details for the file meridian_euid-0.4.8-py3-none-any.whl.

File metadata

  • Download URL: meridian_euid-0.4.8-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for meridian_euid-0.4.8-py3-none-any.whl
Algorithm Hash digest
SHA256 c36e96b36c78da427b200bda7f76c23bd7db74dbe32b54a473134e2f1f61b946
MD5 f6cb294acb592c1c67225987a5357577
BLAKE2b-256 f067c6a33b4af287d8b9951f1d69ce7d62bf73cc83541272f7728c2118c14dfc

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.4.8 This release

2 files

0.4.7

2 files

0.4.5

2 files

0.4.2

2 files

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