Skip to content
Compiler from type annotated Python to C extensions
Branch: master
Clone or download
msullivan Emit an error for kwonly args appearing after optional ones (#561)
We miscompile this and it is why mypy.main breaks.
Latest commit 118d08c Apr 16, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc Minor typo fixes in comments/messages/docs. (#522) Jan 23, 2019
mypyc Emit an error for kwonly args appearing after optional ones (#561) Apr 16, 2019
scripts Use subprocess to run in the mypyc script (#513) Dec 22, 2018
test-data Emit an error for kwonly args appearing after optional ones (#561) Apr 16, 2019
tmp-test-dirs Add initial source dump Jul 24, 2017
setup.cfg Fix version pinning to write to right file! (#548) Apr 5, 2019

mypyc: Mypy to Python C Extension Compiler

Mypyc is not yet useful for general Python development.

Mypyc is a compiler that compiles mypy-annotated, statically typed Python modules into Python C extensions. Currently our focus is on making mypy faster through compilation.

MacOS Requirements

  • macOS Sierra or later

  • Xcode command line tools

  • Python 3.6 (64-bit) from (other versions likely won't work right now)

Linux Requirements

  • A recent enough C/C++ build environment

  • Python 3.5+ (64-bit)

Windows Requirements

  • Windows has been tested with Windows 10 and MSVC 2017.

  • Python 3.5+ (64-bit)

Quick Start for Contributors

First clone the mypyc git repository and git submodules:

$ git clone --recurse-submodules
$ cd mypyc

Optionally create a virtualenv (recommended):

$ virtualenv -p python3 <directory>
$ source <directory>/bin/activate

Then install the dependencies:

$ python3 -m pip install -r mypyc/external/mypy/test-requirements.txt

Now you can run the tests:

$ pytest mypyc

Look at the issue tracker for things to work on. Please express your interest in working on an issue by adding a comment before doing any significant work, since development is currently very active and there is real risk of duplicate work.


We have some developer documentation.

Development Status and Roadmap

These are the current planned major milestones:

  1. [DONE] Support a smallish but useful Python subset. Focus on compiling single modules, while the rest of the program is interpreted and does not need to be type checked.

  2. [DONE] Support compiling multiple modules as a single compilation unit (or dynamic linking of compiled modules). Without this inter-module calls will use slower Python-level objects, wrapper functions and Python namespaces.

  3. [DONE] Mypyc can compile mypy.

  4. [DONE] Optimize some important performance bottlenecks.

  5. Generate useful errors for code that uses unsupported Python features instead of crashing or generating bad code.

  6. Release a version of mypy that includes a compiled mypy.


We have some ideas for future improvements and optimizations.

You can’t perform that action at this time.