Skip to main content

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

monoformat-1.0.0.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

monoformat-1.0.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

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

Hashes for monoformat-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4c626df89ea787d759cd2d74af935f6b7e72582feb03569a8a0d0ae35c61968c
MD5 1d303c83c6061a139010973165eb8ad4
BLAKE2b-256 694054c88a63c3cbfc99d16bd35be46df2b0ba098cd81aa360e4853a13e760c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for monoformat-1.0.0.tar.gz:

Publisher: release.yml on Xowap/Monoformat

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for monoformat-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 75da41c453e700c158d64f1143e2b1b12121759c50c483535518d6a26a19c4d1
MD5 6a4cd5cd1bf034e2ffea54a02c7fa5f6
BLAKE2b-256 45f7e09d3c2eeacb9bcc00a6fc7b7ad9f2a0b012ace8b3647667f82fe1a83189

See more details on using hashes here.

Provenance

The following attestation bundles were made for monoformat-1.0.0-py3-none-any.whl:

Publisher: release.yml on Xowap/Monoformat

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

0.2.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page