Welcome to arrayops Documentation

Rust-backed acceleration for Python’s ``array.array`` type

PyPI version Python version Rust version Code coverage

Fast, lightweight numeric operations for Python’s array.array, numpy.ndarray (1D), and memoryview objects. Built with Rust and PyO3 for zero-copy, memory-safe performance.

Key Features

  • ⚑ High Performance: 10-100x faster than pure Python loops

  • πŸ”’ Memory Safe: Zero-copy buffer access with Rust’s safety guarantees

  • πŸ“¦ Lightweight: No dependencies beyond Rust standard library (optional: parallel execution via rayon)

  • πŸ”Œ Compatible: Works directly with Python’s array.array, numpy.ndarray (1D), and memoryview - no new types

  • βœ… Fully Tested: 100% code coverage (Python and Rust)

  • 🎯 Type Safe: Full mypy type checking support

  • πŸš€ Optional Optimizations: Parallel execution and SIMD support via feature flags

Quick Start

import array
import arrayops

# Create an array
data = array.array('i', [1, 2, 3, 4, 5])

# Fast sum operation
total = ao.sum(data)
print(total)  # 15

# In-place scaling
ao.scale(data, 2.0)
print(list(data))  # [2, 4, 6, 8, 10]

# Map operation (returns new array)
doubled = ao.map(data, lambda x: x * 2)
print(list(doubled))  # [4, 8, 12, 16, 20]

Installation

# Install maturin if not already installed
pip install maturin

# Install in development mode
maturin develop

# Or install from source
pip install -e .

# With optional features
maturin develop --features parallel

Documentation Overview

Getting Started

New to arrayops? Start here to learn the basics.

User Guide

Comprehensive guides for using arrayops, including API reference, examples, performance tips, and troubleshooting.

Developer Guide

Information for contributors, including development setup, architecture details, and contribution guidelines.

Reference

Reference materials including changelog and roadmap.

Indices and tables