In 2022, I gave a talk on creating and distributing Python packages. I used Cookiecutter to show how a template could turn an empty directory into a package with a predictable structure.

The goal was to make packaging less mysterious. A new Python package needs more than a folder of source code. It also needs metadata, tests, documentation, a licence, and enough structure that someone else can install it and contribute to it. Cookiecutter gave us a concrete example to inspect instead of building every file by hand.

Abstract

Have you ever wanted to be able to “pip install” your own code or share it with other researchers? This seminar will introduce the necessary tasks for uploading your own custom packages to the Python Package Index (PyPI). Topics will include the use of Cookiecutter project templates, versions and tags, releases, autogenerated documentation, testing, and dependencies. Particular emphasis will be placed on editing packages “in place” so that changes may be tested locally before pushing to PyPI. Familiarity with CLI terminal actions, GitHub, and Python will be expected. Questions will be taken at the end of the seminar.

The generated example is available in the teaching_example repository. I also kept the Cookiecutter template used for the talk.

This is a backfilled project note written from GitHub issues, PRs, and project notes from around 2022-09.