API Stability Guarantees
This document describes the API stability guarantees for arrayops 1.0.0 and beyond.
Version 1.0.0 API Stability
As of version 1.0.0, arrayops follows Semantic Versioning:
MAJOR version (1.x.x): Breaking API changes
MINOR version (x.1.x): New functionality in a backward-compatible manner
PATCH version (x.x.1): Backward-compatible bug fixes
Public API Surface
The public API consists of:
Functions
All functions are exported from the arrayops package and its submodules:
Basic Operations:
sum(arr)- Compute sum of elementsscale(arr, factor)- Scale elements in-placemean(arr)- Compute arithmetic meanmin(arr)- Find minimum valuemax(arr)- Find maximum value
Transform Operations:
map(arr, fn)- Apply function to each elementmap_inplace(arr, fn)- Apply function to each element in-placefilter(arr, predicate)- Filter elements based on predicatereduce(arr, fn, initial=None)- Fold array with binary function
Statistical Operations:
std(arr)- Population standard deviationvar(arr)- Population variancemedian(arr)- Find median value
Element-wise Operations:
add(arr1, arr2)- Element-wise additionmultiply(arr1, arr2)- Element-wise multiplicationclip(arr, min_val, max_val)- Clip values to range (in-place)normalize(arr)- Normalize to [0, 1] range (in-place)
Manipulation Operations:
reverse(arr)- Reverse array in-placesort(arr)- Sort array in-placeunique(arr)- Get unique elements
Slice Operations:
slice(arr, start=None, end=None)- Zero-copy array slicing
Iterator:
array_iterator(arr)- Create iterator over array elementsArrayIterator- Iterator class
Lazy Evaluation:
lazy_array(arr)- Create lazy array wrapperLazyArray- Lazy array class
Classes
ArrayIterator- Iterator for array elementsLazyArray- Lazy evaluation wrapper for operation chaining
API Stability Guarantees
Guaranteed Stable (1.0.0+)
Function Signatures: All public function signatures are stable
Parameter names and types will not change
Return types will not change
Optional parameters will remain optional
Function Behavior: Core behavior is stable
Operations produce consistent results
Error conditions remain the same
Performance characteristics are maintained or improved
Input Types: Supported input types are stable
array.array- Primary supported typenumpy.ndarray(1D, contiguous) - Supportedmemoryview- SupportedApache Arrow buffers/arrays - Supported
Typecodes: Supported typecodes are stable
Signed integers:
b,h,i,lUnsigned integers:
B,H,I,LFloats:
f,d
Future Changes
The following may change in MINOR versions (new functionality):
New Functions: New operations may be added
New Classes: New utility classes may be added
Performance Improvements: Performance may improve without API changes
New Features: New optional features may be added
The following require MAJOR versions (breaking changes):
Removed Functions: Functions will not be removed without a major version bump
Changed Signatures: Function signatures will not change without a major version bump
Changed Behavior: Breaking behavior changes require a major version bump
Removed Support: Removing support for input types or typecodes requires a major version bump
Known Limitations
API Limitations
NumPy Arrays: Only 1D, contiguous NumPy arrays are supported
Multi-dimensional arrays: Not supported
Non-contiguous arrays: Not supported (will raise ValueError)
Memoryview: Read-only memoryviews cannot be used with in-place operations
Operations like
scale(),clip(),normalize(),reverse(),sort()require writable memoryviews
Arrow Buffers: Immutable - in-place operations are not supported
Operations like
scale(),clip(),normalize()will raise ValueError
Type Restrictions: Only numeric types are supported
Object arrays (e.g.,
array.array('O', [...])): Not supportedString arrays: Not supported
Mixed types: Not supported
Empty Arrays: Some operations handle empty arrays specially:
sum(): Returns 0 (or 0.0 for floats)mean(): Raises ValueError (cannot compute mean of empty array)std(),var(): Raise ValueErrormin(),max(): Raise ValueError
Integer Overflow: Integer arithmetic may wrap (Rust default behavior)
Python integers are arbitrary precision, but array.array uses fixed-size integers
Overflow behavior matches Rust’s default (wrapping arithmetic)
Consider using floats for large numbers that may overflow
Error Handling
Error Types: Consistent error types are used:
TypeError: Wrong input type or unsupported typecodeValueError: Invalid values (e.g., empty array, invalid slice indices)BufferError: Buffer access issues
Error Messages: Error messages may be improved in patch versions
Core error conditions remain the same
Messages may become more descriptive
Migration Considerations
From 0.x to 1.0.0
See MIGRATION.md for detailed migration guide.
Key points:
No breaking changes from 0.4.x to 1.0.0
All 0.4.x code should work unchanged
New features are additive only
Future Versions
When migrating to future versions:
MINOR versions (1.1.0, 1.2.0, etc.): No changes required
PATCH versions (1.0.1, 1.0.2, etc.): No changes required
MAJOR versions (2.0.0, etc.): Check migration guide for breaking changes
Stability Notes
Internal Implementation: Internal implementation details may change
Private APIs: Private functions and modules are not stable
Performance: Performance may improve or change (usually improves)
Dependencies: Dependency versions may change (backward compatible versions only)
Contact
For questions about API stability or migration:
GitHub Issues: Report concerns or questions
Documentation: Check migration guides and changelog
Security: See SECURITY.md for security-related API considerations