Command-line interface#

Provided by fgen#

fgen#

Entrypoint for the command-line interface

fgen [OPTIONS] COMMAND [ARGS]...

Options

--no-logging-setup#

Run without setting up any logging.

You will almost never want this, it is mainly for testing purposes.

generate#

Autogenerate python and fortran code according to a collection of module definitions

We assume that each file in YAML_FILES describes a module which exposes a Fortran derived type that we wish to expose to Python. The collection of modules is considered to be a package.

This function writes 3 files for each module that is being wrapped:

  • manager - Lifecycle handling for derived types (in Fortran)

  • wrapper - Provides a fortran wrapper to the generated functions that can be made available to Python

  • python module - Python interface for creating, manipulating and interacting with the derived types.

This function may also write other files necessary for wrapping the package as a whole.

fgen generate [OPTIONS] [YAML_FILES]...

Options

-f, --force#

Overwrite any existing files

-e, --extension <extension>#

Required Name of the Python extension package.

Normally, this will be something <python_package_name>.<extension_module_name>, e.g. my_model._lib.

--wrapper-directory <wrapper_directory>#

Required Directory in which to write the Python-Fortran wrapper(s).

--python-directory <python_directory>#

Required Directory in which to write the python module(s).

--manager-directory <manager_directory>#

Directory in which to write the derived type lifecycle manager(s) (Fortran-based).

This defaults to the same directory as the yaml file(s) which define the derived type, which is generally where the Fortran code for the derived type is also located. If the YAML files come from more than one directory and this is not defined, an error is raised.

-ed, --enum-definition <enum_definition>#

Yaml-file that holds the definition of an enum.

As many of these as you like can be provided. Each needs to be behind its own option flag. For example,

fgen generate … –enum-definition enum-file-1.yaml -ed enum-file-2.yaml

--cmake-prefix <cmake_prefix>#

Prefix for CMakeLists.txt help text.

This prefix is applied to filenames when displaying the paths that will likely need to be added to your CMakeLists.txt file This can make it easier if you want to copy and paste the log messages later.

Arguments

YAML_FILES#

Optional argument(s)

Provided by fgen-runtime#

Provided by libfgen#