Skip to main content

torchsx-native

The CrystFEL .stream indexer, parser and writer for torchsx, in Rust (PyO3 and maturin). It is a separate wheel so torchsx itself stays pure Python. Arrays cross the boundary as numpy arrays, and the module does not link torch.

Function Does
index_chunks(path, n_threads=1, max_crystals=None) (n, 4) int64 rows (start, end, n_crystals, n_obs_upper) per chunk; max_crystals stops early (head mode)
parse_chunks(path, chunks, panel_names, n_threads=1) Parses the given rows into (columns, filenames, events, report); the columns use the _allocate_tensors names and dtypes
write_stream(path, arrays, filenames, events, panel_names, lattice_type, centering, unique_axis, header, n_threads=1, images_per_batch=1024) Writes a stream byte-identical to the Python writer
PROTOCOL Interface version; torchsx/io/_native.py refuses a build whose value differs

Every call releases the GIL and runs on its own pool of n_threads. The output does not depend on the thread count.

Behaviour

  • On well-formed streams the parse is bit-identical to the pure-Python parser (torchsx/io/_parse/records.py). Both follow the same rules, and tests/test_native_parse.py compares them.
  • Malformed content never raises. It is excluded at the smallest unit that keeps the rest valid, and report counts it by reason, with the byte offset of the first occurrence. records.py lists the rules.
  • Python's str.split(), str.strip(), int() and float() are reproduced, including PEP 515 underscores and inf/nan. Unicode decimal digits other than ASCII, which Python's int() also accepts, are not numbers here.

Build

maturin build --release          # → target/wheels/torchsx_native-*-cp310-abi3-*.whl
pip install target/wheels/*.whl  # or, from the repo root: pip install ./native
cargo test --release             # Rust unit tests (needs libpython on LD_LIBRARY_PATH)

The wheel uses the stable ABI (abi3, Python ≥ 3.10), so one build serves every Python version on a platform. A wheel built on a host carries that host's glibc floor (for example manylinux_2_34 on SLES 15 SP6). For older systems, build with maturin build --release --zig --compatibility manylinux_2_28.

Bump PROTOCOL in src/lib.rs and in torchsx/io/_native.py together whenever a signature or a returned layout changes.

Release

torchsx-native is released from this repository together with torchsx (.github/workflows/publish.yml, run by publishing a GitHub release v<torchsx version>, or by hand against TestPyPI). The version is Cargo.toml's. It changes only when the native build changes, and torchsx pins its minor version (torchsx-native==0.1.*):

  • Rust change, same interface: bump the patch in Cargo.toml.
  • Interface change: bump PROTOCOL (both files), the minor in Cargo.toml and the pin in the root pyproject.toml.

The workflow checks all of this (.github/scripts/check_release.py). It builds abi3 wheels for manylinux_2_28 x86_64/aarch64, macOS universal2 and Windows x64, smoke-tests each (tests/smoke.py) on its platform, and uploads torchsx-native before torchsx.

Metadata

Release files for torchsx-native 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for torchsx-native 0.1.0
File Size Uploaded
torchsx_native-0.1.0.tar.gz 23.1 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for torchsx-native 0.1.0
File
torchsx_native-0.1.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
torchsx_native-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details
torchsx_native-0.1.0-cp310-abi3-manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.28+ ARM64 Details
torchsx_native-0.1.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl CPython 3.10 abi3 macOS 10.12+ x86-64, macOS 10.12+ universal2 (ARM64, x86-64), macOS 11.0+ ARM64 Details

Total release size: 1.9 MB

Release files / torchsx_native-0.1.0.tar.gz

Download URL torchsx_native-0.1.0.tar.gz
Size 23.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d9d98b699e056bf2e1ecc58c1443ae1899c8f39ada17d36c8bd8ae6b557a614d
BLAKE2b-256 checksum
How to use checksums
7a65464ff5836a63ca6909f951e21aa6cc6cf68d8703b6b77ac9f92237324a99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

Release files / torchsx_native-0.1.0-cp310-abi3-win_amd64.whl

Download URL torchsx_native-0.1.0-cp310-abi3-win_amd64.whl
Size 294.2 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
b1927b4adc7f49d42d3f46896bd4e6bb4bcb53d5debd326beb953bedd196bc72
BLAKE2b-256 checksum
How to use checksums
361c49cf329e04985d9d6d62d8195e243fa05a7fc1c1c726b4d6b82cd75061cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

Release files / torchsx_native-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL torchsx_native-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl
Size 411.6 kB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
e8f0bb6bba562cc0a7be7e813ee76dd77cd32866c4c85069edb84cc775e3b01b
BLAKE2b-256 checksum
How to use checksums
d875dd7dca9dd871a06b6a984780d3962852a7c47a6e4ed9dd8b574468102f88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

Release files / torchsx_native-0.1.0-cp310-abi3-manylinux_2_28_aarch64.whl

Download URL torchsx_native-0.1.0-cp310-abi3-manylinux_2_28_aarch64.whl
Size 400.3 kB
Tags CPython 3.10 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
5d277ad01244ee17880098962fee6bdaea93257e23354a1a2087e477658a47df
BLAKE2b-256 checksum
How to use checksums
ccf92801453ed195024d8afe6fa4ec4cb9e554602e4f886e43686e7946126409
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

Release files / torchsx_native-0.1.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL torchsx_native-0.1.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Size 744.6 kB
Tags CPython 3.10 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
be8f5771d677a4791281dbd7b02e1099feb181d7e9197f98dd666901802016e7
BLAKE2b-256 checksum
How to use checksums
19cb020bacbdeb027dc60905aa6c094186454dde578513aee9d3feed510188bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

5 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page