An uncompromising Fortran formatter, inspired by Black
Project description
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
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
CLI flags override pyproject.toml defaults.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sable_fortran-0.3.4.tar.gz.
File metadata
- Download URL: sable_fortran-0.3.4.tar.gz
- Upload date:
- Size: 70.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e80a44a4860b4623c9dc716bcf418ecf3d08d7f4bb7f8bead9f1929c189fe3f7
|
|
| MD5 |
78f337061c3af0a84c4718775dd1fcea
|
|
| BLAKE2b-256 |
21c9e3a318a2dc8f4767cb1ab47efeaa8efccb5b99ba7e2f8abaa85dcbe593dd
|
Provenance
The following attestation bundles were made for sable_fortran-0.3.4.tar.gz:
Publisher:
publish.yml on eirik-kjonstad/sable
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sable_fortran-0.3.4.tar.gz -
Subject digest:
e80a44a4860b4623c9dc716bcf418ecf3d08d7f4bb7f8bead9f1929c189fe3f7 - Sigstore transparency entry: 1529875263
- Sigstore integration time:
-
Permalink:
eirik-kjonstad/sable@8183ff1e9214e041bcf4668d1d69c4ce955ca762 -
Branch / Tag:
refs/tags/v0.3.4 - Owner: https://github.com/eirik-kjonstad
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8183ff1e9214e041bcf4668d1d69c4ce955ca762 -
Trigger Event:
release
-
Statement type:
File details
Details for the file sable_fortran-0.3.4-py3-none-any.whl.
File metadata
- Download URL: sable_fortran-0.3.4-py3-none-any.whl
- Upload date:
- Size: 53.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30cf7ed574a4f65fd63635a1c9045e25dc80fca76f812d3098d8bb08cb3e8cb3
|
|
| MD5 |
c0683d8e45d81c442706cc09d19a5c27
|
|
| BLAKE2b-256 |
171efe8cc6156525fa91f338ee962a5bdb99f3612f7630e6fece3275fd16f041
|
Provenance
The following attestation bundles were made for sable_fortran-0.3.4-py3-none-any.whl:
Publisher:
publish.yml on eirik-kjonstad/sable
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sable_fortran-0.3.4-py3-none-any.whl -
Subject digest:
30cf7ed574a4f65fd63635a1c9045e25dc80fca76f812d3098d8bb08cb3e8cb3 - Sigstore transparency entry: 1529875342
- Sigstore integration time:
-
Permalink:
eirik-kjonstad/sable@8183ff1e9214e041bcf4668d1d69c4ce955ca762 -
Branch / Tag:
refs/tags/v0.3.4 - Owner: https://github.com/eirik-kjonstad
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8183ff1e9214e041bcf4668d1d69c4ce955ca762 -
Trigger Event:
release
-
Statement type: