Skip to main content

Shared typing primitives for Money Ex Machina.

Project description

mxm-types

Version License Python Checked with pyright

Shared typing primitives for the Money Ex Machina ecosystem.

mxm-types provides a canonical, dependency-free set of JSON/path aliases and micro-protocols used across MXM packages.
It is intentionally small, stable, and domain-agnostic. All domain models live in their respective packages.

Install

pip install mxm-types

Overview

mxm-types defines:

  • Strict JSON tree types for use across configuration, metadata, requests, and portable data structures.
  • Lightweight aliases for common patterns (e.g., path-like values).
  • Micro-protocols for cross-cutting interfaces (e.g., objects with a get method).
  • PEP 561 typing support (py.typed included in the wheel).

The package has no runtime dependencies.

Public API

The following names form the stable public API of mxm-types.
All other names are private and may change across releases.

JSON Types

Name Description
JSONScalar str | int | float | bool | None
JSONValue Strict recursive JSON tree: scalars, list[JSONValue], dict[str, JSONValue]
JSONLike Permissive tree for accepting general Sequence/Mapping inputs
JSONObj Mapping[str, JSONValue] — preferred for function parameters
JSONMap dict[str, JSONValue] — preferred for concrete, mutable results

Paths

Name Description
StrPath str | PathLike[str]

Protocols and TypedDicts

Name Description
KVReadable Minimal protocol: objects exposing a get(key, default) method
CLIFormatOptions Optional formatting hints for CLI output ("plain" | "rich" | "json")

Usage

from mxm.types import (
    JSONValue,
    JSONObj,
    JSONMap,
    StrPath,
    KVReadable,
    CLIFormatOptions,
)

def load_metadata(path: StrPath) -> JSONObj:
    ...

For permissive JSON acceptance (e.g., reading config from arbitrary Python structures):

from mxm.types import JSONLike

def normalise(data: JSONLike) -> JSONValue:
    ...

Design Principles

  • Minimal surface: only house-style primitives, no domain models.
  • Dependency-free: safe to import everywhere, including low-level layers.
  • PEP 695 type aliases: modern, expressive, static-typing-friendly.
  • Strict JSON encouraged: permissive types optional and explicit.

Development

poetry install
poetry run ruff check .
poetry run pyright
poetry run pytest -q
poetry build

License

MIT License. See LICENSE.

Project details


Download files

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

Source Distribution

mxm_types-0.1.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

mxm_types-0.1.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file mxm_types-0.1.0.tar.gz.

File metadata

  • Download URL: mxm_types-0.1.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mxm_types-0.1.0.tar.gz
Algorithm Hash digest
SHA256 63fb6bae5cf43b6b298a6546deee7dfa0cba697dce00c5bb500154b51273350c
MD5 71c93a6d4c8b70964defa833d82bd269
BLAKE2b-256 167a8c6bd222492c06ce965cc6d9179a1a879718b8c06c1855d6d9994a764f89

See more details on using hashes here.

Provenance

The following attestation bundles were made for mxm_types-0.1.0.tar.gz:

Publisher: release.yml on moneyexmachina/mxm-types

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mxm_types-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mxm_types-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mxm_types-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 44d8120c9545d76efbbed508c244d9955b37ac14a58cedb26322e0b205132f0b
MD5 959a8f660673b112df13cddbc3a689d1
BLAKE2b-256 0fdee842f0d7574b9b4b8eeb81d137bbfc8538f74b8b3d03c35f7df5cf32772f

See more details on using hashes here.

Provenance

The following attestation bundles were made for mxm_types-0.1.0-py3-none-any.whl:

Publisher: release.yml on moneyexmachina/mxm-types

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page