Orchestration framework for converting ANY project (Python, C/C++, Shell) to modern, first-principles Rust
Batuta enforces rigorous quality standards:
- β 529 total tests (487 unit + 36 integration + 6 benchmarks)
- π Coverage target: 90% minimum, 95% preferred - approaching target
- β Core modules: 90-100% coverage (all converters, plugin, parf, backend, tools, types, report) - TARGET MET
- β Mutation testing validates test quality (100% on converters)
- β Zero defects tolerance via Certeza validation
- β Performance benchmarks (sub-nanosecond backend selection)
- β Security audits (0 vulnerabilities)
Coverage Breakdown:
- Config module: 100% coverage
- Analyzer module: 82.76% coverage
- Types module: ~95% coverage
- Report module: ~95% coverage
- Backend module: ~95% coverage
- Tools module: ~95% coverage
- ML Converters (NumPy, sklearn, PyTorch): ~90-95% coverage
- Plugin architecture: ~90% coverage
- PARF analyzer: ~90% coverage
- CLI (main.rs): 0% unit (covered by 36 integration tests)
Quality Validation:
# Run certeza quality checks before committing
cd ../certeza && cargo run -- check ../BatutaSee IMPLEMENTATION.md for full quality metrics and improvement plans.
Batuta orchestrates 9 Pragmatic AI Labs transpiler and foundation library tools to enable semantic-preserving conversion of legacy codebases to high-performance Rust, complete with GPU acceleration, SIMD optimization, and ML inference capabilities.
# Install Batuta
cargo install batuta
# Analyze your project
batuta analyze --languages --dependencies --tdg
# Convert to Rust (coming soon)
batuta transpile --incremental --cache
# Optimize with GPU/SIMD (coming soon)
batuta optimize --enable-gpu --profile aggressive
# Validate equivalence (coming soon)
batuta validate --trace-syscalls --benchmark
# Build final binary (coming soon)
batuta build --releaseRead The Batuta Book - Comprehensive guide covering:
- Philosophy and core principles (Toyota Way applied to code migration)
- The 5-phase workflow (Analysis β Transpilation β Optimization β Validation β Deployment)
- Tool ecosystem deep-dives (all 9 Pragmatic AI Labs tools)
- Practical examples and case studies
- Configuration reference and best practices
Batuta is named after the conductor's baton β it orchestrates multiple specialized tools to convert legacy code to Rust while maintaining semantic equivalence. Unlike simple transpilers, Batuta:
- Preserves semantics through IR-based analysis and validation
- Optimizes automatically with SIMD/GPU acceleration via Trueno
- Provides gradual migration through Ruchy scripting language
- Applies Toyota Way principles (Muda, Jidoka, Kaizen) for quality
Batuta orchestrates 9 core components from Pragmatic AI Labs:
- Decy - C/C++ β Rust with ownership inference
- Depyler - Python β Rust with type inference
- Bashrs - Shell scripts β Rust CLI
- Trueno - Multi-target compute (CPU SIMD, GPU, WASM)
- Aprender - First-principles ML in Rust
- Realizar - ML inference runtime
- Ruchy - Rust-oriented scripting for gradual migration
- PMAT - Quality analysis & roadmap generation
- Renacer - Syscall tracing for validation
Analyze your project to understand languages, dependencies, and code quality.
# Full analysis
batuta analyze --languages --dependencies --tdg
# Just detect languages
batuta analyze --languages
# Calculate TDG score only
batuta analyze --tdgOutput includes:
- Language breakdown with line counts and percentages
- Primary language detection
- Transpiler recommendations
- Dependency manager detection (pip, Cargo, npm, etc.)
- Package counts per dependency file
- TDG quality score (0-100) with letter grade
- ML framework detection
- Next steps guidance
Initialize a Batuta project and set up conversion configuration.
batuta init --source ./my-python-app --output ./my-rust-appConvert source code to Rust with incremental compilation and caching.
# Basic transpilation
batuta transpile
# Incremental mode with caching
batuta transpile --incremental --cache
# Specific modules only
batuta transpile --modules auth,api,db
# Generate Ruchy for gradual migration
batuta transpile --ruchy --replApply performance optimizations with GPU/SIMD acceleration.
# Balanced optimization (default)
batuta optimize
# Aggressive optimization
batuta optimize --profile aggressive --enable-gpu
# Custom GPU threshold
batuta optimize --enable-gpu --gpu-threshold 1000Optimization profiles:
fast- Quick compilation, basic optimizationsbalanced- Default, good compilation/performance trade-offaggressive- Maximum performance, slower compilation
Verify semantic equivalence between original and transpiled code.
# Full validation suite
batuta validate --trace-syscalls --diff-output --run-original-tests --benchmark
# Quick syscall validation
batuta validate --trace-syscallsBuild optimized Rust binaries with cross-compilation support.
# Release build
batuta build --release
# Cross-compile
batuta build --target x86_64-unknown-linux-musl
# WebAssembly
batuta build --wasmGenerate comprehensive migration reports.
# HTML report (default)
batuta report
# Markdown for documentation
batuta report --format markdown --output MIGRATION.md
# JSON for CI/CD
batuta report --format json --output report.jsonBatuta implements a 5-phase Kanban workflow based on Toyota Way principles:
- Detect project languages and structure
- Calculate technical debt grade (TDG)
- Identify dependencies and frameworks
- Recommend transpilation strategy
- Convert code to Rust/Ruchy using appropriate transpiler
- Preserve semantics through IR analysis
- Generate human-readable output
- Support incremental compilation
- Apply SIMD vectorization (via Trueno)
- Enable GPU acceleration for compute-heavy code
- Optimize memory layout
- Select backends via Mixture-of-Experts routing
- Trace syscalls to verify equivalence (via Renacer)
- Run original test suite
- Compare outputs and performance
- Generate diff reports
- Build optimized binaries
- Cross-compile for target platforms
- Package for distribution
- Generate migration documentation
Batuta applies Lean Manufacturing principles to code migration:
- StaticFixer integration - Eliminate duplicate static analysis (~40% reduction)
- PMAT adaptive analysis - Focus on critical code, skip boilerplate
- Decy diagnostics - Clear, actionable error messages reduce confusion
- Ruchy strictness levels - Gradual quality at migration boundaries
- Pipeline validation - Quality checks at each phase
- Semantic equivalence - Automated verification via syscall tracing
- MoE optimization - Continuous performance tuning
- Incremental features - Deliver value progressively
- Feedback loops - Learn from each migration
- Batuta orchestrator - Balanced load across transpilers
- Parallel processing - Efficient resource utilization
- 5-phase tracking - Clear stage visibility
- Dependency management - Automatic task ordering
- Renacer integration - Runtime behavior analysis
- TDG scoring - Quality visibility
# 1. Analyze the project
$ batuta analyze --languages --dependencies --tdg
π Analysis Results
==================================================
Primary language: Python
Total files: 127
Total lines: 8,432
Dependencies:
β’ pip (42 packages)
File: "./requirements.txt"
β’ βΉ ML frameworks detected - consider Aprender/Realizar for ML code
Quality Score:
β’ TDG Score: 73.2/100 (B)
Recommended transpiler: Depyler (Python β Rust)
# 2. Transpile to Rust (coming soon)
$ batuta transpile --incremental
π Transpiling with Depyler...
β Converted 127 files (3,891 warnings, 42 errors addressed)
β NumPy β Trueno: 23 operations
β sklearn β Aprender: 5 models
β PyTorch β Realizar: 2 inference pipelines
# 3. Optimize (coming soon)
$ batuta optimize --enable-gpu --profile aggressive
β‘ Optimizing...
β SIMD vectorization: 234 loops optimized
β GPU dispatch: 12 operations (threshold: 500 elements)
β Memory layout: 18 structs optimized
# 4. Validate (coming soon)
$ batuta validate --trace-syscalls --benchmark
β
Validation passed!
β Syscall equivalence: 100%
β Output identical: β
β Performance: 4.2x faster, 62% less memoryCurrent Version: 0.1.0 (Alpha)
-
β Phase 1: Analysis - Complete
- β Language detection
- β Dependency analysis
- β TDG scoring
- β Transpiler recommendations
-
π§ Phase 2: Core Orchestration - In Progress
- β³ CLI scaffolding (complete)
- β³ Transpilation engine
- β³ 5-phase workflow
- β³ PMAT integration
-
π Phase 3: Advanced Pipelines - Planned
- π NumPy β Trueno
- π sklearn β Aprender
- π PyTorch β Realizar
-
π Phase 4: Enterprise Features - Future
- π Renacer tracing
- π PARF reference finder
See roadmap.yaml for complete ticket breakdown (12 tickets, 572 hours).
- Specification - Complete technical specification
- Roadmap - PMAT-tracked development roadmap
- PMAT Bug Report - Known issues with PMAT workflow
Batuta is part of the Pragmatic AI Labs ecosystem. Contributions are welcome!
# Clone and build
git clone https://github.com/paiml/Batuta.git
cd Batuta
cargo build --release
# Run tests
cargo test
# Install locally
cargo install --path .MIT License - see LICENSE for details.
- Decy - C/C++ to Rust transpiler
- Depyler - Python to Rust transpiler
- Trueno - Multi-target compute library
- PMAT - Quality analysis toolkit
Batuta applies principles from:
- Toyota Production System - Muda, Jidoka, Kaizen, Heijunka, Kanban, Andon
- Lean Software Development - Value stream optimization
- First Principles Thinking - Rebuild from fundamental truths
Batuta - Because every great orchestra needs a conductor. π΅