--- id: fypp version: "3.2" license: BSD license_treatment: permissive maintenance: active --- # fypp — Python powered Fortran preprocessor License: permissive · Maintenance: active · Downloads: 97.2K/mo ## What it is and what it does Fypp is a command-line preprocessor and Python module that extends Fortran with metaprogramming capabilities by interpreting Python expressions embedded in preprocessor directives. It reads Fortran source files annotated with special directives (like #:if, #:for, #:def), evaluates Python logic to conditionally include code or generate templates, and outputs the processed Fortran. The tool integrates into build toolchains as a preprocessing step before compilation. Instead of inventing its own expression syntax, Fypp leverages Python's full expression language for metaprogramming tasks—defining variables, writing macros, iterating over types to generate overloaded procedures, and inserting dynamic content like timestamps. It handles multiline strings, file inclusion, line numbering directives for debugging, and automatic line folding, making it suitable for large Fortran projects that need code reuse and conditional compilation without leaving the Fortran ecosystem. Use it for: - Generate type-specific Fortran procedure overloads (e.g., real, complex variants) from a single template definition. - Conditionally include MPI, OpenMP, or serial code paths based on preprocessor variables set at build time. - Insert build metadata (timestamps, version strings) or debug assertions into Fortran source during preprocessing. - Define reusable Fortran macros for common patterns (error checking, array bounds validation) to reduce code duplication. - Automate boilerplate Fortran code generation for numerical libraries with multiple precision or dimension variants. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Fypp is a Python-powered preprocessor for Fortran that adds conditional compilation, template metaprogramming, and macro support to Fortran source files using Python expressions in preprocessor directives. Yes. Fypp is actively maintained, has no runtime dependencies, installs easily, carries a permissive BSD license, and solves a real problem for Fortran developers needing template metaprogramming and conditional compilation. It is production-stable and suitable for integration into scientific computing and numerical library build pipelines. ## Install pip install fypp uv add fypp poetry add fypp ## Installing fypp Before you install: Low install friction with no runtime dependencies. Actively maintained as of 2026-03-03 with stable production status. License in practice: BSD permissive license allows commercial and private use with minimal restrictions; suitable for most projects. Quickstart: pip install fypp fypp source.fpp source.f90 # Or import the module in Python: from fypp import fypp fypp.main() Requires Python 3.5 or above; designed for Fortran development workflows. Verify before relying: - Whether the package works with Python versions beyond 3.9 (classifiers list up to 3.9 only). - Current test coverage and CI/CD status to assess stability beyond the active maintenance signal. ## Package facts - License: BSD (permissive) - Python support: unspecified - Install friction: low - Maintenance: active - Downloads: 97.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags fortran preprocessor, fortran metaprogramming, fortran template generation, conditional fortran compilation, fortran macro system, code generation fortran, fypp preprocessor, fortran, code-generation, build-tool [View on SkillFed](https://skillfed.io/packages/fypp) · [View on PyPI](https://pypi.org/project/fypp/)