Skip to main content

Fortran-Python wrapper

Automatically generate wrappers to integrate Fortran and Python

This project consists of a few different components:

  • fgen
  • fgen_runtime
  • libfgen

Full documentation can be found at: fgen.readthedocs.io. We recommend reading the docs there because the internal documentation links don't render correctly on GitLab's viewer.

Installation

fgen can be installed with pip:

pip install fgen

Usage

TODO

libfgen

If you wish to use the fortran functionality in a downstream library, the fortran library must be compiled and linked against. A CMake module for finding or fetching the fgen library is available as part of this repository (from the repository root, see cmake/Findfgen.cmake). This module will try and find fgen according a few different methods:

  • cmake: Use a cmake config file (uses the cmake command find_package(fgen CONFIG))
  • subproject: Use a relative directory (relative to the CMake file) that points to a cloned fgen repository
  • fetch: Download the project from GitLab and build locally

The order that the methods tried can be set using the CMake define : FGEN_FIND_METHOD (default order: ["cmake" "subproject" "fetch"]). The Findfgen.cmake CMake module must be accessible from the target repository. The current recommendation is to copy Findfgen.cmake into the repository. This allows the target repository to pin the specific git hash of fgen to use.

The library can then be integrated into a CMake project by adding the snippet below:

if(
  NOT
  TARGET
  "fgen::fgen"
)
  # Find the fgen package, fetch it from gitlab if it isn't available locally
  find_package(
    "fgen"
    REQUIRED
  )
endif()

Some examples of using fgen are provided in tests/test-data.

For developers

For development, we rely on poetry for all our dependency management. To get started, you will need to make sure that poetry is installed (instructions here, we found that pipx and pip worked better to install on a Mac).

For all of work, we use our Makefile. You can read the instructions out and run the commands by hand if you wish, but we generally discourage this because it can be error prone. In order to create your environment, run make virtual-environment.

Once the virtual environment has been created, libfgen can be built using make build. This library contains the common Fortran code used by all wrappers and uses CMake to build and requires a working Fortran compiler.

If there are any issues, the messages from the Makefile should guide you through. If not, please raise an issue in the issue tracker.

For the rest of our developer docs, please see .

Release files for fgen 0.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fgen 0.6.1
File Size Uploaded
fgen-0.6.1.tar.gz 79.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fgen 0.6.1
File Interpreter ABI Platform
fgen-0.6.1-py3-none-any.whl Python 3 none any Details

Total release size: 216.0 kB

Release files / fgen-0.6.1.tar.gz

Download URL fgen-0.6.1.tar.gz
Size 79.7 kB
Tags Source
SHA-256 checksum
How to use checksums
79a3a94eb8dbb5479c3f51349b28b41d05194ddf8ac3f33977156e208a9d6fa9
BLAKE2b-256 checksum
How to use checksums
0dd2312d0a1777918a2de6911306ff604de06e7d3a7ffb56ee7f514c53dc37d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.10.15 Linux/5.15.154+

Release files / fgen-0.6.1-py3-none-any.whl

Download URL fgen-0.6.1-py3-none-any.whl
Size 136.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a4c52f828470b8c8e69e08897ee79817199dde23eb20c2489854881a19f1a2cb
BLAKE2b-256 checksum
How to use checksums
28c3281b8f6c2404e365a082d63ef076b8f2863a51844f8523374dbbdc763de4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.10.15 Linux/5.15.154+

Release history Release notifications | RSS feed

This release

0.6.1 This release

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page