Mypyc: Compile type-annotated Python to C

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • mypy

    Optional static typing for Python

  • mypyc

    Compile type annotated Python to fast C extensions

  • 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.

  • 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.

    InfluxDB logo
  • typed_python

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

  • 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

  • mypyc-benchmark-results

    Mypyc benchmark result data

  • https://github.com/mypyc/mypyc-benchmark-results/blob/master...

  • pex

    A tool for generating .pex (Python EXecutable) files, lock files and venvs.

  • 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

  • pyccel

    Python extension language using accelerators

  • 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.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts