mypy VS black

Compare mypy vs black and see what are their differences.

Our great sponsors
  • Nanos - Run Linux Software Faster and Safer than Linux with Unikernels
  • Scout APM - A developer's best friend. Try free for 14-days
  • SaaSHub - Software Alternatives and Reviews
mypy black
37 107
11,863 23,696
4.0% 5.1%
9.7 9.4
5 days ago 6 days ago
Python Python
GNU General Public License v3.0 or later 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 mypy. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2021-10-30.
  • mypy alternatives - pytype and pyright
    3 projects | 30 Oct 2021
  • How to fix mypy warning for this function
    2 projects | | 26 Oct 2021
    For your interest, this indeed was unintended behaviour on the part of `mypy`. It has since been fixed, apparently:
    2 projects | | 26 Oct 2021
    Just created a bug report for this.
  • Setup development environment
    4 projects | | 17 Oct 2021
    6. Add Mypy to the virtual environment. Mypy is a static type checker for Python.
  • Do You Miss Strongly-Typed World When Coding in Python? [RE#8]
    1 project | | 8 Oct 2021
    JavaScript people are lucky to have the well-known TypeScript at hand. For Python developers a good solution is mypy which is maintained by the official Python community: python/mypy. You can simply install it via:
  • Faster Python with Guido van Rossum
    11 projects | | 7 Oct 2021
    I am seeing what the GP comment says in a codebase I manage, around 47k LOC. Not massive at all, but enough where the problems mentioned above start to pop up. This is an application that runs in servers to analyze traffic data, so it has both analysis code and also a lot of code for the analysis framework. It gets hard to manage. I have unit tests and also integration tests that cover some, but not all of the code paths (it's very hard in this case to have everything covered). Most of the times, when they fail is due to something that would have been caught by static typing.

    The codebase is being slowly migrated to static typing. On one hand, as the parent says, the typing module is still immature and there are still some Python constructs (not too weird ones, see [1] for an example) that you can't type-check correctly. On the other hand, I like the fact that you can include typing slowly and not all at once, it makes the effort much easier to tackle. And, if typing works, it works well.

    Regarding performance, well. Parallelism is pretty hard to do well, and the language itself is not the fastest thing. Some parts are migrated to a C extension but that's costly in terms of development and debugging time.

    Despite all of that, I do think that Python was the best choice for our situation, and still is. Maybe from this point onwards another language would make things easier, but without Python's library support, ease and speed of development and expressiveness the cost of just getting to market would have been far higher, and probably we wouldn't have reached this point with other languages. And migrating the codebase to another language is just not worth it at all, as there are still a lot of areas we can improve quite a lot with far less effort than a full rewrite.


  • GitHub - facebookexperimental/skybison: Instagram's experimental performance oriented greenfield implementation of Python.
    2 projects | | 18 Sep 2021
    I don't know where you're getting your information, they did implement it. It's possible you're thinking of this issue which would make the typing more precise and let you specify totally different types for different keys. For now though any of the 4 ways I gave works.
  • Typehinting a dictionary that maps events to event handlers
    2 projects | | 9 Jul 2021
    I don't think it will be as easy as you're hoping, I think this is basically the same thing you're trying to do:
    2 projects | | 9 Jul 2021
  • Typeclasses in Python
    1 project | | 30 Jun 2021
    Support for singledispatch was recently added to mypy:


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 2021-11-29.
  • How to evaluate your current workplace
    3 projects | | 29 Nov 2021
    Automated quality assurance on the fundamental level. Tools such as eslint & prettier on the frontend; Flake8 & black in python help you ensure code-style consistency & protects from the simplest errors you could introduce to your codebase. Setting them up & applying all initial changes takes time, but the most difficult is to get all team members on board & get them to use those tools consistently - especially before merging the changes to the main branch.
  • My first Django project
    2 projects | | 15 Nov 2021
    Your code style is pretty inconsistent. Consistency makes code nicer to read, so I would recommend you look into linters (flake8, or pylint), and also code formatters (black). Never worry about forgetting to put a blank line at the end of the file, or leaving 5. (Also, it makes your git commits cleaner, because it automatically adds things like dangling commas, so if you add something to a list, it doesn't change the previous line).
  • Support Python 3.10 pattern matching syntax · Issue #2242 · psf/black
    1 project | | 13 Nov 2021
  • Music Synthesis with python
    6 projects | | 10 Nov 2021
    GitHub Repo
  • Python Code Quality - Improve the quality of your Python code with linters, code formatters, and security vulnerability scanners
    7 projects | | 7 Nov 2021
    yaml repos: - repo: rev: v1.4 hooks: - id: autoflake args: - --in-place - --remove-all-unused-imports - --expand-star-imports - --remove-duplicate-keys - --remove-unused-variables - repo: rev: v2.29.0 hooks: - id: pyupgrade args: [--py36-plus] - repo: rev: 5.9.3 hooks: - id: isort - repo: rev: 21.10b0 hooks: - id: black args: [--safe, --quiet] - repo: rev: 4.0.1 hooks: - id: flake8 - repo: local hooks: - id: pylint name: pylint entry: pylint language: system types: [python] args: [ "-rn", "-sn", ] - repo: rev: v0.910-1 hooks: - id: mypy name: mypy entry: mypy language: python types: [python] args: [] require_serial: true - repo: rev: v2.4.1 hooks: - id: prettier args: [--prose-wrap=always, --print-width=88]
  • Help with int
    1 project | | 6 Nov 2021
  • 2 Static Analysis Tools to Enhance Your Productivity
    5 projects | | 5 Nov 2021
    repos: - repo: rev: 21.10b0 hooks: - id: black - repo: rev: 4.0.1 hooks: - id: flake8
  • DPS909 - Lab 7
    2 projects | | 5 Nov 2021
    For feature 1, we had to implement a formatter for our project. Since my static site generator is developed in Python, I opted to use the black formatter. It has the best features, and is one of the most popular formatters for Python. You can see the changes that the formatter did, as well as my simple bash script that the user can run to format the files at the same time. Commit
  • I really don't like python. How can I learn to enjoy it?
    2 projects | | 5 Nov 2021
    There are ways you can work to get more comfortable with the style--Advent of Code is upcoming and has a bunch of puzzles which act as small ways to get familiar with a language. Additionally there's the Black Formatter which enforces a strict format for your code which can help with the loosey goosey side of it. But at the end of the day if you give it a honest shot and the language doesn't work for you--then it doesn't work for you. And there's nothing wrong with that at all.
  • Guide to Reformatting Code in IntelliJ
    1 project | | 3 Nov 2021
    We started to use Black as code formatting tool for our Python code in IntelliJ. And for myself, I made convenient shortcut (SHIFT+ALT+F since it is the same as in VS Code). Black calls itself "The uncompromising code formatter", so no more bikeshedding in our team about quote style, tabs or spaces, how to break up calls that uses fluent interface patterns etc.

What are some alternatives?

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

yapf - A formatter for Python files

autopep8 - A tool that automatically formats Python code to conform to the PEP 8 style guide.

isort - A Python utility / library to sort imports.

prettier - Prettier is an opinionated code formatter.

awesome-python-typing - Collection of awesome Python types, stubs, plugins, and tools to work with them.

PythonBuddy - 1st Online Python Editor With Live Syntax Checking and Execution

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

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.

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

typing - Python static typing home. Contains the source for typing_extensions and the documentation. Also hosts a user help forum.


bandit - Bandit is a tool designed to find common security issues in Python code.