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 β”‚ β”‚ β”œβ”€β”€ ...
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
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
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.
Find elsewhere
🌐
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 β€Ί 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
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 β€Ί 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
🌐
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 ...
Starred by 2 users
Forked by 3 users
🌐
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
🌐
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.
🌐
Goodresearch
goodresearch.dev β€Ί setup.html
Set up your project β€” Good research code
If doing all this for every new project sounds like a lot of work, you can save yourself some time using the true neutral cookiecutter, which creates the project skeleton outlined above automatically. cookiecutter is a Python tool which generates project folders from templates. You can install it in the base conda environment with: ... There are many other interesting cookiecutters. Check out the data science cookiecutter for a more elaborate data science project template. This will create an instance of the true-neutral-cookiecutter project skeleton, which is hosted on my personal github. Follow the prompts and it will create the folder structure above, including the setup file.