Imagine that you want to develop a non-trivial end-user desktop (not web) application in Python. What is the best way to structure the project's folder hierarchy?
Desirable features are ease of maintenance, IDE-friendliness, suitability for source control branching/merging, and easy generation of install packages.
In particular:
Doesn't too much matter. Whatever makes you happy will work. There aren't a lot of silly rules because Python projects can be simple.
/scripts or /bin for that kind of command-line interface stuff/tests for your tests/lib for your C-language libraries/doc for most documentation/apidoc for the Epydoc-generated API docs.And the top-level directory can contain README's, Config's and whatnot.
The hard choice is whether or not to use a /src tree. Python doesn't have a distinction between /src, /lib, and /bin like Java or C has.
Since a top-level /src directory is seen by some as meaningless, your top-level directory can be the top-level architecture of your application.
/foo/bar/bazI recommend putting all of this under the "name-of-my-product" directory. So, if you're writing an application named quux, the directory that contains all this stuff is named /quux.
Another project's PYTHONPATH, then, can include /path/to/quux/foo to reuse the QUUX.foo module.
In my case, since I use Komodo Edit, my IDE cuft is a single .KPF file. I actually put that in the top-level /quux directory, and omit adding it to SVN.
According to Jean-Paul Calderone's Filesystem structure of a Python project:
Project/ |-- bin/ | |-- project | |-- project/ | |-- test/ | | |-- __init__.py | | |-- test_main.py | | | |-- __init__.py | |-- main.py | |-- setup.py |-- README
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With