cast-value 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cast_value-0.1.0/.copier-answers.yml +13 -0
- cast_value-0.1.0/.git_archival.txt +3 -0
- cast_value-0.1.0/.gitattributes +1 -0
- cast_value-0.1.0/.github/CONTRIBUTING.md +77 -0
- cast_value-0.1.0/.github/dependabot.yml +11 -0
- cast_value-0.1.0/.github/release.yml +5 -0
- cast_value-0.1.0/.github/workflows/benchmarks.yml +36 -0
- cast_value-0.1.0/.github/workflows/cd.yml +84 -0
- cast_value-0.1.0/.github/workflows/ci.yml +94 -0
- cast_value-0.1.0/.gitignore +186 -0
- cast_value-0.1.0/.pre-commit-config.yaml +94 -0
- cast_value-0.1.0/.readthedocs.yaml +15 -0
- cast_value-0.1.0/CLAUDE.md +50 -0
- cast_value-0.1.0/LICENSE +19 -0
- cast_value-0.1.0/PKG-INFO +69 -0
- cast_value-0.1.0/README.md +38 -0
- cast_value-0.1.0/docs/api.md +1 -0
- cast_value-0.1.0/docs/index.md +18 -0
- cast_value-0.1.0/mkdocs.yml +52 -0
- cast_value-0.1.0/noxfile.py +87 -0
- cast_value-0.1.0/pyproject.toml +178 -0
- cast_value-0.1.0/src/cast_value/__init__.py +10 -0
- cast_value-0.1.0/src/cast_value/_version.py +24 -0
- cast_value-0.1.0/src/cast_value/_version.pyi +2 -0
- cast_value-0.1.0/src/cast_value/core.py +247 -0
- cast_value-0.1.0/src/cast_value/py.typed +0 -0
- cast_value-0.1.0/src/cast_value/types.py +28 -0
- cast_value-0.1.0/src/cast_value/zarr_compat/__init__.py +14 -0
- cast_value-0.1.0/src/cast_value/zarr_compat/v1/__init__.py +23 -0
- cast_value-0.1.0/src/cast_value/zarr_compat/v1/_base.py +234 -0
- cast_value-0.1.0/src/cast_value/zarr_compat/v1/numpy_codec.py +34 -0
- cast_value-0.1.0/src/cast_value/zarr_compat/v1/rust_codec.py +59 -0
- cast_value-0.1.0/tests/benchmark/__init__.py +0 -0
- cast_value-0.1.0/tests/benchmark/test_cast_memory.py +172 -0
- cast_value-0.1.0/tests/benchmark/test_cast_perf.py +180 -0
- cast_value-0.1.0/tests/conftest.py +46 -0
- cast_value-0.1.0/tests/test_core.py +1334 -0
- cast_value-0.1.0/tests/test_package.py +9 -0
- cast_value-0.1.0/tests/zarr_compat/__init__.py +0 -0
- cast_value-0.1.0/tests/zarr_compat/v1/__init__.py +0 -0
- cast_value-0.1.0/tests/zarr_compat/v1/_cases.py +189 -0
- cast_value-0.1.0/tests/zarr_compat/v1/_helpers.py +61 -0
- cast_value-0.1.0/tests/zarr_compat/v1/test_base.py +360 -0
- cast_value-0.1.0/tests/zarr_compat/v1/test_numpy_codec.py +57 -0
- cast_value-0.1.0/tests/zarr_compat/v1/test_rust_codec.py +65 -0
- cast_value-0.1.0/tests/zarr_compat/v1/test_rust_missing.py +52 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
|
|
2
|
+
_commit: 2026.03.02-6-ga1b98a4
|
|
3
|
+
_src_path: gh:scientific-python/cookie
|
|
4
|
+
backend: hatch
|
|
5
|
+
docs: mkdocs
|
|
6
|
+
email: davis.v.bennett@gmail.com
|
|
7
|
+
full_name: Davis Bennett
|
|
8
|
+
license: MIT
|
|
9
|
+
org: zarr-developers
|
|
10
|
+
project_name: cast-value
|
|
11
|
+
project_short_description: Python implementation of the `cast_value` codec.
|
|
12
|
+
url: https://github.com/zarr-developers/cast-value
|
|
13
|
+
vcs: true
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.git_archival.txt export-subst
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
See the [Scientific Python Developer Guide][spc-dev-intro] for a detailed
|
|
2
|
+
description of best practices for developing scientific packages.
|
|
3
|
+
|
|
4
|
+
[spc-dev-intro]: https://learn.scientific-python.org/development/
|
|
5
|
+
|
|
6
|
+
# Quick development
|
|
7
|
+
|
|
8
|
+
The fastest way to start with development is to use nox. If you don't have nox,
|
|
9
|
+
you can use `uvx nox` to run it without installing, or `uv tool install nox`. If
|
|
10
|
+
you don't have uv, you can
|
|
11
|
+
[install it a variety of ways](https://docs.astral.sh/uv/getting-started/installation/),
|
|
12
|
+
including with pip, pipx, brew, and just downloading the binary (single file).
|
|
13
|
+
|
|
14
|
+
To use, run `nox`. This will lint and test using every installed version of
|
|
15
|
+
Python on your system, skipping ones that are not installed. You can also run
|
|
16
|
+
specific jobs:
|
|
17
|
+
|
|
18
|
+
```console
|
|
19
|
+
$ nox -s lint # Lint only
|
|
20
|
+
$ nox -s tests # Python tests
|
|
21
|
+
$ nox -s docs # Build and serve the docs
|
|
22
|
+
$ nox -s build # Make an SDist and wheel
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Nox handles everything for you, including setting up an temporary virtual
|
|
26
|
+
environment for each run.
|
|
27
|
+
|
|
28
|
+
# Setting up a development environment manually
|
|
29
|
+
|
|
30
|
+
You can set up a development environment by running:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
uv sync
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
# Pre-commit
|
|
37
|
+
|
|
38
|
+
You should prepare pre-commit or prek, which will help you by checking that
|
|
39
|
+
commits pass required checks:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
uv tool install pre-commit # or brew install pre-commit on macOS
|
|
43
|
+
pre-commit install # Will install a pre-commit hook into the git repo
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
You can also/alternatively run `pre-commit run` (changes only) or
|
|
47
|
+
`pre-commit run --all-files` to check even without installing the hook.
|
|
48
|
+
|
|
49
|
+
# Testing
|
|
50
|
+
|
|
51
|
+
Use pytest to run the unit checks:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
uv run pytest
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
# Coverage
|
|
58
|
+
|
|
59
|
+
Use pytest-cov to generate coverage reports:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
uv run pytest --cov=cast-value
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
# Building docs
|
|
66
|
+
|
|
67
|
+
You can build and serve the docs using:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
nox -s docs
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
You can build the docs only with:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
nox -s docs --non-interactive
|
|
77
|
+
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: Benchmarks
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
id-token: write
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
benchmarks:
|
|
16
|
+
name: Run benchmarks
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v6
|
|
20
|
+
with:
|
|
21
|
+
fetch-depth: 0
|
|
22
|
+
|
|
23
|
+
- uses: actions/setup-python@v6
|
|
24
|
+
with:
|
|
25
|
+
python-version: "3.13"
|
|
26
|
+
|
|
27
|
+
- uses: astral-sh/setup-uv@v7
|
|
28
|
+
|
|
29
|
+
- name: Install dependencies
|
|
30
|
+
run: uv sync --group bench
|
|
31
|
+
|
|
32
|
+
- name: Run benchmarks
|
|
33
|
+
uses: CodSpeedHQ/action@v4
|
|
34
|
+
with:
|
|
35
|
+
mode: instrumentation
|
|
36
|
+
run: uv run pytest tests/benchmark/test_cast_perf.py --codspeed
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
name: CD
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
pull_request:
|
|
6
|
+
push:
|
|
7
|
+
branches:
|
|
8
|
+
- main
|
|
9
|
+
tags:
|
|
10
|
+
- "v*"
|
|
11
|
+
release:
|
|
12
|
+
types:
|
|
13
|
+
- published
|
|
14
|
+
|
|
15
|
+
concurrency:
|
|
16
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
17
|
+
cancel-in-progress: true
|
|
18
|
+
|
|
19
|
+
env:
|
|
20
|
+
# Many color libraries just need this to be set to any value, but at least
|
|
21
|
+
# one distinguishes color depth, where "3" -> "256-bit color".
|
|
22
|
+
FORCE_COLOR: 3
|
|
23
|
+
|
|
24
|
+
jobs:
|
|
25
|
+
dist:
|
|
26
|
+
name: Distribution build
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
|
|
29
|
+
steps:
|
|
30
|
+
- uses: actions/checkout@v6
|
|
31
|
+
with:
|
|
32
|
+
fetch-depth: 0
|
|
33
|
+
|
|
34
|
+
- uses: hynek/build-and-inspect-python-package@v2
|
|
35
|
+
|
|
36
|
+
publish-testpypi:
|
|
37
|
+
needs: [dist]
|
|
38
|
+
name: Publish to TestPyPI
|
|
39
|
+
environment: testpypi
|
|
40
|
+
permissions:
|
|
41
|
+
id-token: write
|
|
42
|
+
attestations: write
|
|
43
|
+
contents: read
|
|
44
|
+
runs-on: ubuntu-latest
|
|
45
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
46
|
+
|
|
47
|
+
steps:
|
|
48
|
+
- uses: actions/download-artifact@v8
|
|
49
|
+
with:
|
|
50
|
+
name: Packages
|
|
51
|
+
path: dist
|
|
52
|
+
|
|
53
|
+
- name: Generate artifact attestation for sdist and wheel
|
|
54
|
+
uses: actions/attest-build-provenance@v4
|
|
55
|
+
with:
|
|
56
|
+
subject-path: "dist/*"
|
|
57
|
+
|
|
58
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
59
|
+
with:
|
|
60
|
+
repository-url: https://test.pypi.org/legacy/
|
|
61
|
+
|
|
62
|
+
publish:
|
|
63
|
+
needs: [dist]
|
|
64
|
+
name: Publish to PyPI
|
|
65
|
+
environment: pypi
|
|
66
|
+
permissions:
|
|
67
|
+
id-token: write
|
|
68
|
+
attestations: write
|
|
69
|
+
contents: read
|
|
70
|
+
runs-on: ubuntu-latest
|
|
71
|
+
if: github.event_name == 'release' && github.event.action == 'published'
|
|
72
|
+
|
|
73
|
+
steps:
|
|
74
|
+
- uses: actions/download-artifact@v8
|
|
75
|
+
with:
|
|
76
|
+
name: Packages
|
|
77
|
+
path: dist
|
|
78
|
+
|
|
79
|
+
- name: Generate artifact attestation for sdist and wheel
|
|
80
|
+
uses: actions/attest-build-provenance@v4
|
|
81
|
+
with:
|
|
82
|
+
subject-path: "dist/*"
|
|
83
|
+
|
|
84
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
pull_request:
|
|
6
|
+
push:
|
|
7
|
+
branches:
|
|
8
|
+
- main
|
|
9
|
+
|
|
10
|
+
concurrency:
|
|
11
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
12
|
+
cancel-in-progress: true
|
|
13
|
+
|
|
14
|
+
env:
|
|
15
|
+
# Many color libraries just need this variable to be set to any value.
|
|
16
|
+
# Set it to 3 to support 8-bit color graphics (256 colors per channel)
|
|
17
|
+
# for libraries that care about the value set.
|
|
18
|
+
FORCE_COLOR: 3
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
lint:
|
|
22
|
+
name: Format
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v6
|
|
26
|
+
with:
|
|
27
|
+
fetch-depth: 0
|
|
28
|
+
|
|
29
|
+
- uses: actions/setup-python@v6
|
|
30
|
+
with:
|
|
31
|
+
python-version: "3.x"
|
|
32
|
+
|
|
33
|
+
- uses: astral-sh/setup-uv@v7
|
|
34
|
+
|
|
35
|
+
- name: Create venv for ty
|
|
36
|
+
run: uv sync
|
|
37
|
+
|
|
38
|
+
- uses: j178/prek-action@v2
|
|
39
|
+
|
|
40
|
+
- name: Run Pylint
|
|
41
|
+
run: uvx nox -s pylint -- --output-format=github
|
|
42
|
+
|
|
43
|
+
checks:
|
|
44
|
+
name: >-
|
|
45
|
+
Test Python ${{ matrix.python-version }} on ${{ matrix.runs-on }} (${{
|
|
46
|
+
matrix.deps }})
|
|
47
|
+
runs-on: ${{ matrix.runs-on }}
|
|
48
|
+
strategy:
|
|
49
|
+
fail-fast: false
|
|
50
|
+
matrix:
|
|
51
|
+
python-version: ["3.11", "3.14"]
|
|
52
|
+
runs-on: [ubuntu-latest, windows-latest, macos-latest]
|
|
53
|
+
deps: [base, rs]
|
|
54
|
+
|
|
55
|
+
steps:
|
|
56
|
+
- uses: actions/checkout@v6
|
|
57
|
+
with:
|
|
58
|
+
fetch-depth: 0
|
|
59
|
+
|
|
60
|
+
- uses: actions/setup-python@v6
|
|
61
|
+
with:
|
|
62
|
+
python-version: ${{ matrix.python-version }}
|
|
63
|
+
allow-prereleases: true
|
|
64
|
+
|
|
65
|
+
- uses: astral-sh/setup-uv@v7
|
|
66
|
+
|
|
67
|
+
- name: Install package (base)
|
|
68
|
+
if: matrix.deps == 'base'
|
|
69
|
+
run: uv sync --group test
|
|
70
|
+
|
|
71
|
+
- name: Install package (rs)
|
|
72
|
+
if: matrix.deps == 'rs'
|
|
73
|
+
run: uv sync --group test-rs
|
|
74
|
+
|
|
75
|
+
- name: Test package
|
|
76
|
+
run: >-
|
|
77
|
+
uv run pytest -ra --cov --cov-report=xml --cov-report=term
|
|
78
|
+
--durations=20
|
|
79
|
+
|
|
80
|
+
- name: Upload coverage report
|
|
81
|
+
uses: codecov/codecov-action@v5
|
|
82
|
+
with:
|
|
83
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
84
|
+
|
|
85
|
+
pass:
|
|
86
|
+
if: always()
|
|
87
|
+
needs: [lint, checks]
|
|
88
|
+
runs-on: ubuntu-slim
|
|
89
|
+
timeout-minutes: 2
|
|
90
|
+
steps:
|
|
91
|
+
- name: Decide whether the needed jobs succeeded or failed
|
|
92
|
+
uses: re-actors/alls-green@release/v1
|
|
93
|
+
with:
|
|
94
|
+
jobs: ${{ toJSON(needs) }}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
cover/
|
|
52
|
+
|
|
53
|
+
# Translations
|
|
54
|
+
*.mo
|
|
55
|
+
*.pot
|
|
56
|
+
|
|
57
|
+
# Django stuff:
|
|
58
|
+
*.log
|
|
59
|
+
local_settings.py
|
|
60
|
+
db.sqlite3
|
|
61
|
+
db.sqlite3-journal
|
|
62
|
+
|
|
63
|
+
# Flask stuff:
|
|
64
|
+
instance/
|
|
65
|
+
.webassets-cache
|
|
66
|
+
|
|
67
|
+
# Scrapy stuff:
|
|
68
|
+
.scrapy
|
|
69
|
+
|
|
70
|
+
# Sphinx documentation
|
|
71
|
+
docs/_build/
|
|
72
|
+
|
|
73
|
+
# PyBuilder
|
|
74
|
+
.pybuilder/
|
|
75
|
+
target/
|
|
76
|
+
|
|
77
|
+
# Jupyter Notebook
|
|
78
|
+
.ipynb_checkpoints
|
|
79
|
+
|
|
80
|
+
# IPython
|
|
81
|
+
profile_default/
|
|
82
|
+
ipython_config.py
|
|
83
|
+
|
|
84
|
+
# pyenv
|
|
85
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
86
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
87
|
+
# .python-version
|
|
88
|
+
|
|
89
|
+
# pipenv
|
|
90
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
91
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
92
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
93
|
+
# install all needed dependencies.
|
|
94
|
+
#Pipfile.lock
|
|
95
|
+
|
|
96
|
+
# UV
|
|
97
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
98
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
99
|
+
# commonly ignored for libraries.
|
|
100
|
+
#uv.lock
|
|
101
|
+
|
|
102
|
+
# poetry
|
|
103
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
104
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
105
|
+
# commonly ignored for libraries.
|
|
106
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
107
|
+
#poetry.lock
|
|
108
|
+
|
|
109
|
+
# pdm
|
|
110
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
111
|
+
#pdm.lock
|
|
112
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
113
|
+
# in version control.
|
|
114
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
115
|
+
.pdm.toml
|
|
116
|
+
.pdm-python
|
|
117
|
+
.pdm-build/
|
|
118
|
+
|
|
119
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
120
|
+
__pypackages__/
|
|
121
|
+
|
|
122
|
+
# Celery stuff
|
|
123
|
+
celerybeat-schedule
|
|
124
|
+
celerybeat.pid
|
|
125
|
+
|
|
126
|
+
# SageMath parsed files
|
|
127
|
+
*.sage.py
|
|
128
|
+
|
|
129
|
+
# Environments
|
|
130
|
+
.env
|
|
131
|
+
.venv
|
|
132
|
+
env/
|
|
133
|
+
venv/
|
|
134
|
+
ENV/
|
|
135
|
+
env.bak/
|
|
136
|
+
venv.bak/
|
|
137
|
+
|
|
138
|
+
# Spyder project settings
|
|
139
|
+
.spyderproject
|
|
140
|
+
.spyproject
|
|
141
|
+
|
|
142
|
+
# Rope project settings
|
|
143
|
+
.ropeproject
|
|
144
|
+
|
|
145
|
+
# mkdocs documentation
|
|
146
|
+
/site
|
|
147
|
+
|
|
148
|
+
# mypy
|
|
149
|
+
.dmypy.json
|
|
150
|
+
dmypy.json
|
|
151
|
+
|
|
152
|
+
# Pyre type checker
|
|
153
|
+
.pyre/
|
|
154
|
+
|
|
155
|
+
# pytype static type analyzer
|
|
156
|
+
.pytype/
|
|
157
|
+
|
|
158
|
+
# Cython debug symbols
|
|
159
|
+
cython_debug/
|
|
160
|
+
|
|
161
|
+
# PyCharm
|
|
162
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
163
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
164
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
165
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
166
|
+
#.idea/
|
|
167
|
+
|
|
168
|
+
# setuptools_scm
|
|
169
|
+
src/*/_version.py
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
# Caches
|
|
173
|
+
.*_cache/
|
|
174
|
+
|
|
175
|
+
# OS specific stuff
|
|
176
|
+
.DS_Store
|
|
177
|
+
.DS_Store?
|
|
178
|
+
._*
|
|
179
|
+
.Spotlight-V100
|
|
180
|
+
.Trashes
|
|
181
|
+
ehthumbs.db
|
|
182
|
+
Thumbs.db
|
|
183
|
+
|
|
184
|
+
# Common editor files
|
|
185
|
+
*~
|
|
186
|
+
*.swp
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
ci:
|
|
2
|
+
autoupdate_commit_msg: "chore(deps): update pre-commit hooks"
|
|
3
|
+
autofix_commit_msg: "style: pre-commit fixes"
|
|
4
|
+
autoupdate_schedule: "monthly"
|
|
5
|
+
|
|
6
|
+
exclude: ^.cruft.json|.copier-answers.yml$
|
|
7
|
+
|
|
8
|
+
repos:
|
|
9
|
+
- repo: https://github.com/adamchainz/blacken-docs
|
|
10
|
+
rev: "1.20.0"
|
|
11
|
+
hooks:
|
|
12
|
+
- id: blacken-docs
|
|
13
|
+
additional_dependencies: [black==26.*]
|
|
14
|
+
|
|
15
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
16
|
+
rev: "v6.0.0"
|
|
17
|
+
hooks:
|
|
18
|
+
- id: check-added-large-files
|
|
19
|
+
- id: check-case-conflict
|
|
20
|
+
- id: check-merge-conflict
|
|
21
|
+
- id: check-symlinks
|
|
22
|
+
- id: check-yaml
|
|
23
|
+
- id: debug-statements
|
|
24
|
+
- id: end-of-file-fixer
|
|
25
|
+
- id: mixed-line-ending
|
|
26
|
+
- id: name-tests-test
|
|
27
|
+
args: ["--pytest-test-first"]
|
|
28
|
+
exclude: "^tests/.*/_(helpers|cases)\\.py$"
|
|
29
|
+
- id: requirements-txt-fixer
|
|
30
|
+
- id: trailing-whitespace
|
|
31
|
+
|
|
32
|
+
- repo: https://github.com/pre-commit/pygrep-hooks
|
|
33
|
+
rev: "v1.10.0"
|
|
34
|
+
hooks:
|
|
35
|
+
- id: rst-backticks
|
|
36
|
+
- id: rst-directive-colons
|
|
37
|
+
- id: rst-inline-touching-normal
|
|
38
|
+
|
|
39
|
+
- repo: https://github.com/rbubley/mirrors-prettier
|
|
40
|
+
rev: "v3.8.1"
|
|
41
|
+
hooks:
|
|
42
|
+
- id: prettier
|
|
43
|
+
types_or: [yaml, markdown, html, css, scss, javascript, json]
|
|
44
|
+
args: [--prose-wrap=always]
|
|
45
|
+
|
|
46
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
47
|
+
rev: "v0.15.6"
|
|
48
|
+
hooks:
|
|
49
|
+
- id: ruff-check
|
|
50
|
+
args: ["--fix"]
|
|
51
|
+
- id: ruff-format
|
|
52
|
+
|
|
53
|
+
- repo: local
|
|
54
|
+
hooks:
|
|
55
|
+
- id: ty-check
|
|
56
|
+
name: ty-check
|
|
57
|
+
language: python
|
|
58
|
+
entry: ty check
|
|
59
|
+
pass_filenames: false
|
|
60
|
+
args: [--python=.venv/]
|
|
61
|
+
additional_dependencies: [ty]
|
|
62
|
+
|
|
63
|
+
- repo: https://github.com/codespell-project/codespell
|
|
64
|
+
rev: "v2.4.2"
|
|
65
|
+
hooks:
|
|
66
|
+
- id: codespell
|
|
67
|
+
additional_dependencies:
|
|
68
|
+
- tomli; python_version<'3.11'
|
|
69
|
+
|
|
70
|
+
- repo: https://github.com/shellcheck-py/shellcheck-py
|
|
71
|
+
rev: "v0.11.0.1"
|
|
72
|
+
hooks:
|
|
73
|
+
- id: shellcheck
|
|
74
|
+
|
|
75
|
+
- repo: local
|
|
76
|
+
hooks:
|
|
77
|
+
- id: disallow-caps
|
|
78
|
+
name: Disallow improper capitalization
|
|
79
|
+
language: pygrep
|
|
80
|
+
entry: PyBind|\bNumpy\b|Cmake|CCache|Github|PyTest
|
|
81
|
+
exclude: .pre-commit-config.yaml
|
|
82
|
+
|
|
83
|
+
- repo: https://github.com/abravalheri/validate-pyproject
|
|
84
|
+
rev: "v0.25"
|
|
85
|
+
hooks:
|
|
86
|
+
- id: validate-pyproject
|
|
87
|
+
additional_dependencies: ["validate-pyproject-schema-store[all]"]
|
|
88
|
+
|
|
89
|
+
- repo: https://github.com/python-jsonschema/check-jsonschema
|
|
90
|
+
rev: "0.37.0"
|
|
91
|
+
hooks:
|
|
92
|
+
- id: check-dependabot
|
|
93
|
+
- id: check-github-workflows
|
|
94
|
+
- id: check-readthedocs
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Read the Docs configuration file
|
|
2
|
+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
|
3
|
+
|
|
4
|
+
version: 2
|
|
5
|
+
|
|
6
|
+
build:
|
|
7
|
+
os: ubuntu-24.04
|
|
8
|
+
tools:
|
|
9
|
+
python: "3.13"
|
|
10
|
+
commands:
|
|
11
|
+
- asdf plugin add uv
|
|
12
|
+
- asdf install uv latest
|
|
13
|
+
- asdf global uv latest
|
|
14
|
+
- uv sync --group docs
|
|
15
|
+
- uv run mkdocs build --site-dir $READTHEDOCS_OUTPUT/html
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# About
|
|
2
|
+
|
|
3
|
+
This repo contains a Python implementation for the `cast_value` codec for Zarr
|
|
4
|
+
V3. The spec for that codec is
|
|
5
|
+
[here](https://github.com/zarr-developers/zarr-extensions/tree/main/codecs/cast_value).
|
|
6
|
+
The relevant section of the Zarr V3 spec is
|
|
7
|
+
[here](https://zarr-specs.readthedocs.io/en/latest/v3/core/index.html#chunk-encoding).
|
|
8
|
+
Be advised that the Zarr V3 spec describes an API but that API is NOT NORMATIVE
|
|
9
|
+
and should be ignored as needed.
|
|
10
|
+
|
|
11
|
+
## Design
|
|
12
|
+
|
|
13
|
+
- Use a functional, declarative style with simple data structures and functions
|
|
14
|
+
that transform them.
|
|
15
|
+
- `TypedDict`s are preferred over classes.
|
|
16
|
+
- Functions are preferred over methods.
|
|
17
|
+
- Accurate type annotations for everything.
|
|
18
|
+
- Never use the `Any` type. Always look for a more accurate alternative, like
|
|
19
|
+
`object`.
|
|
20
|
+
|
|
21
|
+
## Architecture
|
|
22
|
+
|
|
23
|
+
This repo has two main parts:
|
|
24
|
+
|
|
25
|
+
1. One or more implementations of the `cast_value` codec. This follows an
|
|
26
|
+
internal API defined in this library.
|
|
27
|
+
2. One or more implementations of a `Codec` class compatible with the
|
|
28
|
+
[Zarr-Python codec API](https://zarr.readthedocs.io/en/stable/api/zarr/abc/codec/#zarr.abc.codec.__all__).
|
|
29
|
+
The Zarr-Python codec API is likely to change in the future so the
|
|
30
|
+
Zarr-Python compatibility layer needs to be robustly versioned.
|
|
31
|
+
|
|
32
|
+
## Tests
|
|
33
|
+
|
|
34
|
+
- Every parameter of every function must have a test.
|
|
35
|
+
- Use `@pytest.mark.parametrize` over pytest classes.
|
|
36
|
+
- Every test must have a docstring that explains what it tests.
|
|
37
|
+
|
|
38
|
+
### Actions
|
|
39
|
+
|
|
40
|
+
### Run Python script
|
|
41
|
+
|
|
42
|
+
`uv run <script>`
|
|
43
|
+
|
|
44
|
+
### Setup test env
|
|
45
|
+
|
|
46
|
+
`uv sync --group test`
|
|
47
|
+
|
|
48
|
+
### Run tests
|
|
49
|
+
|
|
50
|
+
`uv run pytest tests`
|
cast_value-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright 2026 Davis Bennett
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
5
|
+
the Software without restriction, including without limitation the rights to
|
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
7
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
8
|
+
so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|