fparser
Python implementation of a Fortran parser
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 fparseruv
uv add fparserpoetry
poetry add fparserInstalling 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
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
f90nmlf90nml reads, writes, and modifies Fortran…
permissive · top 15,000 on PyPI
pglastParses PostgreSQL SQL statements into an…
copyleft · top 5,000 on PyPI
fyppFypp is a Python-powered preprocessor for…
permissive · top 15,000 on PyPI
tree-sitter-fortranProvides a Fortran language grammar for…
permissive · top 5,000 on PyPI
luaparserParses Lua source code into an abstract syntax…
permissive · top 15,000 on PyPI
cftimeConverts between calendar dates and numeric…
permissive · top 5,000 on PyPI
parseParse strings using format-string-like patterns…
permissive · top 5,000 on PyPI
netCDF4netcdf4 provides a Python interface to read,…
permissive · top 5,000 on PyPI
deepfaceDeepFace performs face recognition,…
permissive · top 15,000 on PyPI
typed-astProvides Python 2.7 and Python 3 AST parsers…
permissive · top 5,000 on PyPI