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