About PRIK¶
PRIK — Python Runtime Interop Kit — is an open-source project for exposing native libraries through natural Python APIs.
PRIK supports Fortran-to-Python and C-to-Python interoperability, with a
focus on native behavior that traditional wrapper generators often cannot
represent reliably. In both languages, editable .pyi contracts let you shape
the Python API. The C support guide describes
its current coverage. PRIK is for Python users who need native numerical,
scientific, or systems code without having to design and maintain the entire
language boundary themselves.
The broader goal is to offer the same clear workflow for more native languages without hiding the ownership, memory, and calling rules needed to keep that boundary correct.
Why PRIK exists¶
PRIK grew out of my work on Pyccel, where I was an original co-author and core developer from its inception. Pyccel translates Python to native languages including Fortran.
Pyccel initially used NumPy's f2py to expose generated Fortran code to Python. As its requirements grew, modern Fortran semantics became difficult to handle with the available wrapper tools. This led to a dedicated wrapper for the subset of Fortran generated by Pyccel.
That experience revealed a broader need. Existing Fortran libraries face many
of the same interoperability challenges, while hand-written ISO_C_BINDING
and Python interfaces require substantial boundary code.
PRIK was designed for this broader problem: to understand native APIs across languages and generate natural Python interfaces automatically.
Design principles¶
Understand the API before generating code¶
PRIK treats interoperability as a problem of meaning, not only code templates. It first represents native types, calls, object relationships, and runtime behavior. Binding code is generated only after the required decisions are complete.
Make ownership and lifetime explicit¶
Native objects can allocate, share, transfer, or destroy memory. PRIK models ownership, storage, mutation, destruction, pointer association, allocation, and results explicitly instead of hiding those decisions in generated code.
Let the Python API differ from the native API¶
A useful Python interface does not always match the native interface. PRIK's
semantic .pyi contracts let users inspect and shape the Python API while
retaining the information required to call the native code correctly.
Current scope and direction¶
PRIK is currently an alpha project for Fortran-to-Python and C-to-Python interoperability. Current work is expanding modern Fortran support, broadening C beyond its documented ABI subset, and strengthening compatibility across compilers, platforms, and architectures.
Longer term, PRIK is intended to support additional native languages and execution environments, including C++, CUDA, and other backends. These are future directions and are not part of the current release.
For the longer-term architecture and design direction, see the PRIK Vision.
Stewardship and development¶
PRIK is created and maintained by Said Hadjout (GitHub · Google Scholar), an original co-author and core developer of both Pyccel and Psydac.
Development makes extensive use of AI-assisted software-development tools, particularly OpenAI Codex, for implementation, refactoring, testing, debugging, documentation, investigation, and review assistance.
Citation¶
If you use PRIK in research, cite the release you used.
10.5281/zenodo.21881987 covers all
archived releases and links to their version-specific records. Machine-readable
metadata is available in
CITATION.cff.