🎉 MVP-READY • Phase 2 Complete (80%) • Zero Overhead Proven • 28 Tests Passing (100%)
Self-hosted Python/C-to-Rust transpiler with zero FFI overhead, zero unsafe code, and user-friendly error messages. Generate idiomatic, safe Rust from Python/C extensions.
Production-Ready Features:
- ✅ 11 Patterns: List & Dict operations (len, append, get, reverse, clear, pop, etc.)
- ✅ 0-6% Overhead: Identical performance to hand-written Rust (benchmarked)
- ✅ Safe Rust: Zero unsafe code, no FFI boundaries
- ✅ Real Names: Variable names preserved from source (
my_list.len()notx.len()) - ✅ Helpful Errors: Pattern suggestions and documentation links
- ✅ Validated: 8 real-world scenarios proven end-to-end
| Crate | Version | Description |
|---|---|---|
| spydecy | 0.2.0 | Main CLI application |
| spydecy-hir | 0.2.0 | Unified HIR (High-level IR) |
| spydecy-python | 0.2.0 | Python AST parser (PyO3) |
| spydecy-debugger | 0.2.0 | Introspective debugger |
# Install the latest release
cargo install spydecy
# Verify installation
spydecy --versionPrerequisites:
- Rust 1.75.0+
- Python 3.10-dev:
sudo apt-get install python3.10-dev - libclang-14-dev:
sudo apt-get install libclang-14-dev - PMAT:
cargo install pmat
# Clone repository
git clone https://github.com/noahgift/spydecy.git
cd spydecy
# Install all development tools
make install-tools
# Setup project
make setup
# Build
make build
# Run quality gates
make quality-gate# Compile Python + C to Rust (full pipeline)
spydecy compile --python my_file.py --c my_file.c --output my_file.rs --verbose
# Quick compile (non-verbose)
spydecy compile --python my_file.py --c my_file.c --output my_file.rs
# Visualize Python AST (NEW!)
spydecy debug --visualize example.py
# Visualize C AST with CPython API detection (NEW!)
spydecy debug --visualize example.c
# Show project info and status
spydecy info
# Get help
spydecy --helpProven on 8 realistic scenarios:
# E-commerce: Shopping cart
def add_to_cart(shopping_cart):
return append(shopping_cart)
# → shopping_cart.push(item) ✅ Actual variable name!
# Analytics: User history
def reverse_user_history(user_history):
return reverse(user_history)
# → user_history.reverse() ✅ Domain-specific naming preserved!
# Config: Settings lookup
def get_config_value(config_map):
return get(config_map)
# → config_map.get(&key) ✅ Idiomatic Rust!Target EXCEEDED: 0-6% overhead (target was <20%)
| Operation | Hand-Written | Spydecy | Difference |
|---|---|---|---|
| HashMap::get(1000) | 18.449 ns | 18.699 ns | +1.35% ✅ |
| Vec::clear(1000) | 118.90 ns | 118.72 ns | -0.15% ✅ |
| Vec::pop(1000) | 92.260 ns | 91.581 ns | -0.74% ✅ |
Result: Generated code performs identically to hand-written Rust!
User-friendly diagnostics with pattern suggestions:
❌ Cannot match Python function 'unknown' with C function 'unknown_c'
💡 Supported patterns:
1. len() + list_length() → Vec::len()
2. append() + PyList_Append() → Vec::push()
3. get() + PyDict_GetItem() → HashMap::get()
📖 For custom patterns, see: https://github.com/noahgift/spydecy
Real variable names flow from Python to Rust:
item_list→item_list.len()(not genericx.len())shopping_cart→shopping_cart.push(item)config_map→config_map.get(&key)- ✅ Shared maintenance with decy project
- ✅ Foundation for Phase 3 (ownership analysis)
Architecture: decy-parser → adapter → spydecy CAST → Unified HIR → Rust
Start Here: Response to Gemini AI Review ⭐
- Sprint 0: Tracer Bullet - 2-week validation sprint
- Incremental Debugger Roadmap - Build debugger alongside transpiler
- Decy Integration Plan - Phase 2 Complete ✅
- Pluggable C-API Architecture - Extensible C-API analysis
| Metric | Target | Current | Enforcement |
|---|---|---|---|
| Test Coverage | ≥80% | 99/99 ✅ | PMAT + CI |
| Mutation Score | ≥90% | TBD | cargo-mutants |
| Complexity | ≤10 CCN | ✅ | PMAT pre-commit |
| SATD Comments | 0 | 0 ✅ | PMAT (zero tolerance) |
| Clippy Warnings | 0 | CI/CD | |
| Unsafe Code | <5 per 1000 LOC | Static analysis |
# Fast quality check
make quality-fast
# Full quality gate (with coverage & mutation)
make quality-gate
# Pre-commit checks
make pre-commit
# Continuous improvement analysis
make kaizen# Run all tests
make test
# Property-based tests (1000 cases/property)
make test-property
# Mutation testing
make mutants
# Code coverage
make coverage# Auto-reload on changes
make dev
# Watch and run tests
make watchCurrent Version: v0.2.0 (Released 2025-10-22) Current Phase: Sprint 3 Complete ✅ - Planning Sprint 4
- ✅ Sprint 0: Tracer Bullet Validation - Core assumption proven:
len()unification works! - ✅ Sprint 2: Python Transpiler - Full Python AST parsing with PyO3 (36/36 tests)
- ✅ v0.1.0 Release: Published to crates.io with initial foundation
- ✅ Sprint 3: C Transpiler Foundation (51/51 tests)
- C parser complete using clang-sys
- CPython API pattern recognition working
- CORE INNOVATION PROVEN: Python + C → Rust unification end-to-end!
- ✅ v0.2.0 Release: Unification Milestone 🎉
- Python
len(x)+ Clist_length()→ RustVec::len()working - Complete pipeline validated with production parsers
- Boundary elimination demonstrated
- Python
- Sprint 4: Cross-Layer Optimization (Est. 2-4 weeks)
- Add more unification patterns (append, dict.get)
- Implement C debugger visualization
- Begin optimizer implementation
- Performance benchmarking
- v0.3.0 (Est. 4-6 weeks): Expanded patterns + optimizer
- v0.4.0 (Est. 8-10 weeks): Full code generation pipeline
- v1.0.0 (Est. 12-16 weeks): Production ready - Self-hosting capability
See CHANGELOG.md for detailed release notes.
Python Source → Python HIR ─┐
├─→ Unified HIR → Optimizer → Rust
C Source → C HIR ───────────┘
- Unified Python/C Transpilation - Leverages CPython's C implementation
- Introspective Debugging - Step through transpilation process
- Pluggable C-API - CPython, NumPy, SciPy, community plugins
- Self-Hosting - Compiler transpiles itself for validation
make help # Show all available targets
make install-tools # Install all dev tools (PMAT, etc.)
make quality-gate # Run full quality gate suite
make kaizen # Continuous improvement analysis
make ci # Full CI pipeline- RED: Write failing tests first
- GREEN: Minimal implementation
- REFACTOR: Meet quality gates (≤10 CCN, 0 SATD, 80%+ coverage)
- ✅ All tests pass
- ✅ Coverage ≥80%
- ✅ Mutation score ≥90%
- ✅ Complexity ≤10 CCN
- ✅ Zero SATD comments (TODO/FIXME/HACK)
- ✅ Zero Clippy warnings
- ✅ Code formatted with rustfmt
Pre-commit hooks automatically enforce quality gates:
- Code formatting
- Clippy lints
- PMAT complexity & SATD checks
- Fast test suite
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.
Spydecy is part of a family of transpiler projects:
- decy: C-to-Rust transpiler with ownership inference
- ✅ Already integrated: decy uses spydecy-debugger for C AST visualization
- 🔄 Integration planned: See DECY-INTEGRATION-PLAN.md
- Opportunity: Use decy's advanced C parser and ownership analysis in Spydecy
Inspired by:
- depyler: Python-to-Rust transpiler
- decy: C-to-Rust transpiler with extreme quality
- bashrs: Formal verification and property testing
- ruchy: Self-hosting and PMAT integration
- Toyota Production System: Jidoka, Kaizen, Genchi Genbutsu
Built with EXTREME quality standards. Zero compromises. 🚀
Status: v0.2.0 Released to crates.io ✅ Achievement: 🎉 Core Innovation Proven End-to-End Current: Sprint 3 Complete - Planning Sprint 4 Next: v0.3.0 - Expanded patterns + optimizer
📦 Install now: cargo install spydecy
📖 Documentation: CHANGELOG.md
🔗 Crates.io: https://crates.io/crates/spydecy