8.1 Pure Python distribution (by module)
If you're just distributing a couple of modules, especially if they don't live in a particular package, you can specify them individually using the py_modules option in the setup script.
In the simplest case, you'll have two files to worry about: a setup script and the single module you're distributing, foo.py in this example:
<root>/ setup.py foo.py
<root>
will refer to the
distribution root directory.) A minimal setup script to describe this
situation would be:
from distutils.core import setup setup(name='foo', version='1.0', py_modules=['foo'], )
Since py_modules is a list, you can of course specify multiple modules, eg. if you're distributing modules foo and bar, your setup might look like this:
<root>/ setup.py foo.py bar.py
from distutils.core import setup setup(name='foobar', version='1.0', py_modules=['foo', 'bar'], )
You can put module source files into another directory, but if you have enough modules to do that, it's probably easier to specify modules by package rather than listing them individually.
See About this document... for information on suggesting changes.