You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Many examples fail because Python modules aren't mapped to Rust equivalents. Currently depyler emits module.function() as-is, causing E0425 (undefined) errors.
Current Module Support (partial)
Python
Rust
Status
argparse
clap
✅ Working
datetime
chrono
⚠️ Partial
pathlib
std::path
⚠️ Partial
json
serde_json
⚠️ Partial
typing
Native types
✅ Working
Modules Needed
Python Standard Library (Priority 1)
Module
Rust Crate
Examples Using
os
std::fs, std::env
15+
sys
std::env
10+
re
regex
8+
collections
std::collections
12+
itertools
itertools
6+
functools
Native closures
5+
io
std::io
10+
subprocess
std::process
4+
asyncio
tokio
5+
threading
std::thread
3+
zipfile
zip
2+
csv
csv
4+
hashlib
sha2, md5
3+
base64
base64
2+
struct
byteorder
2+
socket
std::net
2+
logging
log, tracing
5+
unittest
(skip/stub)
N/A
tempfile
tempfile
3+
shutil
fs_extra
3+
glob
glob
2+
pickle
serde + bincode
2+
NumPy (Priority 2)
Function
Rust Equivalent
Notes
np.array
Vec or ndarray
Type inference needed
np.zeros/ones
vec![0.0; n]
Shape handling
np.sum/mean/std
Iterator methods
Aggregate functions
np.dot
Manual or nalgebra
Matrix ops
np.sqrt/exp/log
f64 methods
Math functions
np.reshape
Manual indexing
Shape manipulation
np.concatenate
Vec::extend
Array joining
np.where
Iterator::filter
Conditional
Broadcasting
Manual loops
Complex
Scikit-learn (Priority 3)
Class
Rust Equivalent
Notes
train_test_split
Manual split
Simple
StandardScaler
Manual normalize
Stateful
LinearRegression
linfa
Full crate
KMeans
linfa-clustering
Full crate
metrics.*
Manual impl
accuracy, f1, etc
Pipeline
Trait chain
Design needed
PyTorch (Priority 4)
Class
Rust Equivalent
Notes
torch.Tensor
tch::Tensor
tch-rs bindings
nn.Module
Trait
Custom trait
nn.Linear
tch layers
Direct mapping
optim.Adam
Manual or tch
Optimizer
autograd
tch autograd
Complex
Proposed Implementation
Option A: Stub Generation
// Generated stub for unsupported modulemod zipfile {pubstructZipFile;implZipFile{pubfnnew(_:&str, _:&str) -> Self{todo!("zipfile not implemented")}}}
Problem
Many examples fail because Python modules aren't mapped to Rust equivalents. Currently depyler emits
module.function()as-is, causing E0425 (undefined) errors.Current Module Support (partial)
Modules Needed
Python Standard Library (Priority 1)
NumPy (Priority 2)
Scikit-learn (Priority 3)
PyTorch (Priority 4)
Proposed Implementation
Option A: Stub Generation
Option B: Crate Mapping
Option C: Feature Flags
Acceptance Criteria
Related