Metadata-Version: 2.4
Name: spiraltorch
Version: 0.4.29
Classifier: Programming Language :: Python
Classifier: Programming Language :: Rust
Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
Classifier: Operating System :: OS Independent
Requires-Dist: transformers>=4.40 ; extra == 'hf-finetune'
Requires-Dist: torch>=2.2 ; extra == 'hf-finetune'
Requires-Dist: tokenizers>=0.15 ; extra == 'hf-finetune'
Requires-Dist: datasets>=2.18 ; extra == 'hf-finetune'
Requires-Dist: accelerate>=0.27 ; extra == 'hf-finetune'
Requires-Dist: safetensors>=0.4 ; extra == 'hf-finetune'
Requires-Dist: pyarrow>=15 ; extra == 'hf-finetune'
Requires-Dist: tqdm>=4.66 ; extra == 'hf-finetune'
Requires-Dist: transformers>=4.40 ; extra == 'hf-full-finetune'
Requires-Dist: torch>=2.2 ; extra == 'hf-full-finetune'
Requires-Dist: tokenizers>=0.15 ; extra == 'hf-full-finetune'
Requires-Dist: datasets>=2.18 ; extra == 'hf-full-finetune'
Requires-Dist: accelerate>=0.27 ; extra == 'hf-full-finetune'
Requires-Dist: safetensors>=0.4 ; extra == 'hf-full-finetune'
Requires-Dist: pyarrow>=15 ; extra == 'hf-full-finetune'
Requires-Dist: tqdm>=4.66 ; extra == 'hf-full-finetune'
Requires-Dist: evaluate>=0.4 ; extra == 'hf-full-finetune'
Requires-Dist: peft>=0.10 ; extra == 'hf-full-finetune'
Requires-Dist: transformers>=4.40 ; extra == 'hf-gpt2-ft'
Requires-Dist: torch>=2.2 ; extra == 'hf-gpt2-ft'
Requires-Dist: tokenizers>=0.15 ; extra == 'hf-gpt2-ft'
Requires-Dist: datasets>=2.18 ; extra == 'hf-gpt2-ft'
Requires-Dist: accelerate>=0.27 ; extra == 'hf-gpt2-ft'
Requires-Dist: safetensors>=0.4 ; extra == 'hf-gpt2-ft'
Requires-Dist: pyarrow>=15 ; extra == 'hf-gpt2-ft'
Requires-Dist: tqdm>=4.66 ; extra == 'hf-gpt2-ft'
Requires-Dist: evaluate>=0.4 ; extra == 'hf-gpt2-ft'
Requires-Dist: peft>=0.10 ; extra == 'hf-gpt2-ft'
Requires-Dist: transformers>=4.40 ; extra == 'hf-peft'
Requires-Dist: torch>=2.2 ; extra == 'hf-peft'
Requires-Dist: tokenizers>=0.15 ; extra == 'hf-peft'
Requires-Dist: accelerate>=0.27 ; extra == 'hf-peft'
Requires-Dist: peft>=0.10 ; extra == 'hf-peft'
Requires-Dist: safetensors>=0.4 ; extra == 'hf-peft'
Requires-Dist: transformers>=4.40 ; extra == 'hf-peft-finetune'
Requires-Dist: torch>=2.2 ; extra == 'hf-peft-finetune'
Requires-Dist: tokenizers>=0.15 ; extra == 'hf-peft-finetune'
Requires-Dist: datasets>=2.18 ; extra == 'hf-peft-finetune'
Requires-Dist: accelerate>=0.27 ; extra == 'hf-peft-finetune'
Requires-Dist: safetensors>=0.4 ; extra == 'hf-peft-finetune'
Requires-Dist: pyarrow>=15 ; extra == 'hf-peft-finetune'
Requires-Dist: tqdm>=4.66 ; extra == 'hf-peft-finetune'
Requires-Dist: peft>=0.10 ; extra == 'hf-peft-finetune'
Requires-Dist: transformers>=4.40 ; extra == 'hf-runtime'
Requires-Dist: torch>=2.2 ; extra == 'hf-runtime'
Requires-Dist: tokenizers>=0.15 ; extra == 'hf-runtime'
Requires-Dist: safetensors>=0.4 ; extra == 'hf-runtime'
Requires-Dist: transformers>=4.40 ; extra == 'hf-trl-sft'
Requires-Dist: torch>=2.2 ; extra == 'hf-trl-sft'
Requires-Dist: tokenizers>=0.15 ; extra == 'hf-trl-sft'
Requires-Dist: datasets>=2.18 ; extra == 'hf-trl-sft'
Requires-Dist: accelerate>=0.27 ; extra == 'hf-trl-sft'
Requires-Dist: safetensors>=0.4 ; extra == 'hf-trl-sft'
Requires-Dist: pyarrow>=15 ; extra == 'hf-trl-sft'
Requires-Dist: tqdm>=4.66 ; extra == 'hf-trl-sft'
Requires-Dist: peft>=0.10 ; extra == 'hf-trl-sft'
Requires-Dist: trl>=0.12 ; extra == 'hf-trl-sft'
Requires-Dist: trackio>=0.2 ; extra == 'hf-trl-sft'
Provides-Extra: hf-finetune
Provides-Extra: hf-full-finetune
Provides-Extra: hf-gpt2-ft
Provides-Extra: hf-peft
Provides-Extra: hf-peft-finetune
Provides-Extra: hf-runtime
Provides-Extra: hf-trl-sft
License-File: LICENSE.txt
Summary: Rust-first learning primitives for SpiralTorch
Author: Ryo ∴ SpiralArchitect
License: AGPL-3.0-or-later
Requires-Python: >=3.8
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://github.com/RyoSpiralArchitect/SpiralTorch
Project-URL: Source, https://github.com/RyoSpiralArchitect/SpiralTorch

# SpiralTorch Python bindings

**A Rust-first learning stack, with a Python door into Z-space.**

Native tensors, autograd, neural modules, geometry, and runtime contracts live
in Rust. Python connects them to experiments and other ML libraries without
making NumPy, PyTorch, Transformers, or provider SDKs mandatory dependencies.

## Install

```bash
python -m pip install -U spiraltorch
```

Package version: **Version 0.4.29**. Wheels target CPython 3.8+, Linux x86_64,
Windows x86_64, and macOS 14+ universal2. The default wheel includes WGPU with
CPU fallback; a compatible GPU and the appropriate execution route are still
required for GPU use.

Source version metadata does not prove publication; check the
[PyPI release history](https://pypi.org/project/spiraltorch/#history) for available
wheels. This source tree can be ahead of PyPI. The documentation links below follow
main and identify source-only paths where applicable. Check the
[package changelog](https://github.com/RyoSpiralArchitect/SpiralTorch/blob/main/bindings/st-py/CHANGELOG.md)
and your installed version before using a new API.

## First Model

```python
import spiraltorch as st
from spiraltorch.nn import Linear, Sequential

print("CPU:", st.describe_device("cpu")["backend"])
model = Sequential()
model.add(Linear(2, 2, name="head"))
print(model(st.Tensor(1, 2, [0.25, 0.75])).tolist())
```

## Native Gradients

Differentiate a squared norm with Rust-owned autograd, without NumPy or PyTorch:

```python
import spiraltorch as st

x = st.AutogradTensor.variable(st.Tensor(1, 2, [1.0, -2.0]))
x.hadamard(x).sum().backward()
assert x.grad().tolist() == [[2.0, -4.0]]
print(x.grad().tolist())
```

This uses host tensors. Continue with [learning recipes](https://github.com/RyoSpiralArchitect/SpiralTorch/blob/main/docs/python/recipes.md),
[geometric learning](https://github.com/RyoSpiralArchitect/SpiralTorch/blob/main/docs/geometric_learning_bridge.md),
or [direct Rust use](https://github.com/RyoSpiralArchitect/SpiralTorch#native-autograd-two-ways).

## Find Your Entry Point

| Surface | Purpose |
| --- | --- |
| `Tensor`, `AutogradTensor` | Native tensors and Rust-owned reverse-mode differentiation |
| `nn`, `optim`, `SpiralSession` | Modules, training, optimization, and runtime planning |
| `ecosystem` | Explicit tensor exchange with other ML libraries |
| `ApiLLMZSpaceRuntime` | Connect hosted-model responses to Z-space runtime traces |
| `runtime_import_preflight_report` | Check optional HF/Torch/PEFT dependencies before a larger run |

- [Getting started](https://github.com/RyoSpiralArchitect/SpiralTorch/blob/main/docs/getting-started.md): tensors, models, and learning loops.
- [Python recipes](https://github.com/RyoSpiralArchitect/SpiralTorch/blob/main/docs/python/recipes.md): sessions, trainers, geometry, API inference, and ecosystem bridges.
- [Capability reference](https://github.com/RyoSpiralArchitect/SpiralTorch/blob/main/docs/python/capabilities.md): runtime contracts, numerical APIs, optional surfaces, and source-only additions.
- [Model zoo](https://github.com/RyoSpiralArchitect/SpiralTorch/blob/main/models/README.md): runnable language-model and other learning examples.
- [Resident NN training](https://github.com/RyoSpiralArchitect/SpiralTorch/blob/main/docs/resident_nn_training.md): explicit GPU-resident execution and weight handoff.
- [DLPack interoperability](https://github.com/RyoSpiralArchitect/SpiralTorch/blob/main/docs/dlpack_interop.md): ownership and copy policies for tensor exchange.

## Optional HF Integration

```bash
python -m pip install 'spiraltorch[hf-runtime]'
```

Optional runtime packages do not download a model or start training. See the
[HF optimizer study](https://github.com/RyoSpiralArchitect/SpiralTorch/blob/main/docs/hf_zspace_optimizer_ablation.md)
for matched experiments, supported routes, and limitations. Geometric
interventions and conventional backend speed are separate evaluation questions.

## Build, Test, and Release

Use the [wheel build and validation guide](https://github.com/RyoSpiralArchitect/SpiralTorch/blob/main/docs/python/build-and-validation.md)
for source builds, an explicit CPU-only feature set, and smoke commands.
The [release runbook](https://github.com/RyoSpiralArchitect/SpiralTorch/blob/main/docs/ops/release.md)
keeps immutable tags, signed wheels, and verified PyPI publication together.

[Full documentation](https://github.com/RyoSpiralArchitect/SpiralTorch/blob/main/docs/README.md) ·
[Z-space introduction](https://github.com/RyoSpiralArchitect/SpiralTorch/blob/main/docs/zspace_intro.md) ·
[GNU AGPL-3.0-or-later](https://github.com/RyoSpiralArchitect/SpiralTorch/blob/main/LICENSE%20.txt)

