Skip to main content

Compatibility layer for NumPy 2.x with GPU acceleration support

Reason this release was yanked:

ggr

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

omninumpy-0.1.5.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

omninumpy-0.1.5-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file omninumpy-0.1.5.tar.gz.

File metadata

  • Download URL: omninumpy-0.1.5.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for omninumpy-0.1.5.tar.gz
Algorithm Hash digest
SHA256 b33d31ee919ae6cd157c6c5e41ecd89cad4546f9eacceffca49863f2319cbdc6
MD5 12d52a0ac4922b1428b86202dae78f2d
BLAKE2b-256 a9fe4a1f5bcebf6a62a4abbef689edbe86ecc6603022dbd2de4ec673b5b9f2aa

See more details on using hashes here.

File details

Details for the file omninumpy-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: omninumpy-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for omninumpy-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 912dd2c7b3c3d42de22eb754148db45e951f4366e4dcb948eeaccd3d8e0caa1e
MD5 2c65e9b35f0e181edeb5f213717a8f4b
BLAKE2b-256 be473f1d7e67e4d96a8a40c96c566c95c4a1360ea6540cb9e973cfe87f9c7c3f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page