/pants-cython-minimal-example

Minimal project showcasing Pants' Cython support

Primary LanguageShellMIT LicenseMIT

pants-cython-minimal-example

Minimal project showcasing Pants' Cython support

Project Structure

src/python/app contains a minimal Python project. It has a pex_binary target.

src/python/my_extensions contains minimal Cython sources (the code is from their example).

The goal is to use the hello wheel as a dependency of app.

Building the Cython package

Running ./pants package src/python/my_extensions:dist will build a wheel in the dist/ folder.

pip install dist/GENERATED_WHEEL will install the hello package in the current environment.

>>> import hello
>>> hello.say_hello_to("Cython")
# if "NOT COMPILED" is printed here, for some reason the code is interpreted
Hello Cython!

TODO

  • Build wheels from .pyx files
  • Build wheels (?) that support Pure Python mode
  • Run Pexes that depend on Cython code