Creating Python Modules

Dave Kuhlman dkuhlman at rexx.com
Thu Mar 25 20:41:19 EST 2004


Adam T. Gautier wrote:

> Greetings,
> 
> I am trying to create a python module for a series of class files
> that because of their size I have divided into multiple files.
> 
> class Foo --> foo.py
> class Boo --> boo.py
> 
> I have created a setup.py where I have for the "py_modules=['foo',
> 'boo']".  when I run "%>./setup.py install" it copies all *.py and
> *.pyc to /usr/lib/python2.2/site-packages.
> 
> When I goto use the module I have to use:
> 
> import foo
> import boo
> 
> I would like if anyone could help me to be able to:
> 1.)  Get the *.py and *.pyc (foo and boo) generated with the
> install to install to "/usr/lib/python2.2/site-packages/mymodule".

I think you want to include the "packages" option or the
"package_dir" option in your setup.py.

See section "3.1 Listing whole packages" in "Distributing Python
Modules" at:

    http://www.python.org/doc/current/dist/dist.html


Dave

-- 
http://www.rexx.com/~dkuhlman
dkuhlman at rexx.com



More information about the Python-list mailing list