Variopinta
Variopinta is an experimental CPU image-augmentation compiler with a Python configuration API and a Rust execution core. It compiles complete pipelines to reduce Python/native crossings, reuse buffers, select optimized kernels, and report the resulting execution plan.
Variopinta is the feminine form of the Spanish variopinto: “varied in color or appearance,” from Italian variopinto, “varied” and “painted.” — RAE
Variopinta is image-only and pre-release. The public Python API may change
between 0.y.0 releases; patch releases preserve documented signatures and
data contracts unless a correctness or security fix requires otherwise.
Installation
Version 0.1 supports CPython 3.10–3.13 on 64-bit x86 Linux with glibc 2.34 or newer. AVX2 is detected at runtime and is not required. Other Python implementations, operating systems, architectures, and 32-bit environments are not supported.
Install Variopinta from PyPI:
python -m pip install variopinta
To build from a source checkout, install Rust 1.87 or newer, a C/C++ toolchain, CMake, and NASM. On Ubuntu, the native prerequisites are:
sudo apt-get update
sudo apt-get install build-essential cmake nasm
python -m pip install .
The build uses Maturin through Python build isolation. NumPy is installed as the only required runtime dependency.
ToTorch is optional and requires a PyTorch build compatible with the selected
Python and Linux environment:
python -m pip install torch
Quick start
import numpy as np
import variopinta as vp
pipeline = vp.Compose(
[
vp.RandomCrop(256, 256),
vp.Resize(224, 224),
vp.HorizontalFlip(p=0.5),
vp.Normalize(),
],
seed=42,
).compile()
image = np.zeros((320, 320, 3), dtype=np.uint8)
output = pipeline(image, key=0)
print(output.shape, output.dtype) # (224, 224, 3) float32
print(pipeline.explain())
Compose provides the semantic reference path; .compile() selects the
optimized execution plan. explain() reports operations, pixel passes,
buffers, copies, dtype and layout changes, fusion, and portable fallbacks. Its
schema version is 2: each step has an always, conditional, or never
status, and exact p=0 routes report only work that can execute.
Use an explicit unsigned 64-bit key when a result must be independent of call
order or worker assignment. Omitting it advances the sequence associated with
the pipeline seed.
Data contract
| Stage | Type | Shape and layout |
|---|---|---|
| Pipeline input | NumPy uint8 |
HWC RGB with positive dimensions |
| Default output | NumPy uint8 |
owned, contiguous HWC RGB |
After Normalize |
NumPy float32 |
owned, contiguous HWC RGB |
After terminal ToTorch |
CPU tensor | contiguous CHW; preserves the current dtype |
Non-contiguous NumPy input is made contiguous at the Python boundary.
Normalize must be terminal or immediately precede ToTorch; ToTorch must
always be last. Public floating-point configuration is stored at its effective
finite float32 value. Values that overflow float32 or leave a documented
open or closed domain after conversion raise ValueError.
Transforms
- Geometry:
Resize,RandomCrop,RandomResizedCrop,CenterCrop,PadIfNeeded,Affine,RandomRotation,Perspective, andGridDistortion. - Flips:
HorizontalFlipandVerticalFlip. - Color and filtering:
ColorJitter,GaussianBlur,GaussianNoise,Sharpen,Grayscale,Invert,Solarize, andPosterize. - Dropout:
CoarseDropout. - Terminal conversion:
NormalizeandToTorch.
Transforms are immutable configuration objects and accept an application
probability p where applicable. Geometric operations support the documented
nearest or bilinear interpolation policies and constant or reflect-101 borders.
Variopinta defines its own rounding, sampling, and border semantics; it does
not promise pixel or random-stream identity with another library. Affine and
RandomRotation reject an input axis above 16,777,216 before rasterization.
Image I/O
read_image and decode_image accept JPEG or static PNG and return owned,
contiguous NumPy arrays. Decode modes are unchanged, gray, rgb, and
rgba.
encode_image and write_image support:
- JPEG:
uint8grayscale or RGB, quality 1–100; - PNG: one to four
uint8oruint16channels, compression 0–9.
import variopinta as vp
image = vp.read_image("input.jpg")
encoded = vp.encode_image(image, format="jpeg", quality=90)
decoded = vp.decode_image(encoded)
vp.write_image("output.png", decoded, compression=6)
Format detection uses file contents when decoding. EXIF orientation, metadata preservation, and animated PNG are not supported.
Reproducibility and limits
Repeated keyed calls are deterministic for the same installed release, execution environment, pipeline, input, seed, and key. Exact pixels or random streams are not guaranteed across releases, builds, or platforms. Pin the full package build and record those inputs when bit-exact replay matters.
Current scope excludes structured targets such as masks and bounding boxes, GPU execution, native batches, and Python callbacks inside a pipeline. The augmentation path retains the GIL while it borrows NumPy input; native codec and file I/O work releases it.
Performance evidence
The controlled benchmark compares Variopinta with Torchvision v2, Albumentations, and AlbumentationsX on one reference machine. It measures equivalent materialized work and records correctness, copies, buffers, kernel paths, hardware, and statistical limits. The results support the compiled pipeline design; they do not establish a universal Rust speed advantage.
The reproducible harness and committed evidence are available under
benchmarks/ and results/.
Project information
License
Variopinta is licensed under the Apache License 2.0. Native wheels contain permissively licensed third-party components; their required attributions are in THIRD_PARTY_NOTICES.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file variopinta-0.1.0.tar.gz.
File metadata
- Download URL: variopinta-0.1.0.tar.gz
- Upload date:
- Size: 81.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1a682e76144095036d8af7fd929f6da5769d50575c6a1e2be7c1a87bebaa3ce
|
|
| MD5 |
cf5e1f9bf6e3d5e9276d4e6e7d657bf9
|
|
| BLAKE2b-256 |
91f864af448595b860e00a0dc642166ceb8d193f07f44502f475292c84efc6e8
|
Provenance
The following attestation bundles were made for variopinta-0.1.0.tar.gz:
Publisher:
release.yml on claverru/variopinta
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
variopinta-0.1.0.tar.gz -
Subject digest:
c1a682e76144095036d8af7fd929f6da5769d50575c6a1e2be7c1a87bebaa3ce - Sigstore transparency entry: 2679266134
- Sigstore integration time:
-
Permalink:
claverru/variopinta@c8b7bd56dabc474966b202a8fe67b06ca7c596f6 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/claverru
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c8b7bd56dabc474966b202a8fe67b06ca7c596f6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file variopinta-0.1.0-cp310-abi3-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: variopinta-0.1.0-cp310-abi3-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 953.1 kB
- Tags: CPython 3.10+, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93950596f552951e2b510941c6098618dd44df42f5932f641b5b2a94afd42667
|
|
| MD5 |
6c63e0fd76c74d1c2a55208ba6c0fcb3
|
|
| BLAKE2b-256 |
3758bf654db89277b8c983cbfc3063fd48f1c94901fa8cadf4c90c020c1795af
|
Provenance
The following attestation bundles were made for variopinta-0.1.0-cp310-abi3-manylinux_2_34_x86_64.whl:
Publisher:
release.yml on claverru/variopinta
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
variopinta-0.1.0-cp310-abi3-manylinux_2_34_x86_64.whl -
Subject digest:
93950596f552951e2b510941c6098618dd44df42f5932f641b5b2a94afd42667 - Sigstore transparency entry: 2679266146
- Sigstore integration time:
-
Permalink:
claverru/variopinta@c8b7bd56dabc474966b202a8fe67b06ca7c596f6 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/claverru
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c8b7bd56dabc474966b202a8fe67b06ca7c596f6 -
Trigger Event:
push
-
Statement type: