Domanda

I'm quite new to Cython, and I come from a web development background. I'm wondering if there's is a workflow for Cython development that's similar to workflows I'm familiar with from web development.

For example, when using CoffeeScript to develop a Node.js web app, I have a Cakefile that watches for changes in the CoffeeScript source and automatically compiles the source to Javascript every time a .coffee file is written.

What is the proper way to accomplish something similar in a Cython development environment?

È stato utile?

Soluzione

First of all, from my experience this kind of workflow is not particularly customary outside web development. However, there are a couple of options that come at least close to what you ask for.

You may want to use some sort of automated build tool like SCons. The Cython developers even provide a build tool for it.

Then there is setuptools/distutils, which are mostly for packaging Python software but also support building C extensions. I think, this is even the canonical way of building Cython source into shared objects.

There is another alternative also part of Cython itself: using pyximport you can simply import Cython modules like so:

import pyximport; pyximport.install()
import foo

You don't have to worry about compilation then, since pyximport automatically compiles the module on import if necessary.

I hope one of these options at least resembles what you were looking for ;)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top