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

Uploaded Python 3Windows x86-64

ffmt-0.4.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.8 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

ffmt-0.4.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (2.1 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ppc64le

ffmt-0.4.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.8 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

ffmt-0.4.3-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (3.4 MB view details)

Uploaded Python 3macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: ffmt-0.4.3.tar.gz
  • Upload date:
  • Size: 107.3 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.3.tar.gz
Algorithm Hash digest
SHA256 205dd0f7dac9589b14edb76c11ede3276e658eab0733ec6265efbd36854fb4e5
MD5 6c75c887e3703a9ab530bc7f10cf2a14
BLAKE2b-256 e91e0914de092776a4f25a08ccbbf0aee2d269d064abc63563a411c16d1cd922

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: ffmt-0.4.3-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.3-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 0201acf85884160eccacf3fbb531326b1d2e10438e086b2da6f08bce2f7ab96d
MD5 c461b1d79d338e4e40ddd44f838b051c
BLAKE2b-256 a236bbfeb81d14bb6bdb9f123f793f4344087bd6047fad77d549defe0ff2d43a

See more details on using hashes here.

Provenance

The following attestation bundles were made for ffmt-0.4.3-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.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ffmt-0.4.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 94f6b14df51b1bc5e7dc7f2aada4b84043520eace3497a708e7b830b06119b0d
MD5 e557c62991e14b39a107646f27edba1d
BLAKE2b-256 fef72011241b6f133030b2db4f7747af678fe23f3578fa316926230dbc067daa

See more details on using hashes here.

Provenance

The following attestation bundles were made for ffmt-0.4.3-py3-none-manylinux_2_17_x86_64.manylinux2014_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.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for ffmt-0.4.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 6284542421d83f71868e5d5378df74dc5639ab049a5c7c8414d9d5e8f50deaca
MD5 492928de39460cd1f69d4670c8ba16db
BLAKE2b-256 dca5ca94f9e19995eaf9f643defc8dd659d416116ff5b01c3d4098f000e75e6f

See more details on using hashes here.

Provenance

The following attestation bundles were made for ffmt-0.4.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.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.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for ffmt-0.4.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6292817484b1d3f573c6b2b5db9d42cdfda47dca1b99b205488398c322ff078f
MD5 60e6c029b7872015651bb85299d46dc9
BLAKE2b-256 52babcf20f11beb96220d03243af6ed1aaa7ae47ec94424bd2146458d722e35f

See more details on using hashes here.

Provenance

The following attestation bundles were made for ffmt-0.4.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.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.3-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for ffmt-0.4.3-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 df52ee5a5ee21861d2823e2fa2e92f94461fd2af7dc3f7bb43b6b37ca687a07c
MD5 2d709385b996e143dc5975267910e5c4
BLAKE2b-256 18b3902db93459fd294ddbad5c969fef95d2c58ea8fec5940b3f0e85551ff365

See more details on using hashes here.

Provenance

The following attestation bundles were made for ffmt-0.4.3-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.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