Description
fprettify is an auto-formatter for modern Fortran source code, written in Python. It applies strict whitespace formatting: it auto-indents code, aligns continuation lines with the previous opening delimiter or assignment operator, keeps a consistent amount of whitespace around operators and delimiters, and removes extra whitespace and consecutive blank lines. It can also change the letter case of intrinsic functions to upper or lower case. By default it changes only whitespace, so the revision history stays clean. It handles cpp and fypp preprocessor directives and is tested for editor integration. It works on modern Fortran, from Fortran 90 upward, and it needs Python 3. The optional ConfigArgParse package lets it read a config file. You can format one or more files in place, use --indent to change the default indent of 3, or use -r to format an entire project recursively. The latest release installs with pip, and it is also on the conda-forge channel for Conda users. The examples folder has before and after files that show what it changes.…
Highlights
- Strict whitespace formatting for Fortran
- Auto-indentation and aligned continuation lines
- Upper or lower case for intrinsics
- Whitespace-only changes by default
- Handles cpp and fypp directives
- Installs with pip or conda-forge
Ratings & Reviews
No ratings yet
Be the first to rate Fprettify.
People also visit
Fprettify FAQ
What is fprettify?
An auto-formatter for modern Fortran code, written in Python.
Which Fortran versions does it handle?
Modern Fortran, from Fortran 90 upward. Missing features can be requested through an issue.
How do I install it?
The latest release installs with pip. Conda users can get it from the conda-forge channel.
How do I format a whole project?
Use the -r option to apply fprettify recursively to a Fortran project instead of a single file.
Does it change my code's behaviour?
By default it makes whitespace changes only, which keeps the revision history readable.
What are the best Fprettify alternatives?
Popular alternatives to Fprettify include Prettier, webfortran and Fortran Package Manager. See all Fprettify alternatives













