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

Uploaded Python 3Windows x86-64

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

Uploaded Python 3manylinux: glibc 2.34+ x86-64

ffmt-0.3.5-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.5.tar.gz.

File metadata

  • Download URL: ffmt-0.3.5.tar.gz
  • Upload date:
  • Size: 81.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.3.5.tar.gz
Algorithm Hash digest
SHA256 cd93515bac93eb7c0c4ef684a3c39f82ea2fb07fcbdb72e1533ad16802720681
MD5 c226efc61666fc2ac5e094c2f0c54a1f
BLAKE2b-256 c88b218db29189347817b0326fc77a91f7720cd1bd8729195b3cbca878e9c727

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: ffmt-0.3.5-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.3.5-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 ce290bb9159ed43118d442961e059eb98c64d0debfaff17dd2709914747b49e9
MD5 b6052789376cd389cd499f406281b92e
BLAKE2b-256 e7a6966db64cc784494166f3eafee30d8eb8fe60e6a216cb7133479688624180

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: ffmt-0.3.5-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.3.5-py3-none-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 b0308480eaca77761955334dde976957d327c140ac075804ab037634ec385b3b
MD5 f17c298b42cb1b24aad8596ee9129d4d
BLAKE2b-256 279cb263f5bd9ac57ff1b89e5ffc5356b0ce199f5889e102b381e3ee6e47916b

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: ffmt-0.3.5-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.3.5-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7e38410f281a27e56278c8e58f6fde4016739932a2bd5d5cc240f464fa027425
MD5 1192c4629dc900946ba42bfd56c9d532
BLAKE2b-256 d0f89b4c0b3a309dc8ab77eabf6134fb990ff57e29328aaf68a6e9cff827977c

See more details on using hashes here.

Provenance

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