https://github.com/python/mypy/tree/master/mypyc Skip to content Sign up * Why GitHub? Features - + Mobile - + Actions - + Codespaces - + Packages - + Security - + Code review - + Project management - + Integrations - + GitHub Sponsors - + Customer stories- + Security - * Team * Enterprise * Explore + Explore GitHub - Learn and contribute + Topics - + Collections - + Trending - + Learning Lab - + Open source guides - Connect with others + The ReadME Project - + Events - + Community forum - + GitHub Education - + GitHub Stars program - * Marketplace * Pricing Plans - + Compare plans - + Contact Sales - + Nonprofit - + Education - [ ] [search-key] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this organization All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} python / mypy * Sponsor Sponsor python/mypy * Watch 201 * Star 10k * Fork 1.6k * Code * Issues 1.5k * Pull requests 67 * Actions * Projects 0 * Wiki * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Wiki * Security * Insights master Switch branches/tags [ ] Branches Tags Nothing to show {{ refName }} default View all branches Nothing to show {{ refName }} default View all tags mypy/mypyc/ Go to file mypy/mypyc/ Latest commit @vsakkas vsakkas Implement dict copy primitive (#9721) ... 497556f Feb 20, 2021 Implement dict copy primitive (#9721) Implements dict copy primitive for improved performance. Related ticket: mypyc/mypyc#644 497556f Git stats * History Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time . . analysis Revert "[mypyc] Add LoadLiteral and use tables to construct and store... Feb 19, 2021 codegen Revert "[mypyc] Add LoadLiteral and use tables to construct and store... Feb 19, 2021 doc [mypyc] Add primitives for list index() and remove() (#9961) Jan 24, 2021 external/googletest Merge https://github.com/mypyc/mypyc into merge-mypyc Aug 21, 2019 ir Revert "[mypyc] Add LoadLiteral and use tables to construct and store... Feb 19, 2021 irbuild Revert "[mypyc] Add LoadLiteral and use tables to construct and store... Feb 19, 2021 lib-rt Implement dict copy primitive (#9721) Feb 20, 2021 primitives Implement dict copy primitive (#9721) Feb 20, 2021 test-data Implement dict copy primitive (#9721) Feb 20, 2021 test Revert "[mypyc] Add LoadLiteral and use tables to construct and store... Feb 19, 2021 transform [mypyc] Improve docstrings and comments + some minor refactoring (# 9861) Dec 30, 2020 README.md Remove references to git submodules in documentation and code (#9978) Jan 27, 2021 __init__.py [mypyc] Fix lint errors in imported mypyc code Aug 21, 2019 build.py [mypyc] Generate names lazily when pretty-printing IR or generating C (... Nov 29, 2020 common.py Revert "[mypyc] Add LoadLiteral and use tables to construct and store... Feb 19, 2021 crash.py [mypyc] Refactor: get rid of "if MYPY:" checks (#8413) Feb 17, 2020 errors.py [mypyc] Support `--junit-xml` (#7942) Nov 12, 2019 namegen.py Fix typos found by Debian's Lintian program (#7795) Oct 25, 2019 options.py [mypyc] Make a bunch of the build process more configurable (#7939) Nov 12, 2019 rt_subtype.py [mypyc] Add 'bit' primitive type and streamline branching (#9606) Oct 17, 2020 sametype.py [mypyc] Introduce RStruct (#9215) Jul 31, 2020 subtype.py [mypyc] Add 'bit' primitive type and streamline branching (#9606) Oct 17, 2020 README.md mypyc: Mypy to Python C Extension Compiler Mypyc is (mostly) not yet useful for general Python development. Mypyc is a compiler that compiles mypy-annotated, statically typed Python modules into CPython C extensions. Currently our primary focus is on making mypy faster through compilation -- the default mypy wheels are compiled with mypyc. Compiled mypy is about 4x faster than without compilation. Mypyc compiles what is essentially a Python language variant using "strict" semantics. This means (among some other things): * Most type annotations are enforced at runtime (raising TypeError on mismatch) * Classes are compiled into extension classes without __dict__ (much, but not quite, like if they used __slots__) * Monkey patching doesn't work * Instance attributes won't fall back to class attributes if undefined * Also there are still a bunch of bad bugs and unsupported features :) Compiled modules can import arbitrary Python modules, and compiled modules can be used from other Python modules. Typically mypyc is used to only compile modules that contain performance bottlenecks. You can run compiled modules also as normal, interpreted Python modules, since mypyc targets valid Python code. This means that all Python developer tools and debuggers can be used. macOS Requirements * macOS Sierra or later * Xcode command line tools * Python 3.5+ from python.org (other versions are untested) Linux Requirements * A recent enough C/C++ build environment * Python 3.5+ Windows Requirements * Windows has been tested with Windows 10 and MSVC 2017. * Python 3.5+ Quick Start for Contributors First clone the mypy git repository: $ git clone https://github.com/python/mypy.git $ cd mypy Optionally create a virtualenv (recommended): $ virtualenv -p python3 $ source /bin/activate Then install the dependencies: $ python3 -m pip install -r test-requirements.txt Now you can run the tests: $ pytest -q 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 there is a risk of duplicate work. Note that the issue tracker is hosted on the mypyc GitHub project, not with mypy itself. Documentation 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. [PARTIALLY DONE] Generate useful errors for code that uses unsupported Python features instead of crashing or generating bad code. 6. [DONE] Release a version of mypy that includes a compiled mypy. 7. 1. More feature/compatibility work. (100% compatibility with Python is distinctly an anti-goal, but more than we have now is a good idea.) 2. [DONE] Support compiling Black, which is a prominent tool that could benefit and has maintainer buy-in. (Let us know if you maintain another Python tool or library and are interested in working with us on this!) 3. More optimization! Code size reductions in particular are likely to be valuable and will speed up mypyc compilation. 8. We'll see! Adventure is out there! Future We have some ideas for future improvements and optimizations. * (c) 2021 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.