- Notifications
You must be signed in to change notification settings - Fork47
Compile type annotated Python to fast C extensions
mypyc/mypyc
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Mypyc compiles Python modules to C extensions. It uses standard Pythontype hints togenerate fast code. Mypyc usesmypy toperform type checking and type inference.
Mypyc can compile anything from one module to an entire codebase. Themypy project has been using mypyc to compile mypy since 2019, givingit a 4x performance boost over regular Python.
- Support most features in the stdlib
typingmodule - Compile clean, regular-looking Python code with type annotations
- Expressive type system, including generics, optional types, union types and tuple types
- Powerful type inference -- no need to annotate most variables
- All code is valid Python, and all Python editors and IDEs work just fine
- Access to all stdlib and third-party libraries in compiled code
- Strict runtime enforcement of type annotations for runtime type safety
- Ahead-of-time compilation for fast program startup
- Compiled code runs as normal Python code (compilation is optional)
- Both static type checking (via mypy) and runtime type checking
Documentation is available atReadTheDocs.
We track the performance of mypyc usingseveral benchmarks. Results areupdated daily to make it easy to track progress.
The mypycissue tracker lives in thisrepository. You can also ask questions in ourGitter chat.
- Write clean code without non-standard syntax, such as
cpdef, orextra decorators, with good performance. - First-class support for type system features such as tuple types,union types and generics.
- Variable type annotations are not needed for good performance, due topowerful type inference provided by mypy.
- Full integration with mypy for robust and seamless static typechecking.
- Mypyc performs strict enforcement of type annotations at runtime,for better runtime type safety.
These are our near-term focus areas for improving mypyc:
- Improved compatibility with Python
- Much faster compilation (parallel and incremental compilation, and more)
- Usability
... and better performance (always!).
We are actively looking for early adopters! Mypyc is currently alphasoftware. It's only recommended for production use cases with carefultesting, and if you are willing to contribute fixes or to work aroundissues you will encounter.
New contributors are very welcome! Any help in development, testing,documentation and benchmarking tasks is highly appreciated.
Useful links for contributors:
The code lives in themypyc subdirectory of themypy repository.
We havedeveloper documentation.
Use theissue tracker to find thingsto work on.
You can ask questions in ourGitter chat.
Follow our updates on the mypy blog:https://mypy-lang.blogspot.com/
Mypyc and mypy are licensed under the terms of the MIT License, with portions underthe Python Software Foundation license (seethe fileLICENSEin the mypy repository).
About
Compile type annotated Python to fast C extensions
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.