black VS autopep8

Compare black vs autopep8 and see what are their differences.


A tool that automatically formats Python code to conform to the PEP 8 style guide. (by hhatto)
Our great sponsors
  • InfluxDB - Collect and Analyze Billions of Data Points in Real Time
  • Onboard AI - Learn any GitHub repo in 59 seconds
  • SaaSHub - Software Alternatives and Reviews
black autopep8
316 17
35,612 4,451
4.0% -
9.3 7.5
5 days ago about 1 month ago
Python Python
MIT License MIT License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.


Posts with mentions or reviews of black. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-12-08.
  • Embracing Modern Python for Web Development
    12 projects | | 8 Dec 2023
    Ruff is not only much faster, but it is also very convenient to have an all-in-one solution that replaces multiple other widely used tools: Flake8 (linter), isort (imports sorting), Black (code formatter), autoflake, many Flake8 plugins and more. And it has drop-in parity with these tools, so it is really straightforward to migrate from them to Ruff.
  • Releasing my Python Project
    4 projects | | 26 Nov 2023
    1. LICENSE: This file contains information about the rights and permissions granted to users regarding the use, modification, distribution, and sharing of the software. I already had an MIT License in my project. 2. pyproject.toml: It is a configuration file typically used for specifying build requirements and backend build systems for Python projects. I was already using this file for Black code formatter configuration. 3. Used as a documentation file for your project, typically includes project overview, installation instructions and optionally, contribution instructions. 4. example_package_YOUR_USERNAME_HERE: One big change I had to face was restructuring my project, essentially packaging all files in this directory. The name of this directory should be what you want to name your package and shoud not conflict with any of the existing packages. Of course, since its a Python Package, it needs to have an 5. tests/: This is where you put all your unit and integration tests, I think its optional as not all projects will have tests. The rest of the project remains as is.
  • Lute v3 - installed software for learning foreign languages through reading
    2 projects | /r/flask | 15 Nov 2023
    using pylint and black ("the uncompromising code formatter")
  • Testing Python Code Using UnitTest
    3 projects | | 9 Nov 2023
    It was with this test that I made that I was able to test my parse_md function, previously called check_md_and_write, and locate a bug that I uncovered a last week. I noticed this bug when I was using the linter, Ruff, and formatter, Black, I set up for my project. If you're interested in reading about the linter and formatter I chose and the setup process you can read last week's blog. Essentially the problem was that I could not parse any Markdown in my program. I wasn't sure what the problem was, but I think it had something to do with when I refactored my code and tried to clean things up. Luckily, I still has the branches where I worked on improved the function to parse markdown and the refactoring branch. To make note of it, I made an issue for myself and specified which branches to take a look at.
  • FastAPI Production Setup Guide 🏁⚡️🚀
    6 projects | | 18 Oct 2023
    Whenever I start a new project I like to maintain quality standards and using automated quality tools makes it easy. Lets go ahead and install mypy for static type checking, black for formatting, and ruff for linting. Add these to the dev dependencies.
  • Django Code Formatting and Linting Made Easy: A Step-by-Step Pre-commit Hook Tutorial
    7 projects | | 4 Oct 2023
    Black is a Python code formatter that automatically formats Python code to comply with its style guide called PEP 8. PEP 8 is the official style guide for Python code, and it provides recommendations on how to format code for better readability and consistency.
  • Packaging Python projects in 2023 from scratch
    2 projects | /r/Python | 6 Sep 2023
    Uses a uniform line width of 100 for both black (my preferred auto-formatter) and flake8.
  • Automate Python Linting and Code Style Enforcement with Ruff and GitHub Actions
    9 projects | | 22 Jul 2023
  • Setting Up Pre-Commit Hooks in GitHub: Ensuring Code Quality and Consistency
    4 projects | | 11 Jul 2023
    repos: - repo: rev: hooks: - id: black
  • Conversion from the f-string literals to format method in python
    4 projects | /r/learnpython | 10 Jul 2023
    In addition, you should use black or shed (uses black and other tools)


Posts with mentions or reviews of autopep8. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-10-14.

What are some alternatives?

When comparing black and autopep8 you can also consider the following projects:

prettier - Prettier is an opinionated code formatter.

yapf - A formatter for Python files

Flake8 - flake8 is a python tool that glues together pycodestyle, pyflakes, mccabe, and third-party plugins to check the style and quality of some python code.

Pylint - It's not just a linter that annoys you!

ruff - An extremely fast Python linter and code formatter, written in Rust.

isort - A Python utility / library to sort imports.

autoflake - Removes unused imports and unused variables as reported by pyflakes

black - The uncompromising Python code formatter [Moved to:]

pycodestyle - Simple Python style checker in one Python file