Instead of an interpreter or JIT, Copapy builds a computation graph by tracing Python code and uses a copy-and-patch compiler to assemble machine code from precompiled templates, patched at compile time. The result is static native code with no GC, no syscalls, and no memory allocations at runtime. Once compiled, execution is fully predictable, and instruction counts and latency can be reasoned about ahead of execution. It also supports automatic differentiation, which is useful for control, optimization, and estimation workloads.
Copapy treats Python as a frontend, not a runtime. During tracing, standard Python code is executed, allowing to benefit from Python's expressiveness and tooling.
The copy-and-patch compiler makes porting to new architectures straightforward as long as a C compiler is available. x86_64 as well as 32- and 64-bit ARM are already supported. Copapy comes as small Python package with minimal dependencies, and does not require a cross-compilation toolchain since the package ships with precompiled stencils.
The current focus is on robotics, aerospace, embedded systems, and control systems in general.
This project is early but already usable and easy to try out. If anyone is interested in integrating Copapy into commercial hardware products, or adopting it for open source projects, I'd love to hear about real use cases and constraints.