skillfed

fparser

Python implementation of a Fortran parser

fparser v0.2.4 115.7K downloads/30d#12,237 on PyPI
Permissive license BSD-3-Clause Active released

What it is and what it does

fparser is a pure-Python Fortran parser that converts Fortran source code into an abstract syntax tree for programmatic inspection and transformation. It evolved from the parser originally built for the F2PY project and now supports Fortran standards from 77 through 2008, including modern extensions like OpenMP sentinels and F2008 intrinsic functions.

The parser is designed for developers and researchers who need to analyze, transform, or generate Fortran code programmatically. It has no external runtime dependencies, making it lightweight to integrate into build pipelines, code analysis tools, or scientific computing workflows. Recent releases have focused on correctness—fixing edge cases in string handling, loop constructs, and directive processing—and expanding F2008 support.

Use it for:

  • Analyze Fortran codebases to extract structure, dependencies, or metrics for documentation or refactoring.
  • Build code generation or transformation tools that read Fortran and emit modified or translated code.
  • Integrate Fortran parsing into scientific computing pipelines that need to inspect or validate legacy code.
  • Develop IDE or editor plugins that require Fortran syntax understanding for highlighting or navigation.
  • Automate migration or modernization of Fortran code by parsing and rewriting specific constructs.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

fparser parses Fortran source code (Fortran 77 through 2008) into an abstract syntax tree, enabling programmatic analysis and manipulation of Fortran programs.

Yes, if you need to parse or analyze Fortran code programmatically. The package is actively maintained, has no external dependencies, and supports modern Fortran standards. Beta status and the lack of a stable API guarantee mean you should pin the version in production code, but the frequent releases and recent bug fixes suggest a maturing project.

Install

fparser on PyPI

pip

pip install fparser

uv

uv add fparser

poetry

poetry add fparser

Installing fparser

Before you install

Low install friction with no runtime dependencies. Actively maintained with frequent releases; version 0.2.4 was released 49 days ago with bug fixes and F2008 support improvements.

License in practice

BSD-3-Clause permissive license allows use in most projects without significant restrictions.

Quickstart

pip install fparser

from fparser.two import parse_file
tree = parse_file('example.f')

Requires Python 3.6 or later.

Verify before relying

  • Whether the parser handles all Fortran dialects equally well or has known limitations with specific extensions.
  • Performance characteristics on large codebases or deeply nested structures.
  • API stability guarantees given the beta development status.

Package facts

License BSD-3-Clause (permissive)
Python support supports the current Python release (>=3.6)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 49 days since the last release
First released
Downloads 115,731/month — #12,237 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: fparser-0.2.4-py3-none-any.whl

Keywords: fortran, parser

Development Status :: 4 - BetaEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: Science/ResearchNatural Language :: EnglishOperating System :: MacOSOperating System :: POSIXOperating System :: UnixProgramming Language :: FortranProgramming Language :: PythonTopic :: Scientific/EngineeringTopic :: Software DevelopmentTopic :: Utilities

Tags

fortran parser pythonparse fortran codefortran syntax treefortran astfortran source analysisfortran code parsingfortran language parser
fortranparsercode-analysis

More Software Development packages