Python and greenlets

  • From: Ryan Day <ryan@xxxxxxxxxxx>
  • To: rumpkernel-users@xxxxxxxxxxxxx
  • Date: Mon, 5 Sep 2016 15:53:09 -0400

I wanted to continue a discussion I was having with Tim Beyer on the users
list just in case anyone else is interested in Python progress:

Greenlets is a Python package that allows concurrent programming in a
manner similar to co-routines: https://greenlet.readthedocs.io/en/latest/

Greenlets is an interesting case study for the Rumpkernel
Python3 package because greenlets requires a C python module to be built
(and available statically). This means you must know that you want to use
greenlets when you first build the Python3 package. It can't be simply
"import"ed later on.

Not everyone wants to have greenlets in their Python build. So adding it to
the official Python3 package isn't necessarily correct. This leaves us with
a need to figure out how to have a modular Python3 package, or some
standard way of including C python packages a la carte.



Anyway.

I've got a branch on my personal repository which has Greenlets as a Work
in Progress <
https://github.com/CuriousLLC/rumprun-packages/tree/python3_greenlets>.

The idea here is that the C files related to greenlets are copied into the
Modules/ directory during the Python3 build process. A line is added to the
Modules/Setup.dist file that builds greenlets along with all the other
builtin packages.

Once the build is complete, greenlets is available as a builtin. The
example in examples/ almost works. I think the final "78" line is not being
printed even though it should be. This brings us to the discussion part,
and why I moved to the list :)

Other related posts: