# Wrapping Fortran libraries for Python with PRIK. Suggestions?

**URL:** <https://fortran-lang.discourse.group/t/wrapping-fortran-libraries-for-python-with-prik-suggestions/11135>\
**Category:** Uncategorized\
**Created:** [September 28, 2026, 2:48pm UTC](https://fortran-lang.discourse.group/t/wrapping-fortran-libraries-for-python-with-prik-suggestions/11135 "2026-09-28T14:48:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Said-H](https://avatars.discourse-cdn.com/v4/letter/s/51bf81/32.png) [@Said-H](https://fortran-lang.discourse.group/u/Said-H)\
**Post date:** [September 28, 2026, 2:48pm UTC](https://fortran-lang.discourse.group/t/wrapping-fortran-libraries-for-python-with-prik-suggestions/11135/1 "2026-09-28T14:48:28Z")

</div>

Hi everyone,

I’m the author of [PRIK](https://github.com/PyNumLab/prik). I have recently wrapped two large Fortran projects with PRIK.

**PRIMA** (Zaikun Zhang’s modern Fortran implementation of Powell’s derivative-free solvers). All five solvers (COBYLA, UOBYQA, NEWUOA, BOBYQA, LINCOA) are generated directly from the Fortran sources.The tests check each solver against a known minimum and compare COBYLA with SciPy’s.  
Guide: [PRIMA Wrapper - PRIK — Bring Native Code to Python](https://pynumlab.github.io/prik/user/examples/fortran/prima-wrapper/)

**Open MPI**. PRIK generates a Python extension from Open MPI’s Fortran `mpi_f08` sources. With an edited `.pyi` contract and a short Python module on top, an mpi4py-style program (send/recv, broadcast, reduce, allreduce) runs unchanged apart from its import and produces the same output. In our measurements, small Allreduce calls were on average about 16 % faster than mpi4py (28 % when calling the generated API directly). It covers one datatype for now.  
Tutorial: [Wrap Open MPI mpi\_f08 - PRIK — Bring Native Code to Python](https://pynumlab.github.io/prik/user/tutorials/openmpi-f08/)

Besides the two I just described ( **PRIMA** and **Open MPI** ), PRIK already has maintained, numerically validated wrappers for:

Fortran: **BLAS** , **LAPACK** , **FFTPACK** , **MINPACK** , **BSPLINE-FORTRAN** , **PRIMA** , and **Open MPI** mpi\_f08

C: **libm** and **TA-Lib**

Do you have any suggestions for other important Fortran libraries that would be worth wrapping for Python?

Documentation: [PRIK — Bring Native Code to Python](https://pynumlab.github.io/prik/)  
GitHub: [GitHub - PyNumLab/prik: Bring Native Code to Python with editable .pyi contracts · GitHub](https://github.com/PyNumLab/prik)

---

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [September 28, 2026, 5:05pm UTC](https://fortran-lang.discourse.group/t/wrapping-fortran-libraries-for-python-with-prik-suggestions/11135/2 "2026-09-28T17:05:29Z")

</div>

I have used ChatGPT to [translate 566 R packages to Fortran packages](https://github.com/Beliavsky/Fortran-from-R-packages). Eventually I want to have Python, Octave/Matlab, and R interfaces for all the translations. You could try PRIK on them. I use Windows on which PRIK does not yet run.

---

<div class="post-metadata">

**Author:** ![Said-H](https://avatars.discourse-cdn.com/v4/letter/s/51bf81/32.png) [@Said-H](https://fortran-lang.discourse.group/u/Said-H)\
**Post date:** [September 29, 2026, 11:10am UTC](https://fortran-lang.discourse.group/t/wrapping-fortran-libraries-for-python-with-prik-suggestions/11135/3 "2026-09-29T11:10:48Z")

</div>

Do you have a top 10 list of those packages? I’ll focus on those first, and then maybe, with the help of AI, we could try to wrap all of them.

---

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [September 29, 2026, 11:24am UTC](https://fortran-lang.discourse.group/t/wrapping-fortran-libraries-for-python-with-prik-suggestions/11135/4 "2026-09-29T11:24:16Z")

</div>

ChatGPT [says](https://chatgpt.com/share/6abb9f6c-b59c-83ea-b5ce-1a4414500a14) the 50 most popular of the translated packages, based on downloads of the originals, are as follows. You could start with them, although the first 3 are specific to R programming (part of the tidyverse), so providing Python interfaces to Fortran translations of them may not be useful.

| Rank | R package |
| --- | --- |
| 1 | dplyr |
| 2 | purrr |
| 3 | stringr |
| 4 | igraph |
| 5 | Matrix |
| 6 | lme4 |
| 7 | survival |
| 8 | mgcv |
| 9 | MASS |
| 10 | abind |
| 11 | numDeriv |
| 12 | glmnet |
| 13 | cluster |
| 14 | boot |
| 15 | rpart |
| 16 | nnet |
| 17 | car |
| 18 | e1071 |
| 19 | psych |
| 20 | forecast |
| 21 | Hmisc |
| 22 | mice |
| 23 | sandwich |
| 24 | multcomp |
| 25 | lavaan |
| 26 | ranger |
| 27 | lmtest |
| 28 | mclust |
| 29 | ape |
| 30 | quantreg |
| 31 | survey |
| 32 | fields |
| 33 | fitdistrplus |
| 34 | geepack |
| 35 | robustbase |
| 36 | deSolve |
| 37 | classInt |
| 38 | spdep |
| 39 | coda |
| 40 | tseries |
| 41 | FNN |
| 42 | dbscan |
| 43 | fastcluster |
| 44 | truncnorm |
| 45 | copula |
| 46 | urca |
| 47 | pracma |
| 48 | cubature |
| 49 | DEoptim |
| 50 | expm |

---

<div class="post-metadata">

**Author:** ![rachelwilson](https://avatars.discourse-cdn.com/v4/letter/r/8edcca/32.png) [@rachelwilson](https://fortran-lang.discourse.group/u/rachelwilson)\
**Post date:** [October 9, 2026, 12:00am UTC](https://fortran-lang.discourse.group/t/wrapping-fortran-libraries-for-python-with-prik-suggestions/11135/5 "2026-10-09T00:00:29Z")

</div>

quadpack would be a great one, adaptive quadrature is something people reach for constantly and the fortran implementation is still the gold standard. odepack too, lsoda especially, having a solid stiff/non-stiff solver via python would get a lot of use. arpack for large sparse eigenvalue problems would round it out nicely.
