Skip to main content

The complete data science toolkit — powered by Rust

Project description

pyscivex

The complete data science toolkit — powered by Rust.

One pip install pyscivex replaces numpy, pandas, scipy, scikit-learn, matplotlib, and more — with Rust performance and zero external Python dependencies.

License: MIT Python 3.9+


Quick Start

import pyscivex as sv

# Tensors (numpy replacement)
a = sv.Tensor([[1.0, 2.0], [3.0, 4.0]])
b = sv.Tensor.ones([2, 2])
c = a @ b
print(c.shape())  # [2, 2]

# DataFrames (pandas replacement)
df = sv.DataFrame({"x": [1.0, 2.0, 3.0], "y": [4.0, 5.0, 6.0]})
print(df.shape())  # (3, 2)

# Statistics (scipy.stats replacement)
data = [2.0, 4.0, 4.0, 4.0, 5.0, 5.0, 7.0, 9.0]
print(sv.mean(data))      # 5.0
print(sv.std_dev(data))   # ~2.0

# Machine Learning (scikit-learn replacement)
model = sv.ml.LinearRegression()
model.fit(sv.Tensor([[1.0], [2.0], [3.0]]), sv.Tensor([2.0, 4.0, 6.0]))
pred = model.predict(sv.Tensor([[4.0]]))

# Visualization (matplotlib replacement)
fig = sv.Figure()
fig.line_plot([1, 2, 3, 4], [1, 4, 9, 16], label="y=x^2")
fig.title("My Plot")
fig.save_svg("plot.svg")

# GPU Acceleration
dev = sv.gpu.Device()
gt = sv.gpu.GpuTensor(dev, [1.0, 2.0, 3.0, 4.0], [2, 2])
result = sv.gpu.matmul(gt, gt)
print(result.to_list())

What's Included

Submodule Replaces Highlights
Core (sv.Tensor) numpy N-d tensors, broadcasting, element-wise math, linear algebra
sv.DataFrame pandas Column-oriented DataFrames, GroupBy, joins, pivots, SQL
sv.stats scipy.stats 14 distributions, hypothesis tests, regression, effect sizes
sv.ml scikit-learn Trees, forests, SVM, KNN, NB, clustering, PCA, t-SNE, pipelines
sv.nn PyTorch Autograd, Linear/Conv/LSTM/GRU/Attention layers, optimizers
sv.optim scipy.optimize Root finding, minimization, ODE solvers, curve fitting, LP
sv.viz matplotlib Line, scatter, bar, histogram, heatmap, box, violin, SVG output
sv.signal scipy.signal + librosa FFT, STFT, wavelets, filters, MFCC, beat tracking, WAV I/O
sv.image OpenCV + Pillow Filters, transforms, features, contours, Hough, augmentation
sv.nlp NLTK + spaCy + gensim Tokenizers, TF-IDF, Word2Vec, sentiment, POS tagging, NER, LDA
sv.graph NetworkX Graph/DiGraph, BFS/DFS, Dijkstra, PageRank, max flow, MST
sv.sym SymPy Symbolic expressions, differentiation, integration, solving
sv.rl Stable-Baselines3 CartPole/MountainCar/GridWorld, DQN, PPO, A2C, SAC, TD3
sv.gpu CuPy GPU tensors via wgpu/Metal/Vulkan, matmul, activations
sv.linalg numpy.linalg LU, QR, SVD, Eigendecomposition, Cholesky
sv.fft numpy.fft 1D/2D FFT, real FFT, inverse FFT
sv.io pandas I/O CSV, JSON read/write

Key Features

  • Zero dependencies — no numpy, no pandas, no scipy. Pure Rust underneath.
  • 697 tests — comprehensive test coverage across all modules.
  • Full type stubs.pyi stubs for IDE autocomplete and mypy support.
  • GPU acceleration — wgpu backend (Metal on macOS, Vulkan on Linux/Windows).
  • 107 Python classes — from Tensor to DQN to Word2Vec.
  • 207 functions — statistics, ML metrics, signal processing, image filters, and more.
  • 16 submodules — one import covers the entire data science stack.

Installation

pip install pyscivex

Requires Python 3.9+. No compiler needed — prebuilt wheels available for:

  • macOS (arm64, x86_64)
  • Linux (x86_64, aarch64)
  • Windows (x64)

Examples

Neural Network Training

import pyscivex as sv

# Build model
model = sv.nn.Sequential([
    sv.nn.Linear(784, 128, seed=42),
    sv.nn.ReLU(),
    sv.nn.Linear(128, 10, seed=43),
])

