Python project structure
Describe python "project" structure
What are the best practices for structuring a Python project as a beginner?
What is the best project structure for a Python application? - Stack Overflow
How to structure backend Python project?
I'm a beginner in Python and am eager to start my first project, but I'm unsure how to structure it effectively. I've read about the importance of organizing files and directories, but I still feel overwhelmed. What are the best practices for structuring a Python project? Should I use specific naming conventions for files and folders? How should I manage dependencies, and is there a recommended folder structure for modules, tests, and resources? I'm hoping to hear from experienced Python developers about their approaches and any tips that could help me create a clean and maintainable project. Any resources or examples would also be greatly appreciated!
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.
/scriptsor/binfor that kind of command-line interface stuff/testsfor your tests/libfor your C-language libraries/docfor most documentation/apidocfor 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/baz
I 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