How directory is organized
There are already some common directory structures for how to organize a better Python project directory structure. On this issue of StackOverflow, we can see the discussion of the Python directory structure.
This is already very good, I do not intend to rebuild the wheel to enumerate the different ways, which I say my understanding and experience.
Assuming that your project is named Foo, I would recommend the most convenient and quick directory structure that would suffice:
Foo/|-- bin/| |-- foo||-- foo/| |-- tests/| | |-- __init__.py| | |-- test_main.py| || |-- __init__.py| |-- main.py||-- docs/| |-- conf.py| |-- abc.rst||-- setup.py|-- requirements.txt|-- README
Briefly explain:
bin/
: Store some executable files of the project, of course you can name and script/
so on.
foo/
: stores all source code for the project. (1) All modules and packages in the source code should be placed in this directory. Do not place the top level directory. (2) Its subdirectory tests/
holds unit test code, and (3) The entrance of the program is preferably named main.py
.
docs/
: Store some documents.
setup.py
: Install, deploy, and package the scripts.
requirements.txt
: A list of external Python packages that store software dependencies.
README
: Project description file.
Python Software directory structure