title: How should I structure a Python package that contains Cython code
body: <p>I'd like to make a Python package containing some <a href="http://cython.org/" rel="noreferrer">Cython</a> code. I've got the the Cython code working nicely. However, now I want to know how best to package it.</p>
  
  <p>For most people who just want to install the package, I'd like to include the <code>.c</code> file that Cython creates, and arrange for <code>setup.py</code> to compile that to produce the module. Then the user doesn't need Cython installed in order to install the package.</p>
  
  <p>But for people who may want to modify the package, I'd also like to provide the Cython <code>.pyx</code> files, and somehow also allow for <code>setup.py</code> to build them using Cython (so those users <em>would</em> need Cython installed).</p>
  
  <p>How should I structure the files in the package to cater for both these scenarios?</p>
  
  <p>The <a href="http://docs.cython.org/src/userguide/source_files_and_compilation.html#distributing-cython-modules" rel="noreferrer">Cython documentation gives a little guidance</a>. But it doesn't say how to make a single <code>setup.py</code> that handles both the with/without Cython cases.</p>