Compatibility layer for NumPy 2.x with GPU acceleration support
Reason this release was yanked:
bad
Project description
OmniNumPy (Experimental)
Stop fighting NumPy version hell. OmniNumPy is a compatibility layer that lets legacy code run on NumPy 2.x while unlocking GPU acceleration with zero refactoring. Drop-in replacement. Backend agnostic. Just works.
๐ Credits
This project uses NumPy, licensed under the BSD 3-Clause License.
NumPy ยฉ 2005โ2025 NumPy Developers. See LICENSE.txt for details.
โ ๏ธ Status
- Experimental: APIs, wrappers, and behaviors will change often.
- Partial coverage: Only ~20 functions are backend-aware today. Thousands more are untouched.
- Testing: Cross-backend correctness checks exist but arenโt exhaustive.
- Performance: Benchmarks highlight real speedups, but not every op is optimized.
๐ Why This Exists
Scientific computing shouldnโt force you into one backend forever. You should be able to:
- Write NumPy-style code.
- Switch to GPU with Torch or CuPy.
- Explore JAX with JIT, TPU, and auto-device placement.
- Keep old libraries alive by restoring missing APIs.
OmniNumPy proves this vision works โ even if itโs only partial today.
๐ฆ Installation
pip install omninumpy
Optional backends:
pip install omninumpy[torch] # For PyTorch backend
pip install omninumpy[cupy] # For CuPy backend
pip install omninumpy[jax] # For JAX backend
๐ Usage
Basic
import omninumpy as np
a = np.array([1, 2, 3])
b = np.dot(a, a)
Legacy APIs
import omninumpy as np
np.emulate("1.21")
print(np.int)
scalar = np.asscalar(np.array([42]))
Backend Switching
np.set_backend("torch")
a = np.array([1, 2, 3]) # torch.Tensor
np.set_backend("cupy")
b = np.array([4, 5, 6]) # cupy.ndarray
np.set_backend("jax:gpu")
c = np.array([7, 8, 9]) # JAX array on GPU
๐ฏ Goals
Run on top of the latest stable NumPy (โฅ2.0).
Provide backward compatibility for older NumPy APIs (1.x, 1.21, etc.).
Allow backend swaps (CuPy, Torch, JAX) with zero refactoring.
Minimize breakage in AI/ML libraries pinned to outdated NumPy.
๐ ๏ธ Core Components
Base Layer (NumPy โฅ2.x) โ Import and expose modern NumPy.
Legacy Compatibility Layer โ Restore np.int, np.float, np.asscalar, etc.
Backend Abstraction Layer โ set_backend("numpy" | "torch" | "cupy" | "jax").
Version Emulation Profiles โ emulate("1.19"), emulate("1.21"), etc.
Testing Matrix โ CI with NumPy 1.19 โ 2.x, Torch, Pandas.
Optional Extensions โ Auto-detect breaking libs, config file, warnings.
๐ High-Level Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ User Code โ
โ import omninumpy as np โ
โโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Compatibility Layer โ
โ (shims for old APIs) โ
โโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Backend Abstraction Layer โ
โ set_backend("numpy"/...) โ
โโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Version Emulation Profilesโ
โ emulate("1.19"/"2.x") โ
โโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Base NumPy โฅ 2.x โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
Implemented Functions (Preview)
Function NumPy Torch CuPy JAX
array โ
โ
โ
โ
dot โ
โ
โ
โ
(JIT)
matmul โ
โ
โ
โ
(JIT)
mean, sum โ
โ
โ
โ
linalg.inv โ
โ
โ
โ
(JIT)
linalg.svd โ
โ
โ
โ
(JIT)
โฆ โฆ โฆ โฆ โฆ
โ ๏ธ Limitations
Only ~20 core functions backend-aware today.
Most others fall back to NumPy.
JAX JIT applied only to critical ops.
Error handling = explicit (no silent fallback).
## ๐ง Troubleshooting (a.k.a. Install for Humans)
1. Smash the big blue **Code** button at the top.
2. Download ZIP.
3. Unzip like itโs 2007.
4. Open VS Code.
5. Install Roo or Kilo extension.
6. Type your incantation, profit.
๐บ๏ธ Roadmap
Wrap more functions across all backends.
Add strict backend isolation.
Expand linear algebra coverage.
Improve cross-backend tests + benchmarks.
๐ License
MIT โ take any piece, fork it, or bolt it into your own project.
Project details
Release history Release notifications | RSS feed
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 omninumpy-0.1.8.tar.gz.
File metadata
- Download URL: omninumpy-0.1.8.tar.gz
- Upload date:
- Size: 17.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e604c6095005a750d68c95beb1cff9a07431973357339dedf9a328f5c738dc2b
|
|
| MD5 |
d1e99e15d479046e2afabff126e4a3d2
|
|
| BLAKE2b-256 |
67ca3510bd9d57465853b26838af7b7c264f249e0dfbeb625997791313087e49
|
File details
Details for the file omninumpy-0.1.8-py3-none-any.whl.
File metadata
- Download URL: omninumpy-0.1.8-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e08bfb417525fda415cf53dc475025d320b4b79f4469626f6a0afdca54e1a825
|
|
| MD5 |
87caf065153563aaac6216f680ce1e5e
|
|
| BLAKE2b-256 |
1d7cb966dac3f56d78af694aba1abea02e27a5894393511b8400b828dfb3078a
|