|
1 | | -# immutable_map_jax |
| 1 | +<h1 align='center'> xmmutablemap </h1> |
| 2 | +<h2 align="center"><cod>Jax</code>-compatible Immutable Map</h2> |
2 | 3 |
|
3 | | -[![Actions Status][actions-badge]][actions-link] |
4 | | -[![Documentation Status][rtd-badge]][rtd-link] |
| 4 | +JAX prefers immutable objects but neither Python nor JAX provide an immutable |
| 5 | +dictionary. 😢 </br> This repository defines a light-weight immutable map |
| 6 | +(lower-level than a dict) that JAX understands as a PyTree. 🎉 🕶️ |
| 7 | + |
| 8 | +## Installation |
5 | 9 |
|
6 | | -[![PyPI version][pypi-version]][pypi-link] |
7 | | -[![Conda-Forge][conda-badge]][conda-link] |
8 | 10 | [![PyPI platforms][pypi-platforms]][pypi-link] |
| 11 | +[![PyPI version][pypi-version]][pypi-link] |
| 12 | + |
| 13 | +<!-- [![Conda-Forge][conda-badge]][conda-link] --> |
| 14 | + |
| 15 | +```bash |
| 16 | +pip install xmmutablemap |
| 17 | +``` |
| 18 | + |
| 19 | +## Documentation |
9 | 20 |
|
10 | | -[![GitHub Discussion][github-discussions-badge]][github-discussions-link] |
| 21 | +<!-- [![Documentation Status][rtd-badge]][rtd-link] --> |
| 22 | + |
| 23 | +`xmutablemap` provides the class `ImmutableMap`, which is a full implementation |
| 24 | +of |
| 25 | +[Python's `Mapping` ABC](https://docs.python.org/3/library/collections.abc.html#collections-abstract-base-classes). |
| 26 | +If you've used a `dict` then you already know how to use `ImmutableMap`! The |
| 27 | +things `ImmutableMap` adds is 1) immutability (and related benefits like |
| 28 | +hashability) and 2) compatibility with `JAX`. |
| 29 | + |
| 30 | +```python |
| 31 | +from xmmutablemap import ImmutableMap |
| 32 | + |
| 33 | +print(ImmutableMap(a=1, b=2, c=3)) |
| 34 | +# ImmutableMap({'a': 1, 'b': 2, 'c': 3}) |
| 35 | + |
| 36 | +print(ImmutableMap({"a": 1, "b": 2.0, "c": "3"})) |
| 37 | +# ImmutableMap({'a': 1, 'b': 2.0, 'c': '3'}) |
| 38 | +``` |
| 39 | + |
| 40 | +## Development |
| 41 | + |
| 42 | +[![Actions Status][actions-badge]][actions-link] |
11 | 43 |
|
12 | | -<!-- SPHINX-START --> |
| 44 | +We welcome contributions! |
13 | 45 |
|
14 | 46 | <!-- prettier-ignore-start --> |
15 | | -[actions-badge]: https://github.com/GalacticDynamics/immutable_map_jax/workflows/CI/badge.svg |
16 | | -[actions-link]: https://github.com/GalacticDynamics/immutable_map_jax/actions |
17 | | -[conda-badge]: https://img.shields.io/conda/vn/conda-forge/immutable_map_jax |
18 | | -[conda-link]: https://github.com/conda-forge/immutable_map_jax-feedstock |
19 | | -[github-discussions-badge]: https://img.shields.io/static/v1?label=Discussions&message=Ask&color=blue&logo=github |
20 | | -[github-discussions-link]: https://github.com/GalacticDynamics/immutable_map_jax/discussions |
21 | | -[pypi-link]: https://pypi.org/project/immutable_map_jax/ |
22 | | -[pypi-platforms]: https://img.shields.io/pypi/pyversions/immutable_map_jax |
23 | | -[pypi-version]: https://img.shields.io/pypi/v/immutable_map_jax |
24 | | -[rtd-badge]: https://readthedocs.org/projects/immutable_map_jax/badge/?version=latest |
25 | | -[rtd-link]: https://immutable_map_jax.readthedocs.io/en/latest/?badge=latest |
| 47 | +[actions-badge]: https://github.com/GalacticDynamics/xmmutablemap/workflows/CI/badge.svg |
| 48 | +[actions-link]: https://github.com/GalacticDynamics/xmmutablemap/actions |
| 49 | +[conda-badge]: https://img.shields.io/conda/vn/conda-forge/xmmutablemap |
| 50 | +[conda-link]: https://github.com/conda-forge/xmmutablemap-feedstock |
| 51 | +<!-- [github-discussions-badge]: https://img.shields.io/static/v1?label=Discussions&message=Ask&color=blue&logo=github |
| 52 | +[github-discussions-link]: https://github.com/GalacticDynamics/xmmutablemap/discussions --> |
| 53 | +[pypi-link]: https://pypi.org/project/xmmutablemap/ |
| 54 | +[pypi-platforms]: https://img.shields.io/pypi/pyversions/xmmutablemap |
| 55 | +[pypi-version]: https://img.shields.io/pypi/v/xmmutablemap |
| 56 | +[zenodo-badge]: https://zenodo.org/badge/755708966.svg |
| 57 | +[zenodo-link]: https://zenodo.org/doi/10.5281/zenodo.10850557 |
26 | 58 |
|
27 | 59 | <!-- prettier-ignore-end --> |
0 commit comments