Compare Python Project Scaffolding: Cookiecutter, PyScaffold, PyBuilder, Poetry
This article reviews four popular Python project scaffolding and build tools—Cookiecutter, PyScaffold, PyBuilder, and Poetry—detailing their installation, generated directory structures, and typical make or tox commands, helping developers choose the most suitable workflow for organizing and packaging Python code.
Python has long lacked a de facto standard project management and build tool, resulting in diverse structures.
Unlike Java, which standardized on Maven (and alternatives like Gradle, SBT, etc.), Python's ecosystem offers package managers (pip, pipenv, conda) but no enforced layout.
Typical Python projects still rely on Makefiles, setup.py, build.py, or template tools.
Cookiecutter – a classic Python project layout
$ pip install cookiecutter
$ cookiecutter gh:audreyr/cookiecutter-pypackage
# answer prompts, e.g. project_name [Python Boilerplate]: sampleRunning cookiecutter gh:audreyr/cookiecutter-pypackage generates a project with the following structure:
sample
├── AUTHORS.rst
├── CONTRIBUTING.rst
├── HISTORY.rst
├── LICENSE
├── MANIFEST.in
├── Makefile
├── README.rst
├── docs
│ ├── Makefile
│ ├── authors.rst
│ ├── conf.py
│ ├── contributing.rst
│ ├── history.rst
│ ├── index.rst
│ ├── installation.rst
│ ├── make.bat
│ ├── readme.rst
│ └── usage.rst
├── requirements_dev.txt
├── sample
│ ├── __init__.py
│ ├── cli.py
│ └── sample.py
├── setup.cfg
├── setup.py
├── tests
│ ├── __init__.py
│ └── test_sample.py
└── tox.iniThe layout includes a sample source package, a tests directory, docs, and build files such as setup.py and Makefile. Build can be driven by make commands (clean, lint, test, coverage, docs, dist, install).
PyScaffold – creating a project
$ pip install pyscaffold
$ putup samplePyScaffold creates a similar layout but places source code under a src directory.
sample
├── AUTHORS.rst
├── CHANGELOG.rst
├── CONTRIBUTING.rst
├── LICENSE.txt
├── README.rst
├── docs
│ ├── Makefile
│ ├── _static
│ ├── authors.rst
│ ├── changelog.rst
│ ├── conf.py
│ ├── contributing.rst
│ ├── index.rst
│ ├── license.rst
│ ├── readme.rst
│ └── requirements.txt
├── pyproject.toml
├── setup.cfg
├── setup.py
├── src
│ └── sample
│ ├── __init__.py
│ └── skeleton.py
├── tests
│ ├── conftest.py
│ └── test_skeleton.py
└── tox.iniBuilding and testing is performed with tox, which creates isolated virtual environments.
$ tox -av
# shows default, build, clean, docs, doctests, linkcheck, publish, etc.Specific tasks can be run with tox -e build, tox -e docs, and so on.
PyBuilder
$ pip install pybuilder
$ mkdir sample && cd sample
$ pyb --start-project
# answer prompts, project files are createdPyBuilder generates a Maven‑like structure and defines tasks in build.py. Common tasks include analyze, compile_sources, test, package, and publish. Tasks can be listed with pyb -t and executed with pyb.
Poetry
$ pip install poetry
$ poetry new samplePoetry creates a minimal layout and stores all configuration in pyproject.toml, which also manages dependencies (e.g., poetry add boto3) and builds wheels.
$ poetry build
$ poetry shell
$ poetry run pytestPoetry does not generate documentation or coverage reports automatically; those must be invoked via poetry run with tools such as Sphinx or coverage.
Overall, the complexity of the generated project structure decreases from Cookiecutter → PyScaffold → PyBuilder → 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.
