This is likely dependent on what you are building. The article I linked in my comment breaks out different layouts like so:

CLI Layouts:

  • One-Off Script
  • Installable Single Package
  • Application with Internal Packages

Web App Layouts:

  • Django
  • Flask

While link only answers are discouraged here, I think its counter productive to rehash the whole article but the "Installable Single Package" layout has worked for me and looks like this (borrowed from the same article):

helloworld/
β”‚
β”œβ”€β”€ helloworld/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ helloworld.py
β”‚   └── helpers.py
β”‚
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ helloworld_tests.py
β”‚   └── helpers_tests.py
β”‚
β”œβ”€β”€ .gitignore
β”œβ”€β”€ LICENSE
β”œβ”€β”€ README.md
β”œβ”€β”€ requirements.txt
└── setup.py

NOTE: If you have a data directory, I would put it at the same level as tests

Answer from General4077 on Stack Overflow
🌐
GitHub
github.com β€Ί nedbat β€Ί pkgsample
GitHub - nedbat/pkgsample: A simple example of how to structure a Python project Β· GitHub
You should examine the files here, decide which are right for you, and adapt them to your needs. This directory is where you put your code. It should have one subdirectory named for your project, and all of your work goes into that subdirectory.
🌐
GitHub
github.com β€Ί csymvoul β€Ί python-structure-template
GitHub - csymvoul/python-structure-template: A Python project to use as a template when developing a Python application Β· GitHub
project β”œβ”€β”€ README.md β”œβ”€β”€ example β”‚ β”œβ”€β”€ __init__.py β”‚ β”œβ”€β”€ package_1 β”‚ β”‚ β”œβ”€β”€ __init__.py β”‚ β”‚ β”œβ”€β”€ awesome_module.py β”‚ β”‚ β”œβ”€β”€ ...
Discussions

Python git project-structure convention? - Stack Overflow
Is there a convention(or even a PEP) on how to structure a python project for example on GitHub? More specifically python-specific files(I know about the README.md, licence, .gitignore-files). I've More on stackoverflow.com
🌐 stackoverflow.com
Where can I learn how to structure a Python project?

I use this sample project on GitHub as a template for my Python projects. The project itself is still actively maintained.

