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

Uploaded Python 3Windows x86-64

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

Uploaded Python 3manylinux: glibc 2.34+ x86-64

ffmt-0.3.4-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.4.tar.gz.

File metadata

  • Download URL: ffmt-0.3.4.tar.gz
  • Upload date:
  • Size: 79.1 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.4.tar.gz
Algorithm Hash digest
SHA256 10ff15b7d07be52833b8e52ef6c6a614a6e10575994d91bb775bf22d9a681f94
MD5 5939f657c3a8ffdb07dc979b58bcd46f
BLAKE2b-256 423b048026cf98a7aca7de7d9a668dc1318b131aeb3dc727c59d909d796a75f8

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: ffmt-0.3.4-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.4-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 76b0528a22ae39d392751647fae2c3c120a727b61cb0701740204b1a8d0b021c
MD5 9a9be443f79b0bb3ff58e82dd8ca3c41
BLAKE2b-256 96223ddb80356a69cbac96722903cb00ea684cb15a7fad5c34e59e9365f517a1

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: ffmt-0.3.4-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.4-py3-none-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ad59f2afe363283a9aa00ace9c7f15ae67280cc7702a254c07a8bbde82a1013b
MD5 0d4ac14555c6b6759cc8a5d803e2466b
BLAKE2b-256 b04fae7dd7f3c99961e4309c85d36fec6f820d4b5b03982b791da18116fd2892

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: ffmt-0.3.4-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.4-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 347ff636fdd99aaba32bb5000c860efd4b0e80c9783f652680c85cf87e55589a
MD5 e5ebc42d264777e1a770742874af2e0d
BLAKE2b-256 185939535d2051bf1a5dcb09d260fbcb269c5c9e3e31b699b21c0ab0c038477b

See more details on using hashes here.

Provenance

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