Skip to content

Commit 5dfc5fc

Browse files
authored
build: rename to xmmutablemap (#12)
* build: rename to xmmutablemap * docs: setup * build: add testpypi Signed-off-by: nstarman <nstarman@users.noreply.github.com>
1 parent af3da5b commit 5dfc5fc

17 files changed

Lines changed: 89 additions & 209 deletions

.copier-answers.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ email: nstarman@users.noreply.github.com
66
full_name: Galactic Dynamics Maintainers
77
license: MIT
88
org: GalacticDynamics
9-
project_name: immutable_map_jax
9+
project_name: xmmutablemap
1010
project_short_description: Immutable Map, compatible with JAX & Equinox
11-
url: https://github.com/GalacticDynamics/immutable_map_jax
11+
url: https://github.com/GalacticDynamics/xmmutablemap
1212
vcs: true

.github/CONTRIBUTING.md

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ specific jobs:
1919
```console
2020
$ nox -s lint # Lint only
2121
$ nox -s tests # Python tests
22-
$ nox -s docs -- --serve # Build and serve the docs
2322
$ nox -s build # Make an SDist and wheel
2423
```
2524

@@ -71,21 +70,7 @@ pytest
7170
Use pytest-cov to generate coverage reports:
7271

7372
```bash
74-
pytest --cov=immutable_map_jax
75-
```
76-
77-
# Building docs
78-
79-
You can build the docs using:
80-
81-
```bash
82-
nox -s docs
83-
```
84-
85-
You can see a preview with:
86-
87-
```bash
88-
nox -s docs -- --serve
73+
pytest --cov=xmmutablemap
8974
```
9075

9176
# Pre-commit

.github/workflows/cd.yml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ jobs:
3131

3232
- uses: hynek/build-and-inspect-python-package@v2
3333

34-
publish:
34+
test-publish:
3535
needs: [dist]
36-
name: Publish to PyPI
37-
environment: pypi
36+
name: Publish to TestPyPI
37+
environment:
38+
name: testpypi
3839
permissions:
3940
id-token: write
4041
runs-on: ubuntu-latest
@@ -49,6 +50,21 @@ jobs:
4950
- uses: pypa/gh-action-pypi-publish@release/v1
5051
if: github.event_name == 'release' && github.event.action == 'published'
5152
with:
52-
# Remember to tell (test-)pypi about this repo before publishing
53-
# Remove this line to publish to PyPI
5453
repository-url: https://test.pypi.org/legacy/
54+
55+
publish:
56+
needs: [test-publish]
57+
name: Publish to PyPI
58+
environment: pypi
59+
permissions:
60+
id-token: write
61+
runs-on: ubuntu-latest
62+
if: github.event_name == 'release' && github.event.action == 'published'
63+
64+
steps:
65+
- uses: actions/download-artifact@v4
66+
with:
67+
name: Packages
68+
path: dist
69+
70+
- uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ instance/
6868
# Scrapy stuff:
6969
.scrapy
7070

71-
# Sphinx documentation
72-
docs/_build/
73-
7471
# PyBuilder
7572
.pybuilder/
7673
target/

.pre-commit-config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,3 @@ repos:
8585
hooks:
8686
- id: check-dependabot
8787
- id: check-github-workflows
88-
- id: check-readthedocs

.readthedocs.yaml

Lines changed: 0 additions & 18 deletions
This file was deleted.

README.md

Lines changed: 50 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,59 @@
1-
# immutable_map_jax
1+
<h1 align='center'> xmmutablemap </h1>
2+
<h2 align="center"><cod>Jax</code>-compatible Immutable Map</h2>
23

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
59

6-
[![PyPI version][pypi-version]][pypi-link]
7-
[![Conda-Forge][conda-badge]][conda-link]
810
[![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
920

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]
1143

12-
<!-- SPHINX-START -->
44+
We welcome contributions!
1345

1446
<!-- 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
2658

2759
<!-- prettier-ignore-end -->

docs/conf.py

Lines changed: 0 additions & 45 deletions
This file was deleted.

docs/index.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

noxfile.py

Lines changed: 1 addition & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import annotations
22

3-
import argparse
43
import shutil
54
from pathlib import Path
65

@@ -32,7 +31,7 @@ def pylint(session: nox.Session) -> None:
3231
# This needs to be installed into the package environment, and is slower
3332
# than a pre-commit check
3433
session.install(".", "pylint")
35-
session.run("pylint", "immutable_map_jax", *session.posargs)
34+
session.run("pylint", "xmmutablemap", *session.posargs)
3635

3736

3837
@nox.session
@@ -44,67 +43,6 @@ def tests(session: nox.Session) -> None:
4443
session.run("pytest", *session.posargs)
4544

4645

47-
@nox.session(reuse_venv=True)
48-
def docs(session: nox.Session) -> None:
49-
"""
50-
Build the docs. Pass "--serve" to serve. Pass "-b linkcheck" to check links.
51-
"""
52-
53-
parser = argparse.ArgumentParser()
54-
parser.add_argument("--serve", action="store_true", help="Serve after building")
55-
parser.add_argument(
56-
"-b", dest="builder", default="html", help="Build target (default: html)"
57-
)
58-
args, posargs = parser.parse_known_args(session.posargs)
59-
60-
if args.builder != "html" and args.serve:
61-
session.error("Must not specify non-HTML builder with --serve")
62-
63-
extra_installs = ["sphinx-autobuild"] if args.serve else []
64-
65-
session.install("-e.[docs]", *extra_installs)
66-
session.chdir("docs")
67-
68-
if args.builder == "linkcheck":
69-
session.run(
70-
"sphinx-build", "-b", "linkcheck", ".", "_build/linkcheck", *posargs
71-
)
72-
return
73-
74-
shared_args = (
75-
"-n", # nitpicky mode
76-
"-T", # full tracebacks
77-
f"-b={args.builder}",
78-
".",
79-
f"_build/{args.builder}",
80-
*posargs,
81-
)
82-
83-
if args.serve:
84-
session.run("sphinx-autobuild", *shared_args)
85-
else:
86-
session.run("sphinx-build", "--keep-going", *shared_args)
87-
88-
89-
@nox.session
90-
def build_api_docs(session: nox.Session) -> None:
91-
"""
92-
Build (regenerate) API docs.
93-
"""
94-
95-
session.install("sphinx")
96-
session.chdir("docs")
97-
session.run(
98-
"sphinx-apidoc",
99-
"-o",
100-
"api/",
101-
"--module-first",
102-
"--no-toc",
103-
"--force",
104-
"../src/immutable_map_jax",
105-
)
106-
107-
10846
@nox.session
10947
def build(session: nox.Session) -> None:
11048
"""

0 commit comments

Comments
 (0)