What are some good examples to study of libraries out there that use F2py to wrap Fortran code and publish a Python package? Looking for:
- non-trivial Fortran library (i.e., not just a single 50 year old FORTRAN 77 file)
- automated publishing to PyPi and conda-forge for all platforms (e.g., from GitHub CI)
A library that I did when starting my PhD and needs a rework since I don’t like using CMake doesn’t have very complex Fortran code but it does CI and automated publishing:
Now I’m focusing on a more complex and OOP in the Fortran-side library and just recently started drafting a Python interface that could be used with f2py. Still not full CI/CD since it’s not the focus. To hide the Fortran objects I use a singleton object that gets redefined when needed, I took that idea from a post where @ivanpribec commented about that pattern which I didn’t knew before, and fits pretty well for my use case.
1 Like
PDFO is such a project. It wraps Powell’s F77 derivative-free optimization (DFO) solvers using f2py and publishes the package on PyPI using GitHub Actions.
PDFO will be replaced with PRIMA, which provides the reference implementation of Powell’s DFO solvers in modern Fortran (F2008 or above). It will be wrapped in Python using pybind11.
1 Like
Gaussjacobiquad demonstrates modern usage with ISOC compatible code and some internal derived types.
It doesn’t push to pypi yet but that’s easily arranged.
1 Like