Comparison of Python Project Templates and Build Tools: CookieCutter, PyScaffold, PyBuilder, and Poetry
This article reviews the lack of a standard Python project layout and compares four popular tools—CookieCutter, PyScaffold, PyBuilder, and Poetry—by showing their installation commands, generated directory structures, and typical build/test workflows.
Python has never settled on a single, de‑facto standard for project layout and build automation, which leads to many different structures and tools. Unlike Java, which converged on Maven’s conventions, Python’s ecosystem offers several independent solutions.
The article introduces four widely used tools for creating and managing Python projects: CookieCutter, PyScaffold, PyBuilder, and Poetry. For each tool it shows how to install it, generate a sample project, and the typical directory tree produced.
CookieCutter
Install and generate a project from the popular audreyr/cookiecutter-pypackage template:
$ pip install cookiecutter
$ cookiecutter gh:audreyr/cookiecutter-pypackageAfter answering the prompts, the generated layout looks like:
$ tree sample
sample
├── AUTHORS.rst
├── CONTRIBUTING.rst
├── HISTORY.rst
├── LICENSE
├── MANIFEST.in
├── Makefile
├── README.rst
├── docs
│ ├── Makefile
│ ├── authors.rst
│ ├── conf.py
│ ├── ...
├── requirements_dev.txt
├── sample
│ ├── __init__.py
│ ├── cli.py
│ └── sample.py
├── setup.cfg
├── setup.py
├── tests
│ ├── __init__.py
│ └── test_sample.py
└── tox.iniTypical build commands are executed via make (e.g., make test , make coverage , make docs , make dist ) after installing supporting packages such as tox , wheel , coverage , sphinx , and flake8 with pip .
PyScaffold
Install and create a project with:
$ pip install pyscaffold
$ putup samplePyScaffold places source files under a src directory:
$ tree sample
sample
├── AUTHORS.rst
├── CHANGELOG.rst
├── ...
├── pyproject.toml
├── setup.cfg
├── setup.py
├── src
│ └── sample
│ ├── __init__.py
│ └── skeleton.py
├── tests
│ ├── conftest.py
│ └── test_skeleton.py
└── tox.iniAll build and test actions are driven by tox , which creates isolated virtual environments for each task.
PyBuilder
Install and start a project:
$ pip install pybuilder
$ mkdir sample && cd sample
$ pyb --start-projectThe resulting layout is Maven‑like:
$ tree sample
.
├── build.py
├── docs
├── pyproject.toml
├── setup.py
└── src
├── main
│ ├── python
│ └── scripts
└── unittest
└── pythonTasks are listed with pyb -t sample and can be run individually (e.g., pyb run_unit_tests ). Dependencies are declared inside build.py using project.depends_on(...) .
Poetry
Install and create a new project:
$ pip install poetry
$ poetry new sampleThe minimal structure is:
$ tree sample
sample
├── README.rst
├── pyproject.toml
├── sample
│ └── __init__.py
└── tests
├── __init__.py
└── test_sample.pyPoetry manages dependencies and packaging via the pyproject.toml file (similar to Node’s package.json ). Common commands include poetry add , poetry install , poetry build , poetry run pytest , and poetry run my-script for executing scripts defined under [tool.poetry.scripts] .
Overall, the complexity of the generated project structure decreases from CookieCutter to PyScaffold, PyBuilder, and finally Poetry, while the learning curve follows the same order.
Python Programming Learning Circle
A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.