GitHub - APrioriInvestments/typed_python: An llvm-based framework for generating and calling into high-performance native code from Python. | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

APrioriInvestments/typed_python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

An llvm-based framework for generating and calling into high-performance native code from Python.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 11

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.