Skip to content

Commit 561f7e3

Browse files
committed
docs: add docstring to ScalarMapJSON type, and fix TOC for api docs
1 parent b1b4241 commit 561f7e3

4 files changed

Lines changed: 24 additions & 21 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,13 @@ precision lost due to rounding is acceptable.
5959
## how
6060

6161
```python
62+
# import the codec that uses the rust backend
63+
from cast_value import CastValueRustV1
64+
6265
# Create an in-memory zarr array with float64 dtype, stored as uint8.
6366
# The cast_value codec handles the conversion: float64 -> uint8 on write,
6467
# uint8 -> float64 on read.
68+
6569
codec = CastValueRustV1(
6670
data_type="uint8",
6771
rounding="nearest-even",

docs/api.md

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,21 @@
11
# Python API
22

3-
## Types
4-
5-
::: cast_value.types.RoundingMode
6-
7-
::: cast_value.types.OutOfRangeMode
8-
9-
::: cast_value.types.NumericScalar
10-
11-
::: cast_value.types.ScalarMapEntry
3+
## Zarr Codec
124

13-
::: cast_value.types.ScalarMapJSON
5+
::: cast_value.CastValueRustV1
146

15-
## Core
7+
::: cast_value.CastValueNumpyV1
168

17-
::: cast_value.core.cast_array
9+
::: cast_value.cast_array
1810

19-
::: cast_value.core.round_inplace
11+
::: cast_value.ScalarMapJSON
2012

21-
::: cast_value.core.check_int_range
13+
::: cast_value.ScalarMapEntry
2214

23-
::: cast_value.core.apply_scalar_map
15+
::: cast_value.ScalarMapEntries
2416

25-
## Zarr Codec
17+
::: cast_value.RoundingMode
2618

27-
::: cast_value.zarr_compat.v1.CastValueNumpyV1
19+
::: cast_value.OutOfRangeMode
2820

29-
::: cast_value.zarr_compat.v1.CastValueRustV1
21+
::: cast_value.NumericScalar

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pip install cast-value[rs]
2525
```python
2626
import numpy as np
2727
import zarr
28-
from cast_value.zarr_compat.v1 import CastValueNumpyV1
28+
from cast_value import CastValueNumpyV1
2929

3030
zarr.registry.register_codec("cast_value", CastValueNumpyV1)
3131

@@ -56,6 +56,6 @@ Two backends are available:
5656
- **`CastValueRustV1`** — Rust via
5757
[cast-value-rs](https://pypi.org/project/cast-value-rs/). Faster for
5858
non-default rounding modes and SIMD-accelerated float-to-integer casts with
59-
clamping.
59+
clamping, with more efficient memory usage.
6060

6161
Both implement the same codec interface and produce identical results.

src/cast_value/types.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,14 @@
1919

2020

2121
class ScalarMapJSON(TypedDict):
22-
"""JSON representation of the scalar_map codec configuration field."""
22+
"""
23+
JSON representation of the scalar_map codec configuration field.
24+
25+
This type models permitted values for the [`scalar_map`](https://github.com/zarr-developers/zarr-extensions/tree/main/codecs/cast_value#scalar_map) field in the
26+
[`configuration`](https://github.com/zarr-developers/zarr-extensions/tree/main/codecs/cast_value#configuration) field of the `cast_value` codec metadata.
27+
28+
See the [`cast_value` spec](https://github.com/zarr-developers/zarr-extensions/tree/main/codecs/cast_value) for details.
29+
"""
2330

2431
encode: NotRequired[list[tuple[object, object]]]
2532
decode: NotRequired[list[tuple[object, object]]]

0 commit comments

Comments
 (0)