Installing and using Black for code formatting, and setting up pre-commit hooks

This page summarizes the projects mentioned and recommended in the original post on /r/Python

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • Pipenv

    Python Development Workflow for Humans.

    Just a heads up. The Pipenv installation instructions will not work. By default Pipenv does not allow pre-releases and black does not have a regular release yet. You can make it work by adding the --pre flag but that will allow pre-releases for all dependencies which might not be what you want. Black is known for being a bit of a pain to use with Pipenv, there is an issue open to allow pre-releases per dependency but it's not here yet. The solution I saw (and use) is to specify the black version to use because Pipenv will install that even if it's a pre-release. That way you can use black but don't have to allow pre-releases. I don't believe there is a way to specify the version to install using the command line so you have to edit the Pipfile like this for example:

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

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