• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

analysis/H22-Jun-2021-562410

codegen/H22-Jun-2021-4,3483,395

doc/H22-Jun-2021-2,5941,819

external/googletest/H22-Jun-2021-33,60921,872

ir/H22-Jun-2021-3,3112,269

irbuild/H22-Jun-2021-8,7196,298

lib-rt/H22-Jun-2021-4,9493,885

primitives/H22-Jun-2021-1,7331,268

test/H22-Jun-2021-2,1391,684

test-data/H22-Jun-2021-22,76420,529

transform/H22-Jun-2021-472346

README.mdH A D22-Jun-20214 KiB13487

__init__.pyH A D22-Jun-20210 10

build.pyH A D22-Jun-202120.4 KiB555406

common.pyH A D22-Jun-20213.4 KiB10358

crash.pyH A D22-Jun-2021935 3224

errors.pyH A D22-Jun-2021719 2618

namegen.pyH A D22-Jun-20214.3 KiB11489

options.pyH A D22-Jun-20211.1 KiB2821

rt_subtype.pyH A D22-Jun-20212.3 KiB6446

sametype.pyH A D22-Jun-20212.2 KiB6346

subtype.pyH A D22-Jun-20212.5 KiB7257

README.md

1mypyc: Mypy to Python C Extension Compiler
2==========================================
3
4**NOTE: We are in the process of moving the mypyc README to the**
5**[mypyc repository](https://github.com/mypyc/mypyc)**
6
7**This may be out of date!**
8
9Mypyc is a compiler that compiles mypy-annotated, statically typed
10Python modules into CPython C extensions. Currently our primary focus
11is on making mypy faster through compilation -- the default mypy wheels
12are compiled with mypyc.  Compiled mypy is about 4x faster than
13without compilation.
14
15Mypyc compiles what is essentially a Python language variant using "strict"
16semantics. This means (among some other things):
17
18 * Most type annotations are enforced at runtime (raising ``TypeError`` on mismatch)
19
20 * Classes are compiled into extension classes without ``__dict__``
21   (much, but not quite, like if they used ``__slots__``)
22
23 * Monkey patching doesn't work
24
25 * Instance attributes won't fall back to class attributes if undefined
26
27 * Also there are still a bunch of bad bugs and unsupported features :)
28
29Compiled modules can import arbitrary Python modules, and compiled modules
30can be used from other Python modules.  Typically mypyc is used to only
31compile modules that contain performance bottlenecks.
32
33You can run compiled modules also as normal, interpreted Python
34modules, since mypyc targets valid Python code. This means that
35all Python developer tools and debuggers can be used.
36
37macOS Requirements
38------------------
39
40* macOS Sierra or later
41
42* Xcode command line tools
43
44* Python 3.5+ from python.org (other versions are untested)
45
46Linux Requirements
47------------------
48
49* A recent enough C/C++ build environment
50
51* Python 3.5+
52
53Windows Requirements
54--------------------
55
56* Windows has been tested with Windows 10 and MSVC 2017.
57
58* Python 3.5+
59
60Quick Start for Contributors
61----------------------------
62
63First clone the mypy git repository:
64
65    $ git clone https://github.com/python/mypy.git
66    $ cd mypy
67
68Optionally create a virtualenv (recommended):
69
70    $ virtualenv -p python3 <directory>
71    $ source <directory>/bin/activate
72
73Then install the dependencies:
74
75    $ python3 -m pip install -r test-requirements.txt
76
77Now you can run the tests:
78
79    $ pytest -q mypyc
80
81Look at the [issue tracker](https://github.com/mypyc/mypyc/issues)
82for things to work on. Please express your interest in working on an
83issue by adding a comment before doing any significant work, since
84there is a risk of duplicate work.
85
86Note that the issue tracker is hosted on the mypyc GitHub project, not
87with mypy itself.
88
89Documentation
90-------------
91
92We have some [developer documentation](doc/dev-intro.md).
93
94Development Status and Roadmap
95------------------------------
96
97These are the current planned major milestones:
98
991. [DONE] Support a smallish but useful Python subset. Focus on compiling
100   single modules, while the rest of the program is interpreted and does not
101   need to be type checked.
102
1032. [DONE] Support compiling multiple modules as a single compilation unit (or
104   dynamic linking of compiled modules).  Without this inter-module
105   calls will use slower Python-level objects, wrapper functions and
106   Python namespaces.
107
1083. [DONE] Mypyc can compile mypy.
109
1104. [DONE] Optimize some important performance bottlenecks.
111
1125. [PARTIALLY DONE] Generate useful errors for code that uses unsupported Python
113   features instead of crashing or generating bad code.
114
1156. [DONE] Release a version of mypy that includes a compiled mypy.
116
1177.
118    1. More feature/compatibility work. (100% compatibility with Python is distinctly
119       an anti-goal, but more than we have now is a good idea.)
120    2. [DONE] Support compiling Black, which is a prominent tool that could benefit
121       and has maintainer buy-in.
122       (Let us know if you maintain another Python tool or library and are
123       interested in working with us on this!)
124    3. More optimization! Code size reductions in particular are likely to
125       be valuable and will speed up mypyc compilation.
126
1278.  We'll see! Adventure is out there!
128
129Future
130------
131
132We have some ideas for
133[future improvements and optimizations](doc/future.md).
134