There definitely isn’t one standard (you can find some very long discussions about this state of affairs :sweat_smile: ). There are a lot of options, catering to different styles or sets of requirements. One resource I think is useful for something-like-a-standard is packaging.python.org. It focuse… Answer from jamestwebber on discuss.python.org
🌐
The Hitchhiker's Guide to Python
docs.python-guide.org › writing › structure
Structuring Your Project — The Hitchhiker's Guide to Python
Ravioli code is more likely in Python: it consists of hundreds of similar little pieces of logic, often classes or objects, without proper structure. If you never can remember, if you have to use FurnitureTable, AssetTable or Table, or even TableNew for your task at hand, then you might be swimming in ravioli code. Python modules are one of the main abstraction layers available and probably the most natural one. Abstraction layers allow separating code into parts holding related data and functionality. For example, a layer of a project can handle interfacing with user actions, while another would handle low-level manipulation of data.
🌐
Real Python
realpython.com › ref › best-practices › project-layout
project layout | Python Best Practices – Real Python
When laying out Python projects, you can summarize the best practices as follows: Use a clear top-level structure: At the root of your project, keep the most important files that describe and configure the project: pyproject.toml, README.md, ...
Discussions

Python project structure
Hello, I am a programmer with experience in multiple of programming languages, but not yet in python. I want to start a bigger project, but while googling I find a lot of conflicting advice on how to structure it. Can someone provide me a few links to what’s the standard today, if there even ... More on discuss.python.org
🌐 discuss.python.org
6
1
October 13, 2023
Describe python "project" structure
Would it be possible for somebody very briefly describe what each folder in python file structure does ? I can deduct that “src” contains source files… What I do not get is - what contains GUI (windows) _ and what contains code which does processing and why. More on discuss.python.org
🌐 discuss.python.org
19
0
July 4, 2023
What are the best practices for structuring a Python project as a beginner?
Pick the target first: script / package / web app. Structure depends on how you’ll run + share it. Default starter layout (works for most): README.md , .gitignore, pyproject.toml (or requirements.txt) src// (your code), tests/ (even 1–2 tests), data/ or assets/ (optional) Naming: snake_case for files + functions, CamelCase for classes (PEP 8). Dependencies: use a virtual environment; pin versions once it works. Keep main thin: main.py (or __main__.py) = parse input → call functions → print/output. Refactor when it hurts: don’t “enterprise-template” a beginner project; split files when they get messy. More on reddit.com
🌐 r/learnpython
15
59
December 23, 2025
What is the best project structure for a Python application? - Stack Overflow
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 More on stackoverflow.com
🌐 stackoverflow.com
🌐
Python.org
discuss.python.org › python help
Python project structure - Python Help - Discussions on Python.org
October 13, 2023 - Hello, I am a programmer with experience in multiple of programming languages, but not yet in python. I want to start a bigger project, but while googling I find a lot of conflicting advice on how to structure it. Can…
🌐
Medium
medium.com › @adityaghadge99 › python-project-structure-why-the-src-layout-beats-flat-folders-and-how-to-use-my-free-template-808844d16f35
Python Project Structure: Why the ‘src’ Layout Beats Flat Folders (and How to Use My Free Template) | by Aditya Ghadge | Medium
May 17, 2025 - This layout isn’t magic, but it’s been “just structured enough” for everything from tiny utilities to multi-service RAG pipelines. Copy it, tweak it, and you’ll spend more time coding features — less time chasing folders. A tidy tree is great, but without the right automation glue it’s easy to slip back into chaos. Here are the four guard-rails baked into the template repo (check them out live in the workflow files and configs at Adityag009/python-project-template):
🌐
Dagster
dagster.io › blog › python-project-best-practices
How to Structure Python Projects
March 21, 2023 - You can start by creating separate folders for different parts of the project, such as one for the code itself, one for data, one for testing, and one for project documentation. This way to structure will help you find what you need more quickly ...
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.
🌐
Python By Night
pythonbynight.com › blog › starting-python-project
Organizing and Structuring Your Python Project
July 11, 2022 - I briefly wrote about this before, but I want to reiterate here. In almost every case, you want to ensure you have a virtual environment created for your project. Using python -m venv .venv (or python3 -m venv .venv if you're on a Mac) should do the trick.
🌐
pyOpenSci
pyopensci.org › python-package-guide › package-structure-code › python-package-structure.html
Python Package Structure & Layout — Python Packaging Guide
tests/ This directory contains the tests for your project code. In a src/ layout, tests are normally included at the same directory level as the src/ folder. src/package/: this is the directory that contains the code for your Python project.
🌐
Python.org
discuss.python.org › python help
Describe python "project" structure - Python Help - Discussions on Python.org
July 4, 2023 - Would it be possible for somebody very briefly describe what each folder in python file structure does ? I can deduct that “src” contains source files… What I do not get is - what contains GUI (windows) _ and what contains code which does processing and why.
🌐
Reddit
reddit.com › r/learnpython › what are the best practices for structuring a python project as a beginner?
r/learnpython on Reddit: What are the best practices for structuring a Python project as a beginner?
December 23, 2025 -

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!

Top answer
1 of 11
50
Pick the target first: script / package / web app. Structure depends on how you’ll run + share it. Default starter layout (works for most): README.md , .gitignore, pyproject.toml (or requirements.txt) src// (your code), tests/ (even 1–2 tests), data/ or assets/ (optional) Naming: snake_case for files + functions, CamelCase for classes (PEP 8). Dependencies: use a virtual environment; pin versions once it works. Keep main thin: main.py (or __main__.py) = parse input → call functions → print/output. Refactor when it hurts: don’t “enterprise-template” a beginner project; split files when they get messy.
2 of 11
11
First: Read PEP8. That's the python style guide, and you should (generally) just follow how it styles things. Pick your linter of choice, install in your editor, profit by having your code look nicer - and look like what most other FOSS projects look like. OK, you can skim PEP8 to start with. But it has both rules/examples of naming , structuring, etc. in python, and it has explanations of why the python core community uses those rules. Second: Read up about python virtual environments. There are a bunch of tools (you'll need to pick one) that help manage the environment around a new tool; while you may not need many of the features as a newbie, setting one up is worth the time, because that's how most larger projects structure things. They also often have examples of how to setup projects, directories, init files, etc. that are good to review. Just don't use conda, since I wouldn't trust their licensing long-term. One team I work with uses uv,which serves as an environment manager (which lets you have different versions of python, and chooses the right one - very important for older macs, that come with an ancient system python version), and also serve as a dependency manager - which helps find any libraries you're importing and manages dependency versions for you. You don't need to worry about dependency management now, but if you set one up now, you'll be pleasantly surprised later when you build a bigger tool, and it "just works" when you start importing more libraries.
🌐
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
🌐
Away With Ideas
awaywithideas.com › the-optimal-python-project-structure
The optimal python project structure | Away With Ideas
March 21, 2020 - Since the source code is the most important part of our project, let’s start by adding a package to our project structure. The package needs to contain at least an __init__.py file. This tells python that this directory is indeed a package. When python loads this package, it automatically runs the __init__.py.
🌐
Python
peps.python.org › pep-0008
PEP 8 – Style Guide for Python Code | peps.python.org
Avoid trailing whitespace anywhere. Because it’s usually invisible, it can be confusing: e.g. a backslash followed by a space and a newline does not count as a line continuation marker. Some editors don’t preserve it and many projects (like CPython itself) have pre-commit hooks that reject it.
🌐
Towards Data Science
towardsdatascience.com › home › programming › the good way to structure a python project
The Good way to structure a Python Project | Towards Data Science
February 9, 2022 - In order to keep your project space running, it's a good idea to create a virtual environment and keep your dependencies isolated. You can use the venv module of Python and specify the Python version and the environment name.
🌐
SciPy
scipy.org
SciPy
Foundational Extends NumPy providing additional tools for array computing and provides specialized data structures, such as sparse matrices and k-dimensional trees. Performant SciPy wraps highly-optimized implementations written in low-level languages like Fortran, C, and C++. Enjoy the flexibility of Python with the speed of compiled code.
🌐
Datalumina
python.datalumina.com › practical python › project structure
Project structure - Python for AI Beginner Course
October 13, 2025 - You already have a python-for-ai workspace from the beginning of the course. Let’s create a folder for this project: ... python-for-ai/ ├── hello.py # Your existing practice file └── sales-analysis/ # New project folder ├── data/ # CSV files and data └── output/ # Generated files
🌐
Real Python
realpython.com › python-application-layouts
Python Application Layouts: A Reference – Real Python
April 23, 2026 - You’ll see examples of common Python application structures, including command-line applications (CLI apps), one-off scripts, installable packages, and web application layouts with popular frameworks like Flask and Django. Note: This reference guide assumes a working knowledge of Python modules and packages. Check out our introduction to Python modules and packages for a refresher if you’re feeling a little rusty. Take the Quiz: Test your knowledge with our interactive “Python Project Structure: How to Choose the Right Layout” quiz.