Python Binding Code Reviewer

Review PyO3 binding code for Rust-only business logic adherence.

1|Updated Jul 2, 2025
One-click install
npx skills add https://github.com/jeickmeier/rfin --skill python-binding-code-reviewer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Python Binding Code Reviewer
Source: https://github.com/jeickmeier/rfin/tree/main/.cursor/skills/python-binding-reviewer
Command: npx skills add https://github.com/jeickmeier/rfin --skill python-binding-code-reviewer

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and scripts (resource) components.

What problem does it solve?

This Skill ensures that Python bindings for Rust libraries strictly adhere to the principle of keeping all core logic within the Rust codebase, preventing code duplication and potential drift between Python and WASM implementations.

Core Features & Use Cases

  • Code Review: Analyzes Python binding code (finstack-py/) against established best practices.
  • Logic Enforcement: Identifies and flags business logic, computations, or validation implemented directly in Python bindings.
  • Pattern Consistency: Verifies adherence to standard wrapper patterns, type conversion, and error mapping.
  • Use Case: A developer submits a pull request for new Python bindings. This Skill reviews the code to ensure no financial calculations are performed in Python, all errors are correctly mapped to Python exceptions, and the structure mirrors the Rust core library.

Quick Start

Review the attached Python binding code for adherence to Rust-only logic principles.

Frequently Asked Questions about Python Binding Code Reviewer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I review Python bindings to ensure Rust logic stays in Rust?

Reviewing Python binding code for Rust logic enforcement involves analyzing PyO3 wrappers to identify business logic or computations implemented directly in Python. Validating adherence to standard wrapper patterns, type conversion, and error mapping prevents logic drift between Python and WASM implementations.

Why does my PyO3 binding code duplicate business logic instead of wrapping the Rust core?

PyO3 binding code duplicates business logic when developers implement calculations or validation directly in Python instead of calling the Rust core. Reviewing the binding code identifies these computations and enforces strict wrapper patterns to prevent drift between Python and WASM implementations.

What is the best way to map Rust errors to Python exceptions in PyO3 bindings?

The best way to map Rust errors to Python exceptions in PyO3 bindings is to verify adherence to established error mapping patterns during code review. This ensures all Rust errors are correctly mapped to corresponding Python exceptions while maintaining WASM parity and preventing logic duplication.

Does this code review approach work for Rust libraries targeting both Python and WASM?

Yes, this code review approach works for Rust libraries targeting both Python and WASM by validating WASM parity. It reviews Python binding code to prevent code duplication and potential drift, ensuring the structure mirrors the Rust core library across both platform implementations.

Can I use this code review to check type conversion in Rust Python bindings?

Yes, you can use this code review to check type conversion in Rust Python bindings. It analyzes the binding code to verify adherence to standard type conversion patterns, ensuring data is correctly passed between Python and the Rust core without leaking logic into the wrapper layer.

When should I not use Python bindings for Rust computations?

You should not use Python bindings for Rust computations when logic drift between implementations is a risk. If business logic or validation is implemented directly in Python bindings rather than the Rust core, code duplication occurs and WASM parity is broken across the project.