Project structure - Best practices

Jean-Paul Calderone exarkun at divmod.com
Sun Nov 30 17:48:46 CET 2008


On Sun, 30 Nov 2008 17:43:46 +0100, Filip Gruszczyński <gruszczy at gmail.com> wrote:
>This is first time that I am building python application that is
>larger than a single module and I would like to do it right. I google
>it a bit, finding some stuff about not using src directory (which I
>have seen so many times, that I believed it be standard) and using
>packages. Still, there are few things, that I would like to achieve
>with this structure:
>* being able to use pychecker a lot - catching all typos in one shot
>instead of running app many times really saves me a lot of time
>* being able to write some unit tests
>* having clean division of code among packages and modules (I have
>seen some projects, where modules are pretty large - I would like to
>keep them logically divided, event if they stay smaller)
>
>My project is a tool for people interested in role playing games. My
>current structure looks something like this:
>
>/src
>rpgDirectory.py (main script, running the app)
>
>src/rpg
>plans.py
>support.py
>gui.py
>iosystem.py
>
>src/rpg/character
>model.py
>sheet.py
>gui.py
>handlers.py
>requirements.py
>
>The problem is, that modules from src/rpg/character use classes
>defined in support.py. Therefore I have to use absolute paths to
>import it and this works only, when I run rpgDirectory.py. When I use
>pychecker, it can't import this module and fails. Any suggestions, how
>can I avoid this and what structure should I use?
>

http://jcalderone.livejournal.com/39794.html

Jean-Paul



More information about the Python-list mailing list