Automatically generate wrapper to integrate Fortran and Python
Project description
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. TODO: Create docs
Installation
Fortran-Python wrapper can be installed with conda or pip:
pip install fgen
conda install -c conda-forge 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file fgen-0.3.2.tar.gz
.
File metadata
- Download URL: fgen-0.3.2.tar.gz
- Upload date:
- Size: 29.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.15 Linux/5.15.154+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75d46d941d0369c53f9157b76ab9c5a8fe0c221401a0d8cad33cf2c279399e16 |
|
MD5 | 11909ecd4dfc290731dba296fcde79b1 |
|
BLAKE2b-256 | 08a1019a95e32aba412f88d350a3ce80536ced13d937d315deaf50efe7a1316e |
File details
Details for the file fgen-0.3.2-py3-none-any.whl
.
File metadata
- Download URL: fgen-0.3.2-py3-none-any.whl
- Upload date:
- Size: 35.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.15 Linux/5.15.154+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7d8ddd2afd9f4537314dd22f9a8059df3dadf19d03ac1350a05fe5636076adf |
|
MD5 | ed67ac797fac31325a97bca2bea48be5 |
|
BLAKE2b-256 | 3fedf0143f6c111c946dc9166da0af9973c77d603f1ae6c67a00ba5336b03ef0 |