More on reddit.com
🌐 r/learnpython
45
505
June 9, 2020
What’s your approach to organizing Python projects for readability and scalability?
Read software engineering books. The more clean code, design patterns knowledge you have the better. One thing I do is to look at scikit learn source code. It’s very well coded you learn a lot from it. I simply mimic their file and architectural structure. More on reddit.com
🌐 r/Python
29
41
July 1, 2025
Project structure best practices
I wouldn't say there's any one "correct" way to structure a Python project, but I like to think my project templates are close to ideal: Regular: https://github.com/Diapolo10/python-poetry-template Mixed Python-Rust projects: https://github.com/Diapolo10/python-rust-template Of course, in the real world there's all kinds of different needs so it's not like either of these fits every use-case. And I'm only human, there are probably even better ways out there. But they've served me well so far. More on reddit.com
🌐 r/learnpython
8
9
January 28, 2024
Starred by 736 users
Forked by 104 users
Languages: Python 56.6% | Dockerfile 43.4%
🌐
GitHub
github.com β€Ί kengz β€Ί python-structure
GitHub - kengz/python-structure: Sample project structure for a python package.
Sample project structure for a python package, contains all the necessary files to publish a PyPI package.
Starred by 17 users
Forked by 4 users
Languages: Python 100.0% | Python 100.0%
🌐
GitHub
github.com β€Ί charlstown β€Ί Python-Project-Structure
GitHub - charlstown/Python-Project-Structure: A clean and nice way to structure Python projects Β· GitHub
This repository is part of my post: Python Project Structure, where I explain my favorite way to organize and structure Python projects.
Author: charlstown
Find elsewhere
🌐
GitHub
gist.github.com β€Ί ericmjl β€Ί 27e50331f24db3e8f957d1fe7bbbe510
How to organize your Python data science project Β· GitHub
I have a lesson learned from multiple months of working with other people that led me to this somewhat complicated, but hopefully ultimately useful directory structure. Under this folder called projectname/, we put in a lightweight Python package called projectname that has all things that are refactored out of notebooks to keep them clean.
🌐
GitHub
github.com β€Ί bast β€Ί somepackage
GitHub - bast/somepackage: Show how to structure a Python project. Β· GitHub
Show how to structure a Python project. Contribute to bast/somepackage development by creating an account on GitHub.
Author: bast
🌐
GitHub
github.com β€Ί topics β€Ί python-project-template
python-project-template Β· GitHub Topics Β· GitHub
dev_template is a user-friendly tool for setting up new Python projects. It provides a consistent structure, easy to use features, and cross-platform compatibility. This tool is for those of us that are lazy, simplifying the installation of ...
🌐
GitHub
github.com β€Ί pyscaffold β€Ί pyscaffold
GitHub - pyscaffold/pyscaffold: πŸ›  Python project template generator with batteries included
The project template provides you with following features: All configuration can be done in setup.cfg like changing the description, URL, classifiers, installation requirements and so on as defined by setuptools. That means in most cases it is not necessary to tamper with setup.py. In order to build a source or wheel distribution, just run tox -e build (if you don't use tox, you can also install build and run python -m build).
Author: pyscaffold
🌐
GitHub
gist.github.com β€Ί dl6nm β€Ί 858504f58b54f9763cd412e93e6a9a44
Python Project Code Structure, App with internal packages, Β· GitHub
I’ve adapted this from Jean-Paul Calderone’s classic structure post, and his prescriptions for the use of a bin/ directory are still important. The most important point to remember is that your executable shouldn’t have a lot of code, just an import and a call to a main function in your runner script. If you are using pure Python ...
🌐
GitHub
github.com β€Ί realpython β€Ί python-guide β€Ί blob β€Ί master β€Ί docs β€Ί writing β€Ί structure.rst
python-guide/docs/writing/structure.rst at master Β· realpython/python-guide
Thanks to the way imports and modules are handled in Python, it is relatively easy to structure a Python project. Easy, here, means that you do not have many constraints and that the module importing model is easy to grasp.
Author: realpython
Author: rpatterson
🌐
GitHub
github.com β€Ί topics β€Ί project-structure
project-structure Β· GitHub Topics Β· GitHub
All 287 Python 60 TypeScript 44 Go 28 JavaScript 22 Jupyter Notebook 21 Shell 10 HTML 8 C# 7 Java 6 Makefile 5 ... PyTorch Lightning + Hydra. A very user-friendly template for ML experimentation. ⚑πŸ”₯⚑ Β· config template deep-learning best-practices pytorch hydra reproducibility project-structure ...
🌐
GitHub
github.com β€Ί ferdinandvanwyk β€Ί python_project_example
GitHub - ferdinandvanwyk/python_project_example: Simple example of a good project structure with pytest and sphinx implemented Β· GitHub
Simple example of a good project structure with pytest and sphinx implemented Β· Good pytest practises: http://pytest.org/latest/goodpractises.html Β· General Python testing information: http://pythontesting.net/start-here/
Author: ferdinandvanwyk
Starred by 2 users
Forked by 3 users
🌐
GitHub
github.com β€Ί cmabastar β€Ί pyproject
GitHub - cmabastar/pyproject: Python project structure template Β· GitHub
In case you plan on creating a new project/module in python. Sources: http://as.ynchrono.us/2007/12/filesystem-structure-of-python-project_21.html http://stackoverflow.com/questions/193161/what-is-the-best-project-structure-for-a-python-application
Author: cmabastar
🌐
Away With Ideas
awaywithideas.com β€Ί the-optimal-python-project-structure
The optimal python project structure | Away With Ideas
March 21, 2020 - Some examples of .gitignore files can be found in this github repository. I usually start with a small number of files and build gradually. My basic .gitignore might resemble this: # Pycache and compiled python files. __pycache__/ *py[cod] # Jupyter notebook checkpoints .ipynb_checkpoints #Egg info files produced by pip installation *egg-info Β· A readme is a documentation file often written in markdown. It contains useful information so that others can understand what your project is about.