What is Pyroid?
Pyroid is a collection of blazing fast Rust-powered utilities designed to eliminate Python’s performance bottlenecks. It provides high-performance implementations across multiple domains with a focus on memory safety, efficiency, and ease of use.
How does it work?
Pyroid leverages Rust’s performance and memory safety guarantees to accelerate CPU-heavy tasks in Python. It provides a simplified architecture with minimal dependencies and a domain-driven design for better organization, all while maintaining an easy-to-use Python interface.
Key features include:
- Rust-powered acceleration: Built with Rust to eliminate performance bottlenecks in CPU-heavy tasks
- Simplified architecture: Minimal external dependencies for better maintainability
- Domain-driven design: Organized by functionality domains
- Easy Python imports: Just
pip install pyroid
and start using - Modular toolkit: Optional features that can be selectively enabled
- Optimized async operations: High-performance async operations with unified runtime
- Zero-copy buffer protocol: Efficient memory management without copying
- Parallel processing: Batch processing with adaptive sizing for optimal performance
Pyroid Architecture
Pyroid uses a modular architecture with the following components:
- Math Module: Numerical computations and vector/matrix operations
- String Module: Text processing and manipulation
- Data Module: Collection and DataFrame operations
- I/O Module: File and network operations
- Image Module: Basic image manipulation
- ML Module: Basic machine learning algorithms
- Core Module: Core functionality including runtime, buffer, and parallel processing
These components work together to provide a comprehensive toolkit for accelerating Python applications.
Where can I get it?
Download Pyroid from GitHub and get started with it now!
If you have any problems or require assistance, please open a support issue here .
High-level architecture
Core Features
Pyroid implements a comprehensive set of features for performance optimization:
Pyroid provides several key features for performance optimization:
- Simplified Architecture: Minimal external dependencies for better maintainability
- Domain-Driven Design: Organized by functionality domains
- Pythonic API: Easy to use from Python with familiar interfaces
- Memory Efficiency: Optimized memory usage for large datasets
- Cross-Platform: Works on Windows, macOS, and Linux
- Unified Async Runtime: Shared Tokio runtime for all async operations
- Zero-Copy Buffer Protocol: Efficient memory management without copying
- GIL-Aware Scheduling: Optimized task scheduling with Python’s GIL
- Parallel Processing: Efficient batch processing with adaptive sizing
Module Overview
Pyroid consists of several key modules:
Pyroid includes the following modules:
- Math: Numerical computations including vector operations, matrix operations, and statistics
- String: Text processing including reverse, base64_encode, and base64_decode
- Data: Collection and DataFrame operations including filter, map, reduce, and dataframe_apply
- I/O: File and network operations including read_file, write_file, http_get, and http_post
- Image: Basic image manipulation including create_image, to_grayscale, resize, and blur
- ML: Basic machine learning including kmeans, linear_regression, normalize, and distance_matrix
- Core: Core functionality including runtime, buffer, and parallel processing
Getting Started
Installation
# Simple installation via pip
pip install pyroid
# Or clone the repository for development
git clone https://github.com/ao/pyroid.git
cd pyroid
python build_and_install.py
Basic Usage
import pyroid
# Math operations
v1 = pyroid.math.Vector([1, 2, 3])
v2 = pyroid.math.Vector([4, 5, 6])
v3 = v1 + v2
print(f"Vector sum: {v3}")
print(f"Dot product: {v1.dot(v2)}")
# String processing
text = "Hello, world!"
reversed_text = pyroid.text.reverse(text)
encoded = pyroid.text.base64_encode(text)
# Data operations
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
even_numbers = pyroid.data.filter(numbers, lambda x: x % 2 == 0)
squared = pyroid.data.map(numbers, lambda x: x * x)