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.4.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.4.0.tar.gz (81.4 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.4.0-py3-none-win_amd64.whl (1.5 MB view details)

Uploaded Python 3Windows x86-64

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

Uploaded Python 3manylinux: glibc 2.34+ x86-64

ffmt-0.4.0-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.4.0.tar.gz.

File metadata

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

File hashes

Hashes for ffmt-0.4.0.tar.gz
Algorithm Hash digest
SHA256 7e01e72b8b23419655a99c5a46154f92f010172ba96f739b3ba374ca995daf8f
MD5 291598bfa949b9dd0db9a45403a1455d
BLAKE2b-256 8cbcf92b9d20e49e437785d614b1f87eb400b5697dda6f1af70fd1ec97127a0a

See more details on using hashes here.

Provenance

The following attestation bundles were made for ffmt-0.4.0.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.4.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: ffmt-0.4.0-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.12

File hashes

Hashes for ffmt-0.4.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 442e6d14231b08ccfc4d8ba31c03c7711a9500829c31c822533cb66a8aa2ee6a
MD5 30e2ec85fd3d54739a753fb68dad5372
BLAKE2b-256 8bde5fbf25a0ceb4cb61e96cd1d724847bfdee7dcef4487e004db12ae88fe190

See more details on using hashes here.

Provenance

The following attestation bundles were made for ffmt-0.4.0-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.4.0-py3-none-manylinux_2_34_x86_64.whl.

File metadata

  • Download URL: ffmt-0.4.0-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.12

File hashes

Hashes for ffmt-0.4.0-py3-none-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 687226fafa8f8ecb419cf3d204dd06c140fe6e119cba30ce1162f2bc661246a7
MD5 ee98cabc3941ed770745a1dd63a6dda3
BLAKE2b-256 6fcc21d04d6accf1324d81a2791918b5b7d0ca8169bb99fdc03442b5b4e7c4ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for ffmt-0.4.0-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.4.0-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: ffmt-0.4.0-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.12

File hashes

Hashes for ffmt-0.4.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 822af11ce3731bbd6b42a7182f3834899b5aac84f0b44901f407e4cd5892e55d
MD5 e43221ab9aa8e9e36e3bdf97940eba02
BLAKE2b-256 6c2f89dc18c2b8233d21e528fb263a702cd30a5969ebe5e7d5484d133bb770f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for ffmt-0.4.0-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