Organizing a Python project

Casey McGinty casey.mcginty at gmail.com
Sun May 25 18:46:50 EDT 2008


On Sat, May 24, 2008 at 2:11 PM, Gabriel Genellina <gagsl-py2 at yahoo.com.ar>
wrote:

> > 2. In the top of your package directory it is typical to have a module
> name
> > '_package.py'. This is ideally where the main command line entry point
> for
> > the package code should be placed.
>
> Why the underscore? And I usually don't put executable scripts inside a
> package - I consider them just libraries, to be imported by other parts of
> the application.
> It's easier to test too when your tests *and* the application code are
> external to the package itself.
>

Ok, guess using the '_package' name is not very common. I saw it used by the
dbus module. My whole concern here is that using a script will fragment your
application code across the file system. I would prefer to have it all in a
single spot. So I still like they idea of keeping most of application code
(argument parsing, help output, initialization) inside of the package. The
'_' should indicate that any other modules using your package should import
that module.

- Casey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080525/206b40aa/attachment.html>


More information about the Python-list mailing list