PyMill

an idea for a Cython branch

setup.py

from mill import distutils

version    = 'Trunk'
extensions = []

# we'll ignore library lookups and frameworks in this mockup
# I'm also writing this out directly whereas this could be in a loop
# drawing from some simple dict data

extensions.append(
  Extension(
    name         = 'bodies',
    sources = (
      'src/bodies/Body.pxi',
      'src/bodies/Camera.pxi',
      'src/bodies/Light.pxi'),
    extra_compile_args = (
      '-I', '/usr/include/glib-2.0'
      # etc just as current, or even paired down
    )
    libraries    = ('GLEW', 'GL', 'ode'),
  )
)

# setup section unchanged

In the above, the sources dictates which files will be compiled, which the processed .c's are appended to the Extension's sources= regardless of whether they're regenerated. Since .c generation is internal we can continue having one .c per extension right now and migrate to one .c per source file later (this will make debugging easier).

Note that this data obsoletes about 100 lines of setup.py which checks file last modified dates; a more robust checking (only regenerating what's needed when something changes) could even be implemented internally to PyMill.

The generated .c files can also go into build/mill/ or similar which makes things cleaner, the location is non-important to setup.py since it'd be handled internally.

Source would continue to be laid out just as it is now, or really in any fashion a project using PyMill prefers, but without the need for all the .pyx files which do nothing but include .pxi files, and eventually without the need for .pxd files either.

We'll migrate .pxi files (which Pyrex doesn't care about the extension of) to .pym (PyMill) during this process.  Minneapolis Web Design