fckitlib: Fortran-Python Bridging Library

0.14.2.19 · active · verified Thu Apr 16

fckitlib is a Python library designed to build Python modules on top of existing Fortran codebases. It provides utilities for seamless argument passing, handling Fortran derived types and allocatable arrays, and logging within Fortran components. It is primarily used in scientific computing, particularly with models developed by ECMWF. The current version is 0.14.2.19, with active development and frequent releases (multiple per year), typically supporting Python 3.7+.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates initializing `fckitlib`'s pure Python-side logger. It also includes a conceptual example of loading the `fclib` Fortran example module, which requires `fckitlib` to be built with Fortran support and correctly installed, allowing Python to interface with compiled Fortran functions and types.

from fckit.log import Logger

# Initialize a pure Python-side logger provided by fckitlib
# In a full Fortran-interfaced application, this logger could
# be configured to be accessible from the Fortran side as well.
logger = Logger("my_fckit_app")
logger.info("fckitlib Logger initialized successfully!")
logger.warning("This is a Python-side log message.")

# Example of attempting to load the fckitlib Fortran example module
# This part is conceptual; actual Fortran interaction requires fckitlib
# to be built with Fortran support and correctly linked.
try:
    from fckit import fclib
    print(f"\nfckitlib fclib module loaded. Fortran version: {fclib.version_str()}")
    # Further interaction with Fortran functions/types from fclib would go here
except ImportError:
    print("\nWarning: fckit.fclib module not found. It might not be built or installed correctly with Fortran support.")
except Exception as e:
    print(f"\nError loading fckit.fclib: {e}")

view raw JSON →