Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
typed_python
An llvm-based framework for generating and calling into high-performance native code from Python.
As a bit of background info, mypyc is “not really” ready for broader use yet. The devs are planning a soft-launch: https://github.com/mypyc/mypyc/issues/780
It is quite promising though, if it becomes more robust and compatible. I also believe they have still only scratched the surface of possible optimizations.
I am always keeping and eye on mypyc, typed_python (llvm Python compiler)[0] and nuitka[1]
I guess that because Python is extremely dynamic, we may never have a full everything-works compiler, but I’m excited about the possibility of this becoming some kind of intermediate step where different parts of the program get compiled when possible.
[0] https://github.com/APrioriInvestments/typed_python
https://github.com/mypyc/mypyc-benchmark-results/blob/master...
Somewhat related, I had a devil of a time a little bit ago trying to ship a small Python app as a fully standalone environment runnable on "any Linux" (but for practical purposes, Ubuntu 16.04, 18.04, and 20.04). It turns out that if you don't want to use pip, and you don't want to build separate bundles for different OSes and Python versions, it can be surprisingly tricky to get this right. Just bundling the whole interpreter doesn't work either because it's tied to a particular stdlib which is then linked to specific versions of a bunch of system dependencies, so if you go that route, you basically end up taking an entire rootfs/container with you.
After evaluating a number of different solutions, I ended up being quite happy with pex: https://github.com/pantsbuild/pex
It basically bundles up the wheels for whatever your workspace needs, and then ships them in an archive with a bootstrap script that can recreate that environment on your target. But critically, it natively supports the idea of targeting multiple OS and Python versions, you just explicitly tell it which ones to include, eg:
--platform=manylinux2014_x86_64-cp-38-cp38 # 16.04
There is also Pyccel https://github.com/pyccel/pyccel. When I last tried it, it worked on most small codes, but there were some bugs.
"The aim of Pyccel is to provide a simple way to generate automatically, parallel low level code. The main uses would be:
Convert a Python code (or project) into a Fortran or C code.
Related posts
- Python programmers prepare for pumped-up performance: Article describes Pyston and plans to upstream Pyston changes back into CPython, plus Facebook's Cinder: "publicly available for anyone to download and try and suggest improvements."
- Static Typing for Python
- Making use of type hints
- WeveAllBeenThere
- Writing Python like it’s Rust