# Training loop
optimizer = sv.nn.Adam(model.parameters(), lr=0.001)
for epoch in range(10):
    x = sv.nn.tensor([[1.0] * 784], requires_grad=True)
    y = sv.nn.tensor([[1.0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])
    pred = model.forward(x)
    loss = sv.nn.mse_loss(pred, y)
    loss.backward()
    optimizer.step()
    optimizer.zero_grad()

Statistical Analysis

import pyscivex as sv

group_a = [23.0, 25.0, 28.0, 30.0, 32.0]
group_b = [18.0, 20.0, 22.0, 24.0, 26.0]

result = sv.stats.ttest_ind(group_a, group_b)
print(f"t={result['statistic']:.3f}, p={result['p_value']:.4f}")

effect = sv.stats.cohens_d(group_a, group_b)
print(f"Cohen's d = {effect:.3f}")

Reinforcement Learning

import pyscivex as sv

agent = sv.rl.DQN(4, 2, learning_rate=0.001, seed=42)
result = agent.train_cartpole(episodes=100)
print(f"Mean reward (last 10): {result['episode_rewards'][-10:]}")

Graph Analysis

import pyscivex as sv

g = sv.graph.Graph.from_edges([(0, 1, 1.0), (1, 2, 2.0), (0, 2, 4.0)])
dists, _ = g.dijkstra(0)
print(f"Shortest distances from 0: {dists}")

mst, cost = g.kruskal()
print(f"MST cost: {cost}")

Symbolic Math

import pyscivex as sv

x = sv.sym.var("x")
expr = x ** sv.sym.constant(2.0) + sv.sym.constant(3.0) * x
deriv = sv.sym.sym_diff(expr, "x")
print(deriv.eval({"x": 2.0}))  # 7.0 (2x + 3 at x=2)

GPU Computing

import pyscivex as sv

dev = sv.gpu.Device()
print(dev.info())  # {'name': 'Apple M...', 'backend': 'Metal', ...}

a = sv.gpu.GpuTensor(dev, [1.0, 2.0, 3.0, 4.0], [2, 2])
b = sv.gpu.GpuTensor(dev, [5.0, 6.0, 7.0, 8.0], [2, 2])
c = sv.gpu.matmul(a, b)
print(c.to_list())  # [19.0, 22.0, 43.0, 50.0]

License

MIT

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

pyscivex-0.1.0.tar.gz (1.2 MB view details)

Uploaded Source

Built Distributions

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

pyscivex-0.1.0-cp312-cp312-win_amd64.whl (9.6 MB view details)

Uploaded CPython 3.12Windows x86-64

pyscivex-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (10.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pyscivex-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (10.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

pyscivex-0.1.0-cp312-cp312-macosx_11_0_arm64.whl (9.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyscivex-0.1.0-cp312-cp312-macosx_10_12_x86_64.whl (9.7 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

File details

Details for the file pyscivex-0.1.0.tar.gz.

File metadata

  • Download URL: pyscivex-0.1.0.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.12.6

File hashes

Hashes for pyscivex-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f3efd332074b49ede45fb3124a534b3f562d2b49f42f173777c072d12d280598
MD5 41f07717ea53c6705d48238420405a71
BLAKE2b-256 3e3a856375e85a1ee32b4e87d76922f69c6155761ea60ee6347ad72540aa4372

See more details on using hashes here.

File details

Details for the file pyscivex-0.1.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyscivex-0.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0d57b59af8e6900b7217886e28d0aef37220c6171b3ff339c54004999c61158d
MD5 b4537778a47605ada8cbc75e17236cdb
BLAKE2b-256 d7c7ee9829f6536fca37a8bffeef3364bd37d235793f8a04143cd4a60d323d95

See more details on using hashes here.

File details

Details for the file pyscivex-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyscivex-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a5e9b78f078d258cc38214f94310b73d20974513d557385946d4b28a3c9cfe30
MD5 a2cfe09265486d4d34024a029747276c
BLAKE2b-256 fb7f51a701d3b5dc831d6a50f24af5e23c0e544d6ac31270548751f962977408

See more details on using hashes here.

File details

Details for the file pyscivex-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyscivex-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 de5963abe699553b8d4073cae33cdbe40ea1947412369e61f819158d005d101a
MD5 0f3e07b83705e225bb7eddab53dfb53a
BLAKE2b-256 3172f2b0bc151672a6543672b01e0f91e5226e5405e4addd2b11b9988664d46c

See more details on using hashes here.

File details

Details for the file pyscivex-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyscivex-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 88d651f357a78493f275842e368861cc922286d09887be2059a9b2eee1362b0d
MD5 64bdc8d5a17a0a5e0e637f0ab8757ba3
BLAKE2b-256 64e3766eee63fef3f0ab0637fc0bf3447888540792a6573e45924ab574179d69

See more details on using hashes here.

File details

Details for the file pyscivex-0.1.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pyscivex-0.1.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7ff2765c8632da86cf640c886c5ab532734efef0121ff6660fe5b93d64e2a04b
MD5 287a49e3c34ff9fa3794dec9340f5709
BLAKE2b-256 0dc9041e18944acb0d28a0d74e80b72c56359e7ecbf89d94a92549f8663e83ac

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