Backend Development 11 min read

Comparing Python Project Build and Dependency Management Tools: CookieCutter, PyScaffold, PyBuilder, and Poetry

This article reviews four popular Python project scaffolding and build tools—CookieCutter, PyScaffold, PyBuilder, and Poetry—explaining their installation commands, generated directory layouts, build workflows, and how they differ in complexity and feature coverage.

Python Programming Learning Circle
Python Programming Learning Circle
Python Programming Learning Circle
Comparing Python Project Build and Dependency Management Tools: CookieCutter, PyScaffold, PyBuilder, and Poetry

Classic Python Project Structure with CookieCutter

<code>$ pip install cookiecutter
$ cookiecutter gh:audreyr/cookiecutter-pypackage   # answer prompts to generate a project
... 
project_name [Python Boilerplate]: sample
...</code>

CookieCutter creates a conventional Python package layout, including AUTHORS.rst , README.rst , setup.py , a src package, tests , and documentation under docs . The generated Makefile provides common targets such as make test , make coverage , and make docs .

Typical make commands include clean , clean-build , lint , test , coverage , docs , dist , and install . Required auxiliary packages (e.g., tox , wheel , coverage , sphinx , flake8 ) are installed via pip and invoked through the Makefile.

Creating a Project with PyScaffold

PyScaffold is a scaffolding tool that places source files in a src directory instead of the top‑level package folder.

<code>$ pip install pyscaffold
$ putup sample</code>

The resulting layout mirrors CookieCutter's but moves the package under src . Building and testing are driven by tox , which creates isolated virtual environments and runs the defined tasks.

<code>$ tox -av
default environments:
  default -> Invoke pytest to run automated tests
additional environments:
  build   -> Build the package in isolation (PEP517)
  clean   -> Remove old distribution files
  docs    -> Build Sphinx documentation
  publish -> Publish the package to PyPI (default uses TestPyPI)</code>

Project Generation with PyBuilder

PyBuilder follows a Maven‑like approach, generating a directory structure similar to Java projects.

<code>$ pip install pybuilder
$ mkdir sample && cd sample   # create project directory manually
$ pyb --start-project        # answer prompts to create files</code>

The generated tree includes build.py , src , docs , and tests . Build tasks are defined as plugins in build.py and can be listed with pyb -t .

<code>$ pyb -t sample
Tasks found for project "sample":
  analyze, clean, compile_sources, coverage, install, package, prepare,
  publish, run_integration_tests, run_unit_tests, upload, verify</code>

Dependencies are declared inside build.py using project.depends_on() and project.build_depends_on() . The --no-venvs flag can skip virtual‑environment creation.

Managing Projects with Poetry

Poetry is a modern, opinionated tool that centralises configuration in pyproject.toml and provides robust dependency resolution.

<code>$ pip install poetry
$ poetry new sample</code>

The scaffold is minimal, containing README.rst , pyproject.toml , the package directory, and a tests folder. Adding dependencies is as simple as poetry add boto3 , and the lock file ensures reproducible builds.

<code># Build distribution files
poetry build
# Open a shell in the virtual environment
poetry shell
# Run tests with pytest
poetry run pytest
# Export requirements.txt
poetry export --without-hashes --output requirements.txt</code>

Custom scripts can be defined in [tool.poetry.scripts] and executed via poetry run my-script . Unlike the other tools, Poetry does not generate documentation or linting configurations automatically; those must be added manually.

Overall, the complexity of the generated project structure decreases from CookieCutter → PyScaffold → PyBuilder → Poetry, while the learning curve follows the same order.

dependency-managementBuild Toolsproject scaffoldingPoetryCookieCutterPyBuilderPyScaffold
Python Programming Learning Circle
Written by

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.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.