[Distutils] layout and setup.py for packaging documentation

Jean Daniel jeandaniel.browne at gmail.com
Sun Feb 28 22:03:16 CET 2010


Hello,

I am looking for the simplest way to package the html files related to
a pure python module. At this point, I would like to just embed them
in the source tarball generated by distribute and leave it to a debian
or fedora package to install them. I would like a source tarball laid
out as the following:

    wordish-1.0.2/
        setup.py
        wordish.py
        docs/
            index.html
            command-ref.html

So far, I tended to use a single file python module because there was
no need for more and I wanted to keep it simple:

    wordish/
        setup.py
        wordish.py
        test_wordish.py

The setup.py is minimal:  setup( py_modules = [ 'wordish' ], ... )

But If I want to include docs, I must use the package_data command
which expects a package name. So I think that to embed documentation
in the source tarball, I should change the way I lay out the source
repository to something like  :

    wordish/
        setup.py
        wordish
            wordish.py
            __init__.py
            docs/
                index.html
                command-ref.html
       test_wordish.py

The corresponding setup.py would be

setup(
    packages = [ 'wordish' ],
    package_data = {'wordish':['docs/*']}, ...

I am not sure this is the right way to do it, just to include
documentations in the tarball:

- the package_data requires a package name, so I turn my pure python
module into a package just for this reason

- package_data requires the data directory to be inside the package
directory even though the html files are generated from doc sources
located elsewhere,

- there is an extra level of directory to get to the Python sources
module, it is my_virtualenv/wordish/wordish/wordish.py which does not
add much.

Can this be simpler?

Thanks for your help,


More information about the Distutils-SIG mailing list