FORTRAN SOFTWARE CATALOG

Repository owner: Elias Rabel (ylikx)

forpy

Embed Python in Fortran and exchange arrays with NumPy.

Repository · Pinned source (b4fc550c7282) · Try in playground · Checked package example

GAMS classifications

About this package

Category
Interoperability
License
LGPL-3.0-or-later

Topics: arrays, c-bindings, fortran, fortran-library, fortran2003, interoperability, language-bindings, numpy, python

Classification scope and review notes

The existing generated upstream forpy_mod.F90 source is wrapped for FPM without running Fypp or changing the library. It embeds the sandbox Python 3.12 runtime using the linker flags advertised by python3-config --embed --ldflags, with an explicit runtime library search path. The consumer copies a 2-by-3 Fortran real64 array to NumPy, calls numpy.sum and numpy.linalg.norm, verifies both returned scalars independently in Fortran and checks finite values and every API status. Python references are destroyed before finalization. Other Python versions, no-copy array lifetimes, callbacks, Python extension modules and plotting are not validated. Exported projects need Python and NumPy and linker flags appropriate to the local Python installation.

Package dependencies

Resolved GitHub repositories used by the verified playground build, combining direct and indirect dependencies. This list does not describe internal module dependencies or native system libraries.

Required by this build

No additional GitHub package dependencies were recorded for this verified build.

Build record verified 2026-10-29.

Used by (0 selected packages)

No other selected build records this repository as a dependency. This is not a measure of usage outside the catalog.

Reviewed procedures

These mappings have pinned source evidence. A checked package example may exercise only some of them; source review is not a numerical benchmark.

forpy_initialize / ndarray_create / import_py / call_py / cast / forpy_finalize

Module: forpy_mod

S

S: source-supported

Derivatives / callbacks: not applicable

The existing generated upstream forpy_mod.F90 source is wrapped for FPM without running Fypp or changing the library. It embeds the sandbox Python 3.12 runtime using the linker flags advertised by python3-config --embed --ldflags, with an explicit runtime library search path. The consumer copies a 2-by-3 Fortran real64 array to NumPy, calls numpy.sum and numpy.linalg.norm, verifies both returned scalars independently in Fortran and checks finite values and every API status. Python references are destroyed before finalization. Other Python versions, no-copy array lifetimes, callbacks, Python extension modules and plotting are not validated. Exported projects need Python and NumPy and linker flags appropriate to the local Python installation.

Pinned source: forpy_mod.F90

Author examples/tests: README.md