An uncompromising Fortran formatter, inspired by Black.
"So it goes." — Kurt Vonnegut, Slaughterhouse-Five
Sable enforces one consistent style for modern free-form Fortran, so you can focus on code instead of formatting. It also supports code checks beyond formatting to identify code issues.
Installation
pip install sable-fortran
Quick Start
# Format in place (default command)
sable src/
# Equivalent explicit form
sable format src/
# Check formatting only (no writes)
sable format --check src/
# Preview formatting diff
sable format --diff src/
# Safer migration pass (layout-focused)
sable format --safe src/
Recommended CI formatting gate:
sable format --check src/
Formatting
format rewrites source into Sable's canonical style. This includes:
- Relational operator normalization (
.EQ.->==, etc.) - END keyword normalization (
endif->end if, configurable) - Declaration normalization (
integer x->integer :: x) - Deterministic spacing, indentation, wrapping, and trailing newline handling
Example:
! Before
IF(A .EQ. B)THEN
CALL compute(argument_alpha,argument_beta,argument_gamma)
ENDIF
! After
if (A == B) then
call compute(argument_alpha, &
argument_beta, &
argument_gamma)
end if
Checking
check reports rule diagnostics and can apply rule fixes.
# Run all rules (style + lint)
sable check src/
# Focus on policy/lint only
sable check --rule-set lint src/
# Formatter-adjacent style rules only
sable check --rule-set style src/
# Apply safe fixes, then re-check
sable check --fix src/
# Allow unsafe fixes too
sable check --fix --unsafe-fixes src/
Rule-set notes:
--rule-set all(default): style + lint--selecttakes precedence over--rule-set--fixapplies safe fixes--unsafe-fixesenables unsafe fixes (only with--fix)
Current lint rules:
SBL101: Program/module is missingimplicit noneSBL102: Procedure is missingimplicit noneSBL103: Dummy argument is missingintent(in|out|inout)
Suppressions
Inline:
if (a .eq. b) then ! sable: ignore SBL001
end if
File-wide:
! sable: ignore-file SBL001,SBL004
Configuration
Formatter options are CLI flags:
sable format --line-length 88 src/
| Option | Default | Values | Applies to |
|---|---|---|---|
--line-length |
100 |
integer | format, check |
--indent-width |
3 |
integer | format, check |
--keyword-case |
lower |
lower, upper |
format, check |
--end-keyword-form |
spaced |
spaced, compact |
format, check |
--no-normalize-operators |
off | flag | format, check |
rule_set / --rule-set |
all |
style, lint, all |
check |
select / --select |
[] |
rule codes | check |
ignore / --ignore |
[] |
rule codes | check |
output_format / --output-format |
text |
text, json, sarif, gitlab-codequality |
check |
baseline / --baseline |
unset | path | check |
fix / --fix |
false |
boolean | check |
unsafe_fixes / --unsafe-fixes |
false |
boolean | check |
generate_baseline / --generate-baseline |
false |
boolean | check |
Example pyproject.toml:
[tool.sable.check]
rule_set = "all" # style | lint | all
select = []
ignore = []
output_format = "text" # text | json | sarif | gitlab-codequality
baseline = ".sable-baseline.json"
fix = false
unsafe_fixes = false
generate_baseline = false
For check, CLI flags override pyproject.toml defaults.
Badge
[](https://github.com/eirik-kjonstad/sable)
License
MIT
Metadata
Release files for sable-fortran 0.3.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| sable_fortran-0.3.11.tar.gz | 75.1 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sable_fortran-0.3.11-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 133.5 kB
Release files / sable_fortran-0.3.11.tar.gz
| Download URL | sable_fortran-0.3.11.tar.gz |
|---|---|
| Size | 75.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cf5e9343af1f222bc9e34cbe5a6c88e6f382e72ee6a417bf18b36a9a0abe109d
|
|
BLAKE2b-256 checksum How to use checksums |
ad2fcce75b6cfc9baf9176c3c3b9bd30ec5dee98e6ca659d36b444cbc988cc07
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 25, 2026.
Transparency logRelease files / sable_fortran-0.3.11-py3-none-any.whl
| Download URL | sable_fortran-0.3.11-py3-none-any.whl |
|---|---|
| Size | 58.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5906c8286608ba582db98ac1bc8bdf4785af568d1348d4d589441c2d9bdf2dfc
|
|
BLAKE2b-256 checksum How to use checksums |
e3a856f671c007354c732ce74f10a794c050dce2b0cedc890bfe4e71a5aff0c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 25, 2026.
Transparency logSecurity for sable-fortran 0.3.11
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for sable_fortran-0.3.11.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 25, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.