Skip to main content

Immutable Map, compatible with JAX & Equinox

Project description

xmmutablemap

Jax-compatible Immutable Map

JAX prefers immutable objects but neither Python nor JAX provide an immutable dictionary. 😢
This repository defines a light-weight immutable map (lower-level than a dict) that JAX understands as a PyTree. 🎉 🕶️

Installation

PyPI platforms PyPI version

pip install xmmutablemap

Documentation

xmutablemap provides the class ImmutableMap, which is a full implementation of Python's Mapping ABC. If you've used a dict then you already know how to use ImmutableMap! The things ImmutableMap adds is 1) immutability (and related benefits like hashability) and 2) compatibility with JAX.

from xmmutablemap import ImmutableMap

print(ImmutableMap(a=1, b=2, c=3))
# ImmutableMap({'a': 1, 'b': 2, 'c': 3})

print(ImmutableMap({"a": 1, "b": 2.0, "c": "3"}))
# ImmutableMap({'a': 1, 'b': 2.0, 'c': '3'})

Development

Actions Status

We welcome contributions!

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

xmmutablemap-0.1.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

xmmutablemap-0.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file xmmutablemap-0.1.tar.gz.

File metadata

  • Download URL: xmmutablemap-0.1.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for xmmutablemap-0.1.tar.gz
Algorithm Hash digest
SHA256 b1c8e0fad1f06cebf581d43adfcf27b8cbec44bea56b3862e1b1a3d508433b78
MD5 3d7229946aeb5353ad4e305433d1a088
BLAKE2b-256 47286d72be55ddf2285a041ff10349963140932f44fbfdaf04911d9c6b8e0f94

See more details on using hashes here.

File details

Details for the file xmmutablemap-0.1-py3-none-any.whl.

File metadata

  • Download URL: xmmutablemap-0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for xmmutablemap-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9334ea1963c16258aca77acd8b3f0ebede24743f71cc591c856753d30131e2ab
MD5 33dd2cf66baf96a6e164c5caea7478c2
BLAKE2b-256 56e854c83bb090fbe711f0bad4cfd2a17274b137389dbca6f136669f8e19fecb

See more details on using hashes here.

Supported by

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