zarrs 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.
- zarrs-0.1.0/.github/workflows/cd.yml +143 -0
- zarrs-0.1.0/.github/workflows/ci.yml +67 -0
- zarrs-0.1.0/.github/workflows/version-cmp.py +35 -0
- zarrs-0.1.0/.gitignore +22 -0
- zarrs-0.1.0/.pre-commit-config.yaml +32 -0
- zarrs-0.1.0/.readthedocs.yml +19 -0
- zarrs-0.1.0/Cargo.lock +1436 -0
- zarrs-0.1.0/Cargo.toml +24 -0
- zarrs-0.1.0/LICENSE +21 -0
- zarrs-0.1.0/PKG-INFO +159 -0
- zarrs-0.1.0/README.md +111 -0
- zarrs-0.1.0/docs/Makefile +20 -0
- zarrs-0.1.0/docs/api.md +13 -0
- zarrs-0.1.0/docs/conf.py +34 -0
- zarrs-0.1.0/docs/contributing.md +40 -0
- zarrs-0.1.0/docs/index.md +10 -0
- zarrs-0.1.0/docs/make.bat +35 -0
- zarrs-0.1.0/hatch.toml +13 -0
- zarrs-0.1.0/pyproject.toml +124 -0
- zarrs-0.1.0/python/zarrs/__init__.py +20 -0
- zarrs-0.1.0/python/zarrs/_internal.pyi +47 -0
- zarrs-0.1.0/python/zarrs/pipeline.py +155 -0
- zarrs-0.1.0/python/zarrs/py.typed +0 -0
- zarrs-0.1.0/python/zarrs/utils.py +185 -0
- zarrs-0.1.0/src/bin/stub_gen.rs +7 -0
- zarrs-0.1.0/src/chunk_item.rs +185 -0
- zarrs-0.1.0/src/codec_pipeline_store_filesystem.rs +47 -0
- zarrs-0.1.0/src/concurrency.rs +51 -0
- zarrs-0.1.0/src/lib.rs +540 -0
- zarrs-0.1.0/src/tests.rs +29 -0
- zarrs-0.1.0/src/utils.rs +31 -0
- zarrs-0.1.0/tests/conftest.py +155 -0
- zarrs-0.1.0/tests/test_blosc.py +57 -0
- zarrs-0.1.0/tests/test_codecs.py +400 -0
- zarrs-0.1.0/tests/test_endian.py +55 -0
- zarrs-0.1.0/tests/test_gzip.py +21 -0
- zarrs-0.1.0/tests/test_pipeline.py +231 -0
- zarrs-0.1.0/tests/test_sharding.py +396 -0
- zarrs-0.1.0/tests/test_transpose.py +104 -0
- zarrs-0.1.0/tests/test_version.py +7 -0
- zarrs-0.1.0/tests/test_vlen.py +106 -0
- zarrs-0.1.0/tests/test_zstd.py +23 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
name: cd
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
tags:
|
|
8
|
+
- '**'
|
|
9
|
+
pull_request:
|
|
10
|
+
|
|
11
|
+
env:
|
|
12
|
+
CARGO_TERM_COLOR: always
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
build:
|
|
16
|
+
name: build on ${{ matrix.os }} (${{ matrix.target }}${{ matrix.os == 'linux' && format(' - {0}', matrix.manylinux == 'auto' && 'manylinux' || matrix.manylinux) || '' }})
|
|
17
|
+
# only run on push to tags, main branch, or explicit full build
|
|
18
|
+
# keep condition in sync with `build-sdist` job
|
|
19
|
+
if: github.ref_type == 'tag' || github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'Full Build')
|
|
20
|
+
strategy:
|
|
21
|
+
fail-fast: false
|
|
22
|
+
matrix:
|
|
23
|
+
os: [linux, macos, windows]
|
|
24
|
+
target: [x86_64, aarch64]
|
|
25
|
+
manylinux: ['2_28']
|
|
26
|
+
include:
|
|
27
|
+
# manylinux for various platforms
|
|
28
|
+
#- { os: linux, manylinux: '2_28', target: i686 }
|
|
29
|
+
- { os: linux, manylinux: '2_28', target: armv7 }
|
|
30
|
+
- { os: linux, manylinux: '2_28', target: ppc64le }
|
|
31
|
+
#- { os: linux, manylinux: '2_28', target: s390x }
|
|
32
|
+
# musl
|
|
33
|
+
- { os: linux, manylinux: musllinux_1_2, target: x86_64 }
|
|
34
|
+
- { os: linux, manylinux: musllinux_1_2, target: aarch64 }
|
|
35
|
+
- { os: linux, manylinux: musllinux_1_2, target: armv7 }
|
|
36
|
+
# windows
|
|
37
|
+
- { os: windows, target: i686, python-architecture: x86 }
|
|
38
|
+
runs-on: ${{ (matrix.os == 'linux' && 'ubuntu') || matrix.os }}-latest
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v4
|
|
41
|
+
- uses: actions/setup-python@v5
|
|
42
|
+
with:
|
|
43
|
+
python-version: '3.13'
|
|
44
|
+
architecture: ${{ matrix.python-architecture || 'x64' }}
|
|
45
|
+
- run: pip install twine
|
|
46
|
+
- uses: PyO3/maturin-action@v1
|
|
47
|
+
with:
|
|
48
|
+
target: ${{ matrix.target }}
|
|
49
|
+
manylinux: ${{ matrix.manylinux }}
|
|
50
|
+
args: --release --out dist --interpreter '3.11 3.12 3.13'
|
|
51
|
+
rust-toolchain: stable
|
|
52
|
+
docker-options: -e CI
|
|
53
|
+
before-script-linux: |
|
|
54
|
+
# If we're running on rhel centos, install needed packages.
|
|
55
|
+
if command -v yum &> /dev/null; then
|
|
56
|
+
yum update -y && yum install -y perl-core
|
|
57
|
+
fi
|
|
58
|
+
- run: ${{ (matrix.os == 'windows' && 'dir') || 'ls -lh' }} dist/
|
|
59
|
+
- run: twine check --strict dist/*
|
|
60
|
+
- uses: actions/upload-artifact@v4
|
|
61
|
+
with:
|
|
62
|
+
name: pypi-files-${{ matrix.os }}-${{ matrix.target }}-${{ matrix.manylinux }}
|
|
63
|
+
path: dist
|
|
64
|
+
|
|
65
|
+
build-sdist:
|
|
66
|
+
name: build sdist
|
|
67
|
+
# keep condition in sync with `build` job
|
|
68
|
+
if: github.ref_type == 'tag' || github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'Full Build')
|
|
69
|
+
runs-on: ubuntu-latest
|
|
70
|
+
steps:
|
|
71
|
+
- uses: actions/checkout@v4
|
|
72
|
+
- uses: actions/setup-python@v5
|
|
73
|
+
with:
|
|
74
|
+
python-version: '3.13'
|
|
75
|
+
- uses: PyO3/maturin-action@v1
|
|
76
|
+
with:
|
|
77
|
+
command: sdist
|
|
78
|
+
args: --out dist
|
|
79
|
+
rust-toolchain: stable
|
|
80
|
+
- uses: actions/upload-artifact@v4
|
|
81
|
+
with:
|
|
82
|
+
name: pypi-files-sdist
|
|
83
|
+
path: dist
|
|
84
|
+
|
|
85
|
+
inspect:
|
|
86
|
+
needs: [build, build-sdist]
|
|
87
|
+
runs-on: ubuntu-latest
|
|
88
|
+
steps:
|
|
89
|
+
- uses: actions/download-artifact@v4
|
|
90
|
+
with:
|
|
91
|
+
pattern: pypi-files-*
|
|
92
|
+
merge-multiple: true
|
|
93
|
+
path: dist/
|
|
94
|
+
- run: ls -lh dist/
|
|
95
|
+
# TODO: some more checks? `twine` is already run above
|
|
96
|
+
|
|
97
|
+
# If git tag is a version, verify that it matches the package metadata version (or fail job and skip `publish`)
|
|
98
|
+
# If git tag is not a version, set output `version` to "" (also skipping `publish`)
|
|
99
|
+
version:
|
|
100
|
+
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
|
|
101
|
+
needs: build
|
|
102
|
+
outputs:
|
|
103
|
+
version: ${{ steps.version.outputs.version }}
|
|
104
|
+
is_prerelease: ${{ steps.version.outputs.is_prerelease }}
|
|
105
|
+
runs-on: ubuntu-latest
|
|
106
|
+
steps:
|
|
107
|
+
- uses: actions/checkout@v4
|
|
108
|
+
- uses: actions/setup-python@v5
|
|
109
|
+
with:
|
|
110
|
+
python-version: '3.13'
|
|
111
|
+
- uses: actions/download-artifact@v4
|
|
112
|
+
with:
|
|
113
|
+
name: pypi-files-linux-x86_64-2_28
|
|
114
|
+
path: dist/
|
|
115
|
+
- name: Install zarrs-python
|
|
116
|
+
run: pip install packaging dist/*manylinux_2_28_x86_64.whl
|
|
117
|
+
- name: Get zarrs-python version and tag
|
|
118
|
+
id: version
|
|
119
|
+
run: python .github/workflows/version-cmp.py
|
|
120
|
+
|
|
121
|
+
publish:
|
|
122
|
+
if: needs.version.outputs.version != ''
|
|
123
|
+
runs-on: ubuntu-latest
|
|
124
|
+
needs: [inspect, version]
|
|
125
|
+
environment: pypi
|
|
126
|
+
permissions:
|
|
127
|
+
contents: write # to create a github release
|
|
128
|
+
id-token: write # to authenticate as Trusted Publisher to pypi.org
|
|
129
|
+
steps:
|
|
130
|
+
- uses: actions/download-artifact@v4
|
|
131
|
+
with:
|
|
132
|
+
pattern: pypi-files-*
|
|
133
|
+
merge-multiple: true
|
|
134
|
+
path: dist/
|
|
135
|
+
- name: "Publishing version ${{ needs.version.outputs.version }}"
|
|
136
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
137
|
+
with:
|
|
138
|
+
packages-dir: dist/
|
|
139
|
+
verbose: true
|
|
140
|
+
- uses: ncipollo/release-action@v1
|
|
141
|
+
with:
|
|
142
|
+
name: ${{ needs.version.outputs.version }}
|
|
143
|
+
prerelease: ${{ needs.version.outputs.is_prerelease }}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
|
|
9
|
+
concurrency:
|
|
10
|
+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
11
|
+
cancel-in-progress: true
|
|
12
|
+
|
|
13
|
+
env:
|
|
14
|
+
CARGO_TERM_COLOR: always
|
|
15
|
+
PYTEST_ADDOPTS: '--color=yes'
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
build_and_test:
|
|
19
|
+
name: build and test
|
|
20
|
+
strategy:
|
|
21
|
+
fail-fast: false
|
|
22
|
+
matrix:
|
|
23
|
+
rust_toolchain: ["stable"] # "nightly"
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v4
|
|
27
|
+
|
|
28
|
+
# Rust in GH runner images can lag behind stable releases + act does not include Rust
|
|
29
|
+
- name: Install Rust
|
|
30
|
+
uses: dtolnay/rust-toolchain@master
|
|
31
|
+
with:
|
|
32
|
+
toolchain: ${{ matrix.rust_toolchain }}
|
|
33
|
+
components: rustfmt
|
|
34
|
+
|
|
35
|
+
- name: Install rust-cache
|
|
36
|
+
uses: Swatinem/rust-cache@v2
|
|
37
|
+
|
|
38
|
+
- name: Install Python
|
|
39
|
+
uses: actions/setup-python@v5
|
|
40
|
+
with:
|
|
41
|
+
python-version: "3.x"
|
|
42
|
+
|
|
43
|
+
- name: Install UV
|
|
44
|
+
uses: astral-sh/setup-uv@v3
|
|
45
|
+
with:
|
|
46
|
+
version: "0.5.0"
|
|
47
|
+
enable-cache: true
|
|
48
|
+
cache-dependency-glob: |
|
|
49
|
+
pyproject.toml
|
|
50
|
+
Cargo.toml
|
|
51
|
+
|
|
52
|
+
- name: Install python deps + Build
|
|
53
|
+
run: |
|
|
54
|
+
uv pip install --system -e ".[test,dev]" --verbose
|
|
55
|
+
|
|
56
|
+
- name: Python Tests
|
|
57
|
+
run: pytest -n auto
|
|
58
|
+
|
|
59
|
+
- name: Rust Tests
|
|
60
|
+
run: cargo test
|
|
61
|
+
|
|
62
|
+
- name: Check formatting
|
|
63
|
+
# see “Type hints” section in contributing.md
|
|
64
|
+
run: |
|
|
65
|
+
cargo run --bin stub_gen
|
|
66
|
+
pre-commit run --all-files --show-diff-on-failure || true
|
|
67
|
+
git diff --exit-code HEAD
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# Can’t be an isolated script since we want to access zarrs’ metadata
|
|
3
|
+
|
|
4
|
+
import importlib.metadata as im
|
|
5
|
+
import os
|
|
6
|
+
import sys
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
from packaging.version import InvalidVersion, Version
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def set_outputs(version: Version | str) -> None:
|
|
13
|
+
is_prerelease = version.is_prerelease if isinstance(version, Version) else False
|
|
14
|
+
is_prerelease_json = "true" if is_prerelease else "false"
|
|
15
|
+
print(f"{version=!s} {is_prerelease=}")
|
|
16
|
+
with Path(os.environ["GITHUB_OUTPUT"]).open("a") as f:
|
|
17
|
+
print(f"version={version}", file=f)
|
|
18
|
+
print(f"is_prerelease={is_prerelease_json}", file=f)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
version_tag_str = os.environ["GITHUB_REF_NAME"]
|
|
22
|
+
assert version_tag_str.startswith("v"), "should be enforced in `if:` condition"
|
|
23
|
+
try:
|
|
24
|
+
version_tag = Version(version_tag_str[1:])
|
|
25
|
+
except InvalidVersion:
|
|
26
|
+
set_outputs("")
|
|
27
|
+
sys.exit(0)
|
|
28
|
+
|
|
29
|
+
if version_tag_str[1:] != str(version_tag):
|
|
30
|
+
sys.exit(f"Tag version not normalized: {version_tag_str} should be v{version_tag}")
|
|
31
|
+
|
|
32
|
+
if version_tag != (version_meta := Version(im.version("zarrs"))):
|
|
33
|
+
sys.exit(f"Version mismatch: {version_tag} (tag) != {version_meta} (metadata)")
|
|
34
|
+
|
|
35
|
+
set_outputs(version_meta)
|
zarrs-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# IDEs
|
|
2
|
+
/.idea/
|
|
3
|
+
/.vscode/
|
|
4
|
+
|
|
5
|
+
# Caches
|
|
6
|
+
.DS_Store
|
|
7
|
+
__pycache__/
|
|
8
|
+
/.*cache/
|
|
9
|
+
/.hypothesis/
|
|
10
|
+
|
|
11
|
+
# Build
|
|
12
|
+
*.so
|
|
13
|
+
/target/
|
|
14
|
+
/dist/
|
|
15
|
+
/docs/_build/
|
|
16
|
+
|
|
17
|
+
# Coverage
|
|
18
|
+
/.coverage
|
|
19
|
+
/coverage.xml
|
|
20
|
+
|
|
21
|
+
# Docs
|
|
22
|
+
docs/generated/
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: v5.0.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: trailing-whitespace
|
|
6
|
+
- id: end-of-file-fixer
|
|
7
|
+
- id: check-added-large-files
|
|
8
|
+
- id: check-case-conflict
|
|
9
|
+
- id: check-toml
|
|
10
|
+
- id: check-yaml
|
|
11
|
+
- id: check-merge-conflict
|
|
12
|
+
- id: detect-private-key
|
|
13
|
+
- id: no-commit-to-branch
|
|
14
|
+
args: ["--branch=main"]
|
|
15
|
+
- repo: local
|
|
16
|
+
hooks:
|
|
17
|
+
- id: rustfmt
|
|
18
|
+
name: rustfmt
|
|
19
|
+
description: Check if all files follow the rustfmt style
|
|
20
|
+
entry: cargo fmt --all -- --color always
|
|
21
|
+
language: system
|
|
22
|
+
pass_filenames: false
|
|
23
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
24
|
+
rev: v0.7.2
|
|
25
|
+
hooks:
|
|
26
|
+
- id: ruff
|
|
27
|
+
args: ["--fix"]
|
|
28
|
+
- id: ruff-format
|
|
29
|
+
# The following can be removed once PLR0917 is out of preview
|
|
30
|
+
- name: ruff preview rules
|
|
31
|
+
id: ruff
|
|
32
|
+
args: ["--preview", "--select=PLR0917"]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
build:
|
|
3
|
+
os: ubuntu-20.04
|
|
4
|
+
tools:
|
|
5
|
+
python: "3.12"
|
|
6
|
+
rust: "latest"
|
|
7
|
+
jobs:
|
|
8
|
+
post_checkout:
|
|
9
|
+
# unshallow so version can be derived from tag
|
|
10
|
+
- git fetch --unshallow || true
|
|
11
|
+
sphinx:
|
|
12
|
+
configuration: docs/conf.py
|
|
13
|
+
fail_on_warning: true
|
|
14
|
+
python:
|
|
15
|
+
install:
|
|
16
|
+
- method: pip
|
|
17
|
+
path: .
|
|
18
|
+
extra_requirements:
|
|
19
|
+
- doc
|