Formatting Code with Black

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • talent.io - Download talent.io’s Tech Salary Report
  • Scout APM - Truly a developer’s best friend
  • SonarQube - Static code analysis for 29 languages.
  • InfluxDB - Build time-series-based applications quickly and at scale.
  • ssort

    Tool for automatically sorting python statements within a module

    Shameless plug: For people who like black, I've been working on ssort[0], a python source code sorter that will organize python statements into topological order based on their dependencies. It aims to resolve a similar source of bikeshedding and back and forth commits.

    0: https://github.com/bwhmather/ssort

  • isort

    A Python utility / library to sort imports.

    We use isort[0] for this. It even has a "black" compatible profile that line spits along black's defaults. Additionally we use autoflake[1] to remove unused import statements in place.

    [0](https://github.com/PyCQA/isort)

    [1](https://github.com/PyCQA/autoflake)

  • talent.io

    Download talent.io’s Tech Salary Report. Median salaries, most in-demand technologies, state of the remote work... all you need to know your worth on the market by tech recruitment platform talent.io

  • deps

    Django Enhancement Proposals

  • black

    The uncompromising Python code formatter

    The etymology of black is "any color you like, as long as it's black" [0]. The whole point is that it's _not_ configurable.

    [0] https://github.com/psf/black#readme

  • yapf

    A formatter for Python files

    A little shoutout to a alternative Python formating tool https://github.com/google/yapf (developed by Google).

    The built in "facebook style" formating felt by far the most natural to me.

  • ipython

    Official repository for IPython itself. Other repos in the IPython organization contain things like the website, documentation builds, etc.

    Here’s a script that automates the once-per-repository local setup of this feature:

    https://github.com/ipython/ipython/pull/12091/files

    Unfortunately there isn’t support for it in GitHub or GitLab yet, but there’s at least a GitLab issue here requesting it:

  • gitlab

  • Scout APM

    Truly a developer’s best friend. Scout APM is great for developers who want to find and fix performance issues in their applications. With Scout, we'll take care of the bugs so you can focus on building great things 🚀.

  • autoflake

    Removes unused imports and unused variables as reported by pyflakes

    We use isort[0] for this. It even has a "black" compatible profile that line spits along black's defaults. Additionally we use autoflake[1] to remove unused import statements in place.

    [0](https://github.com/PyCQA/isort)

    [1](https://github.com/PyCQA/autoflake)

  • ufmt

    Safe, atomic formatting with black and µsort

    Give µsort a try instead; it's focused on providing more safety when applying sorting to large codebases, and is designed to pair well with black out of the box:

    https://usort.readthedocs.io

    https://ufmt.omnilib.dev

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts