Monoformat
Opinionated and "zero config" formatters like Ruff and Prettier are amazing in the sense that they remove any need for thinking about formatting. However, they still require you to:
- Be used separately (one is Python and the other is Node)
- Be configured for the language version and so forth
Monoformat does this automatically. You can only use the language version that monoformat allows and you can configure literally nothing except which files it's going to reformat and which it's not.
Installation
Monoformat is available on PyPI:
pip install monoformat
Usage
Monoformat is a command line tool. You can run it with:
monoformat .
This will reformat all files in the current directory and its subdirectories.
It will take care to avoid .git and other special directories. There is a
default pattern embedded but you can change it with the --do-not-enter flag,
which is a pattern matching folder or file names you don't want to consider.
On addition to the --do-not-enter rule, it will by default check all
.gitignore files and .formatignore files (which use the .gitignore syntax
but only affect the decision of whether to format a file or not, not to put them
in git) and.
Default project
Let's say you have a Django project. It contains lots of files, including a
node_modules somewhere and a a lot of big migration files.
You might want to have at the root of your repo a .gitignore file that looks
like that:
node_modules
.idea
.vscode
.env
*.pyc
And then specifically to avoid formatting migrations (which can be super
expensive), and to avoid running prettier on Django templates (which ends up
badly) add a .formatignore file that looks like that:
**/migrations/*
**/templates/*
Then you can run monoformat . and it will only format the files that are
relevant to your project.
Without install
I've actually spent an absurd amount of time to make it extremely simple to run Python and JS code without installing anything. You can do this with:
curl -s https://pypi.run/monoformat | python3 - .
Doing so will entirely reformat with Ruff, oxfmt and Prettier the current directory.
Supported languages
Monoformat supports the following languages:
- Python (Ruff, both import sorting and Black-style formatting)
- JavaScript (oxfmt)
- TypeScript (oxfmt)
- JSON (Prettier)
- Markdown (Prettier)
- YAML (Prettier)
- HTML (Prettier)
- CSS (Prettier)
- SCSS (Prettier)
- Less (Prettier)
- Vue (Prettier)
- Svelte (Prettier)
- MJML (Prettier)
- PHP (Prettier)
JavaScript and TypeScript run through oxfmt, which is Prettier-compatible in style but dramatically faster. Everything that runs through Prettier or oxfmt requires Node to be available. If you don't have a system-wide Node installation, you can get one bundled as a Python wheel:
pip install monoformat[node]
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 monoformat-1.0.0.tar.gz.
File metadata
- Download URL: monoformat-1.0.0.tar.gz
- Upload date:
- Size: 13.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c626df89ea787d759cd2d74af935f6b7e72582feb03569a8a0d0ae35c61968c
|
|
| MD5 |
1d303c83c6061a139010973165eb8ad4
|
|
| BLAKE2b-256 |
694054c88a63c3cbfc99d16bd35be46df2b0ba098cd81aa360e4853a13e760c8
|
Provenance
The following attestation bundles were made for monoformat-1.0.0.tar.gz:
Publisher:
release.yml on Xowap/Monoformat
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
monoformat-1.0.0.tar.gz -
Subject digest:
4c626df89ea787d759cd2d74af935f6b7e72582feb03569a8a0d0ae35c61968c - Sigstore transparency entry: 2547892950
- Sigstore integration time:
-
Permalink:
Xowap/Monoformat@ad8c4292aab782f9acc31166e397dc0025ba6fb8 -
Branch / Tag:
refs/tags/1.0.0 - Owner: https://github.com/Xowap
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ad8c4292aab782f9acc31166e397dc0025ba6fb8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file monoformat-1.0.0-py3-none-any.whl.
File metadata
- Download URL: monoformat-1.0.0-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75da41c453e700c158d64f1143e2b1b12121759c50c483535518d6a26a19c4d1
|
|
| MD5 |
6a4cd5cd1bf034e2ffea54a02c7fa5f6
|
|
| BLAKE2b-256 |
45f7e09d3c2eeacb9bcc00a6fc7b7ad9f2a0b012ace8b3647667f82fe1a83189
|
Provenance
The following attestation bundles were made for monoformat-1.0.0-py3-none-any.whl:
Publisher:
release.yml on Xowap/Monoformat
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
monoformat-1.0.0-py3-none-any.whl -
Subject digest:
75da41c453e700c158d64f1143e2b1b12121759c50c483535518d6a26a19c4d1 - Sigstore transparency entry: 2547893301
- Sigstore integration time:
-
Permalink:
Xowap/Monoformat@ad8c4292aab782f9acc31166e397dc0025ba6fb8 -
Branch / Tag:
refs/tags/1.0.0 - Owner: https://github.com/Xowap
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ad8c4292aab782f9acc31166e397dc0025ba6fb8 -
Trigger Event:
push
-
Statement type: