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

Uploaded Python 3Windows x86-64

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

Uploaded Python 3manylinux: glibc 2.34+ x86-64

ffmt-0.3.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.3.0.tar.gz.

File metadata

  • Download URL: ffmt-0.3.0.tar.gz
  • Upload date:
  • Size: 78.9 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.0.tar.gz
Algorithm Hash digest
SHA256 d99857a29803948edff796d3a221b6686036ae51b02ba8094992bf65d39ad840
MD5 54ca3d0e5fd83c26c3c740765965d07a
BLAKE2b-256 d9f13dc541c16334e7fd806b16129293d042214aa71314b729ada8f251c5832c

See more details on using hashes here.

Provenance

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

File metadata

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

File hashes

Hashes for ffmt-0.3.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 2834bb3952952630598eef5561db5bfabaf34bd8ea67ae7d9b2d29167e4ad09f
MD5 59829bbe7171030d836a72c9a68b08e2
BLAKE2b-256 1401aa0ec20058121269755ab9233ba81ef80da467db3c9378ffcab8abc6efd5

See more details on using hashes here.

Provenance

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

File metadata

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

File hashes

Hashes for ffmt-0.3.0-py3-none-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 aef4d375ebc7fd504b64b0e929136ef9cf505cea4e4d7045307e031588e6f4e1
MD5 e988ba5cf94e33e4e4572404e630dd5b
BLAKE2b-256 a9fee5bee893654f04db96741180cf87f4242be61a6a7be2532721d604934682

See more details on using hashes here.

Provenance

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

File metadata

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

File hashes

Hashes for ffmt-0.3.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c8d054c6989f5ee9811d64e966f38029cf4c843fbddd491f355718822a12f637
MD5 e751f9e07e0dd1bad9f6ff1180ef1b88
BLAKE2b-256 88d022fed65b16e418639ad2fe2f09c6b109b7eb7c12c8d6a9b8fdf62a6890cc

See more details on using hashes here.

Provenance

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