Skip to main content

A fast, configurable Fortran formatter with Fypp, Doxygen, and OpenACC/OpenMP support

Project description

ffmt

PyPI CI License: MIT GitHub Marketplace Docs

A fast, configurable Fortran formatter with support for Fypp, Doxygen, and OpenACC/OpenMP directives. Written in Rust. Installable via pip.

Documentation | Configuration | Changelog

Installation

pip install ffmt

Or via Cargo:

cargo install ffmt

Quick start

ffmt src/                        # format in-place
ffmt --check src/                # CI mode (exit 1 if changes needed)
ffmt --diff src/                 # show colored diff
ffmt -j 8 src/                   # parallel
cat file.fpp | ffmt -            # stdin/stdout

Features

  • Code -- indentation, whitespace normalization, keyword casing, named ends, line wrapping, operator modernization (.eq. -> ==), double-colon enforcement, trailing semicolon removal
  • Comments -- rewrapping, inline spacing (S102), !< alignment, !&/& ! cleanup, format suppression (! ffmt off/on)
  • Structure -- blank line management around openers/closers/#ifdef, declaration :: alignment, declaration/use compaction
  • Preprocessor -- Fypp (#:if, $:, @:), C preprocessor (#ifdef), OpenACC (!$acc), OpenMP (!$omp)
  • Opt-in -- multi-statement splitting, assignment alignment, & column alignment, use-statement reformatting

Most options accept true, false, or "preserve". See the configuration reference for all options.

Configuration

Create ffmt.toml or add [tool.ffmt] to pyproject.toml:

indent-width = 4
line-length = 132
keyword-case = "lower"
modernize-operators = true
enforce-double-colon = true

[whitespace]
relational = true
multdiv = false

CI

# GitHub Actions
- uses: sbryngelson/ffmt@latest
  with:
    args: "--check src/"
# pre-commit
repos:
  - repo: https://github.com/sbryngelson/ffmt
    rev: v0.3.0
    hooks:
      - id: ffmt

Other Fortran formatters

Formatter Language Status Notes
fprettify Python Unmaintained Free-form only. Fypp support.
findent C Active Indentation and fixed/free conversion.
Codee Formatter Proprietary Active Commercial. Tree-sitter based.
LFortran fmt Rust In development AST-based.
Fortitude Rust Active Linter with auto-fix.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ffmt-0.3.1.tar.gz (79.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ffmt-0.3.1-py3-none-win_amd64.whl (1.5 MB view details)

Uploaded Python 3Windows x86-64

ffmt-0.3.1-py3-none-manylinux_2_34_x86_64.whl (1.8 MB view details)

Uploaded Python 3manylinux: glibc 2.34+ x86-64

ffmt-0.3.1-py3-none-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file ffmt-0.3.1.tar.gz.

File metadata

  • Download URL: ffmt-0.3.1.tar.gz
  • Upload date:
  • Size: 79.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ffmt-0.3.1.tar.gz
Algorithm Hash digest
SHA256 e91e5c19d4d8d337af8594f2f4b3563c7682328cb56ae69a980783cd35c53070
MD5 c768dd4669f5e96e3dd0968ce1d72ada
BLAKE2b-256 5af0e66aa704d56291ffcf5344d7f9b03db111d4e38e5f324e78a484e4658afc

See more details on using hashes here.

Provenance

The following attestation bundles were made for ffmt-0.3.1.tar.gz:

Publisher: release.yml on sbryngelson/ffmt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ffmt-0.3.1-py3-none-win_amd64.whl.

File metadata

  • Download URL: ffmt-0.3.1-py3-none-win_amd64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ffmt-0.3.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 a7656066528413dc72d84465942d867169087fb89f84240b6cb80b87ddb3186d
MD5 aba2540e9d92df125d98207645c8a1bb
BLAKE2b-256 ac93c378cc32e19749d9c9cd4fcfeb7e7305f12add58cc71d88102ed83185a78

See more details on using hashes here.

Provenance

The following attestation bundles were made for ffmt-0.3.1-py3-none-win_amd64.whl:

Publisher: release.yml on sbryngelson/ffmt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ffmt-0.3.1-py3-none-manylinux_2_34_x86_64.whl.

File metadata

  • Download URL: ffmt-0.3.1-py3-none-manylinux_2_34_x86_64.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: Python 3, manylinux: glibc 2.34+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ffmt-0.3.1-py3-none-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 b28b6bcc956cea9a25d4aa9b5babe771602f84e7e5eb6f2e51d4ea5fc44e013e
MD5 51cdf45d33c26b0a58d28067a9962879
BLAKE2b-256 16e0d8f7b7e1766aed4dbbd45c8a3770bdf7fbef0e8552e10caa3417c31414bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for ffmt-0.3.1-py3-none-manylinux_2_34_x86_64.whl:

Publisher: release.yml on sbryngelson/ffmt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ffmt-0.3.1-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: ffmt-0.3.1-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: Python 3, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ffmt-0.3.1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 abb8949e191bf2b7daad01e5673afe1dfd1a992e7b208675b57fdfbe063c6b3b
MD5 3be1ccdc969ff053358cb56de0fe6fb8
BLAKE2b-256 d99ecff6d3dea7b462356145a846b5c8619eb4074ebcf814a3bfb445b0cffae2

See more details on using hashes here.

Provenance

The following attestation bundles were made for ffmt-0.3.1-py3-none-macosx_11_0_arm64.whl:

Publisher: release.yml on sbryngelson/ffmt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page