Writing Python packages with multiple C modules -


I am writing a Python C extension which uses pygame C API. So far, so good. Now I wonder how I can organize my source code so that there are many submodule in my package. All tutorials focus on one file extension. I tried to see some projects setup.py files but they blurred my mind with complexity, and I could not see the forest for trees.

Actually, I have an extension, MyAst MyExt has global functions, and 3 types is how do I go about organizing PyMethodDef lists? Do I have to keep them all in one list? Alternatively, I've found that the setup object that you've passed in the setup function, this is an array of operations module, so how can I do the name module so that they all have one package Can you see each other? / P>

My setup.py:

  main_mod = Extension ('modname', include_dirs = ['C: \ libraries \ Boost \', 'C: \ libraries \ SDL \ 'Library \ SDL \ lib', 'C: \ Library \ SDL_image \', \ c: \ library \ SDL_image \ include '], libraries = [' libSDL ',' SDL_image '], library_dirs = lib'], sources [['Main CPP', 'Object 1 CPP', 'Object 2 CPP', 'Atkestera CPP'])  

So when I call: Setup (name = "Some humans Readable name, right? ", Ext_modules = [main_mod]) I have other modules for ext_modules Can add to the list but what do I pass as the first parameter of 'Extension'? Do I have to use dot-separated string like 'mypackage.submodule'?

More generally, how can I organize the C extension with a single extension? If someone can point me to a source code that can be read and understood easy , it would be great. Thanks a lot!

I think the easiest way to do this would be to create a "pure" package, "Python"; other words In, create mypackage / , create an empty mypackage / __init __.py , and then your extension module on mypackage / module1.so

If you want it in mypackage instead of being blank, you can switch it to another You can import your __ init __.py in

Module

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -