fypp

raw JSON →
3.2 verified Fri May 01 auth: no python

Fypp is a Python-powered Fortran preprocessor. It is a tool for generating Fortran source code from template files using a Python-like macro language. The current version is 3.2, with moderate release cadence (major versions every few years).

pip install fypp
error fypp: error: argument -o/--output: expected one argument
cause Missing output filename after -o flag.
fix
Provide output file: fypp -o output.f90 input.fpp
error import fypp ModuleNotFoundError: No module named 'fypp'
cause fypp is installed but not importable as a regular Python module (it's a script).
fix
Use the command line: fypp --help
error fypp: error: unrecognized arguments: --file-var-root
cause Using --file-var-root with fypp < 3.2.
fix
Upgrade fypp: pip install --upgrade fypp
breaking Version 3.0 introduced backwards incompatibilities in macro syntax and variable handling. Upgrade requires reviewing templates.
fix Consult the changelog: https://github.com/aradi/fypp/releases/tag/3.0
deprecated The old macro call syntax (e.g., @:func()) is deprecated in favour of Fortran-friendly calls (e.g., @:func(...)).
fix Use parentheses for macro calls: @:macro(args)
gotcha The _FILE_ and _THIS_FILE_ variables are now relative to the file-var-root; may change output paths.
fix Use --file-var-root to control the root for relative paths.
gotcha fypp is not a Python library to import; it is a command-line preprocessor. Attempting to import fypp in Python code will not work as expected.
fix Run from command line: fypp -o output input

Quickstart: process a template file with fypp.

# fypp is used as a command-line tool, not typically imported.
# Example: run 'fypp -o output.f90 input.fpp'