CodePy is a C/C++ metaprogramming toolkit for Python. It helps you compile source code and dynamically load it into the Python interpreter. This facility also works in conjunction with with PyCuda. Dynamic compilation and linking are so far only supported in Linux with the GNU toolchain.
See also the documentation and the git tree.