[Feature] PyO3 bindings for Preprocessor
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 76/100
Research direction
Start with qdp-core/src/preprocessing.rs to review the existing Preprocessor methods, then inspect the qdp-python crate's PyO3 entry points and current error mapping. Bind the four existing f64 methods without changing preprocessing algorithms, map validation failures to Python exceptions while preserving their messages, and verify the exposed Python calls and error behavior.
Written by the indexing model from the issue text.
Description
What
Expose the existing Rust Preprocessor (qdp-core/src/preprocessing.rs) to Python via PyO3, so Python users can call its validation and L2-norm helpers directly instead of reimplementing them.
Why
Preprocessor already exists and is tested in Rust, but it is invisible from Python — qumat_qdp users currently have no supported way to validate or compute norms on input before handing it to the encoder, so they either skip validation or duplicate the logic in Python. Binding the existing API closes that gap with no new core logic.
How
- Add a PyO3 wrapper (in the
qdp-pythoncrate) exposingPreprocessorand its four current methods:validate_input(host_data: &[f64], num_qubits: usize) -> Result<()>calculate_l2_norm(host_data: &[f64]) -> Result<f64>validate_batch(...)calculate_batch_l2_norms(...) -> Result<Vec<f64>>
- Bind
f64— the current Rust API isf64-only. Leave anyf32variant as a follow-up rather than widening the core here. - Map Rust validation errors to Python exceptions (e.g.
ValueError) preserving the original message, so a failedvalidate_inputraises cleanly in Python. - Keep method names and signatures aligned with the Rust API to minimize surprise; defer public re-export and docs to C2.
Note: Preprocessor currently has no normalize/standardize method (its struct doc mentions "normalization" aspirationally, but only the four methods above exist). This issue binds what exists; do not invent normalize/standardize here.
Out of scope: Public-API export from __init__.py and docstrings (C2), f32 variants, any change to the preprocessing algorithms, adding new normalize/standardize methods.
- Dominant language
- Rust
- Stars
- 2.3k
- Forks
- 1k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 7
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/mahout
-
[Bug] Amazon Braket get_final_state_vector() changes the circuit, so execute_circuit() fails afterwardsPossibly taken @Howardisme claimed this 48 days ago. Openbug enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
apache/mahout#1538 · 1 comment ·
Maintainers usually reply within 2 days
-
[Bug] Reusing a parameter name on two gates fails on Qiskit only (name conflict adding parameter)Possibly taken @Imad2702 claimed this 50 days ago. Openbug enhancement good-first-issue qumat
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
apache/mahout#1509 · 2 comments ·
Maintainers usually reply within 2 days
-
[Bug] Cirq backend ignores the initialized simulator and creates its own cirq.Simulator()Possibly taken @Howardisme claimed this 49 days ago. Openbug enhancement good-first-issue qumat
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
apache/mahout#1508 · 1 comment · 1 assignee ·
Maintainers usually reply within 2 days
-
[Bug] Unknown backend_name leaks ModuleNotFoundError instead of a clear ValueErrorPossibly taken @Asterisk-Hunter claimed this 38 days ago. Openbug enhancement good-first-issue qumat
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
apache/mahout#1506 · 5 comments ·
Maintainers usually reply within 2 days
-
bug docs enhancement question
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 2 days
Similar issues
-
chat compiler P1
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
HerringtonDarkholme/hd-lang#2793 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
security-advisory
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
MinBZK/regelrecht#2173 ·
-
ci
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
jonathanong/no-mistakes#5804 ·
-
triage: failed
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
oxc-project/tsrs#1277 · 1 comment ·
Maintainers usually reply within 1 day