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

Uploaded Python 3Windows x86-64

ffmt-0.4.2-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.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (2.1 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ppc64le

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

Uploaded Python 3manylinux: glibc 2.17+ ARM64

ffmt-0.4.2-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (3.3 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.2.tar.gz.

File metadata

  • Download URL: ffmt-0.4.2.tar.gz
  • Upload date:
  • Size: 89.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.2.tar.gz
Algorithm Hash digest
SHA256 8cad9e333ac3a83a755a2a38a53a0bbcc988ab92982f5b3ef4c64972976062f5
MD5 a7e700275a1e24823d97e332f544f4d7
BLAKE2b-256 b1fd7f1f95b1fdb62ac78910954f9585ec2bbaea3ee222f87d57bc7c5bfce235

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: ffmt-0.4.2-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.2-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 294ed501ccf37f70aa0edb617aeba392a023b75b1d1c2113beb6e5e618fc04f9
MD5 105b02a63a10f1e0eeb6b4adec6ef420
BLAKE2b-256 8d5e98e6f25be5ca71be999708c97ceadc644175ae02692e4e4269e684115665

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ffmt-0.4.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2db1a2c8664939e2ffc750c669f7c7a1a59b8e43909d16213bf3e5cc82ec97aa
MD5 00c6c9324ba59de1b6c042d20af3065b
BLAKE2b-256 eacbeafda480c07ef1c56166c4a0a979bc54e971166b540b08e2a67dda2a06d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for ffmt-0.4.2-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.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for ffmt-0.4.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 71bd269a381f5c4725d1527a9d7fbb9fade2bd4cf325a8f75575a688b8825abf
MD5 16cff6e90b0cf6f5c2efd4772248910c
BLAKE2b-256 8e81f61c4a496a2728d2fe03e5ecbdad9aa5368118b70a783aae96e585e058d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for ffmt-0.4.2-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.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for ffmt-0.4.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 07bc50170d914f67e4f9669ba06df2fb7c0c3645913ddfa3502e830990d63db9
MD5 42710239b2251d1fda961405134c26eb
BLAKE2b-256 396f07716d20bfec106465fee8f785ea88b443e282147a4fa4dfa555f0099bcd

See more details on using hashes here.

Provenance

The following attestation bundles were made for ffmt-0.4.2-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.2-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.2-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 bd00390fc63e21dc76412e694cd9b7601672aeb599b9d2d5ea9f51321f28c286
MD5 91e5d663fedb7d92f9f32bcbcceb9ba0
BLAKE2b-256 2ca1c5e452b29d4c0497b50abf3e84b3a7b0e871b4a1d2d4816ca90ee482728a

See more details on using hashes here.

Provenance

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