Skip to content
SPECIFICTION
Get listed

Black vs Scalafmt

Black

black.readthedocs.io

Scalafmt

scalameta.org

Side by side

FigureBlackScalafmt
Price fromFreeFree
Free planYesYes
Free trial——
Open source——
WindowsYesYes
macOSYesYes
LinuxYesYes
Self-hostedYesYes
Plans published11
Spec score · Code Formatting Tools8.7 (#1)7.6 (#22)
Editor integrationsThe documentation describes integrations for editors including PyCharm, Vim, Neovim, Visual Studio Code, and Sublime Text.The documentation describes use with IntelliJ, VS Code, Vim, NeoVim, Emacs, Sublime Text, and Eclipse, with Metals supporting formatting requests from editors.
LicenseBlack is licensed under the MIT license.The GitHub repository identifies the project license as Apache-2.0.
PurposeBlack is an opinionated formatter for Python code that follows PEP 8.Scalafmt is a code formatter for Scala that formats code consistently across a team.

Plans

Black

  • BlackFree

Black pricing →

Scalafmt

  • FreeFree

Scalafmt pricing →

In their own words

Black

Black is a free, MIT-licensed formatter for Python code that follows PEP 8. It reformats whole files in place and uses a default line length of 88 characters. Its limited style choices are intended to keep code consistent across projects; indentation style cannot be configured. After formatting, Black checks whether the abstract syntax tree remains effectively equivalent and raises an error if the check fails. Install it with pip; it requires Python 3.10 or newer. The documentation lists editor integrations including Emacs, PyCharm, IntelliJ IDEA, Vim, Neovim, Visual Studio Code and Sublime Text, as well as GitHub Actions and doctest workflows. Notebook formatting is available with the jupyter extra, though Black skips cells containing certain magics or invalid syntax. It also includes blackd, an HTTP server that binds to localhost by default. Black is primarily a command-line tool and does not provide a Python interface. Stable releases preserve formatting within the same calendar year when the options match.

Visit black.readthedocs.io

Scalafmt

Scalafmt is a free Scala code formatter for keeping formatting consistent across a team. It handles Scala 2, Scala 3, sbt files and Scala scripts, with one dialect selected for each file. Formatting options are stored in a plain-text .scalafmt.conf file using HOCON syntax. Since version 3.1.0, the configuration must explicitly specify both the version and runner.dialect. Scalafmt can run from an editor, build tool or terminal. Documented editor integrations include IntelliJ, VS Code, Vim, NeoVim, Emacs, Sublime Text and Eclipse; Metals supports formatting requests from editors. It integrates with sbt and documents integrations for Maven, Gradle and Mill. Command-line check and test modes report misformatted code without writing changes. It also supports ignoring files, changed-lines formatting and a library API. IntelliJ range formatting uses IntelliJ’s own formatter by default: Scalafmt is designed primarily for whole files, and selected ranges may produce undesirable results. The project license is Apache-2.0.

Visit scalameta.org