Visitar URL original
GitHub - APrioriInvestments/typed_python: An llvm-based framework for generating and calling into high-performance native code from Python.
The Wayback Machine - https://web.archive.org/web/20200526114512/https://github.com/APrioriInvestments/typed_python
Skip to content
An llvm-based framework for generating and calling into high-performance native code from Python.
Python C++ Other
Branch: dev
Clone or download

Latest commit

Latest commit 06ad713 May 18, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Initial PR template proposal Mar 15, 2019
docs Docs fixup. Mar 29, 2020
typed_python Mark a test flaky. May 18, 2020
.codecov.yml Implement Set compilation and implement missing Set operations. Refs #… May 14, 2020
.gitignore add the test certs to the gitignore Oct 30, 2019
.pre-commit-config.yaml Disabling black code formatter from pre-commit Oct 11, 2019
.travis.yml Repin to flake8 3.7.9. the new version has some bugs. May 13, 2020
AUTHORS Update README.md, AUTHORS, and make sure all files have consistent li… Apr 12, 2019
INSTALLATION.md Updating installation doc with section on Makefile process Mar 18, 2019
LICENSE Initial commit. Sep 19, 2017
MANIFEST.in Update our installation process and pipfile. Oct 9, 2019
Makefile TravisCI TLC Oct 22, 2019
NOTICE Initial commit. Sep 19, 2017
Pipfile Be more careful about the order in which we compile functions. Refs #120 Nov 29, 2019
Pipfile.lock Updated dependencies with `pipenv lock --dev` Apr 28, 2020
README.md Add python 3.7 to the travis matrix. Oct 17, 2019
pyproject.toml Config file for black code formatter Oct 11, 2019
requirements.txt Be more careful about the order in which we compile functions. Refs #120 Nov 29, 2019
setup.py Add python 3.7 to the travis matrix. Oct 17, 2019
sitecustomize.py Get coverage to work with subprocesses Jul 11, 2019
tox.ini Make sure we're compliant with flake 3.8.1. May 12, 2020
unicodeprops.py Make sure we're compliant with flake 3.8.1. May 12, 2020

README.md

Build Status License

typed_python

The typed_python module provides strong runtime types to Python and a compiler that can take advantage of them.

It gives you new types you can use to build strongly- and semi-strongly-typed datastructures, so that your program is easier to understand, and a compiler toolchain that can take advantage of those datastructures to generate machine code that's fast, and that doesn't need the GIL.

typed_python is a standard modules that run on Python 3.6 and higher. You can use it incrementally throughout your project - add a few type constraints here and there, or compile a couple of small but performance-critical functions. As you add more type information, more of your program can be compiled. Everything can still run in interpreter without compilation if you want.

typed_python is generously supported by A Priori Investments, a quantitative hedge fund in New York. If you're interested in working with us, drop us a line at info@aprioriinvestments.com.

Getting started

You can read the introductory tutorial for using typed_python or check out the documentation typed_python.

Where did this come from?

Every time I (Braxton) find myself writing a lot of Python code, I eventually start to miss C++. As my program gets bigger, I find myself losing track of what types are supposed to go where. My code gets littered with 'isinstance' assertions trying to catch mistakes early and provide information about what kinds of types I expect in certain parts of the code. Compilers solve these kinds of problems because the type information is out front directly in the code, and they can find bugs without having to run the program. And of course, I miss the performance you get out of C++ - every time I write some overly complicated numpy code, I think to myself how much easier to understand this code would be if I could only write a loop.

On the other hand, whenever I write a lot of C++, I find myself missing the expressiveness of Python, the ability to iterate without a painful compile cycle, the safety you get from having bad code throw an exception instead of producing a segfault. And of course, nobody likes looking through a ten page error log just to find out that a template parameter is missing.

I developed typed_python to try to have the best of both worlds. typed_python lets me have a single codebase, written entirely in Python, where I can choose, depending on the context, which style of code I want, from totally free-form Python with total type chaos, to statically typed, highly performant code, and anything in between.

You can’t perform that action at this time.