← Teaching
KDDlab's PhDs (2022)

The Proper Python Developer

How to structure, test and publish a Python package with GitHub Actions.

PhD University of Pisa 2022 2 hours Dr. Giulio Rossetti

A short, practical course built around a template repository: how to structure a Python project and use GitHub Actions to automatically build and publish it as a package on PyPI and Conda.

The example package is deliberately simple, an object class, a container and a few functions to sort objects and convert them from and to JSON, so that the focus stays on the tooling.

What the template includes

Automatic releases

GitHub Actions that build and publish the package to PyPI and Conda when a release is created, or on demand.

Code quality

CodeQL analysis and a check for compliance with the Black code style on every push.

Tests

A few pytest tests, with coverage configuration, to show how to test a package.

Documentation

A minimal Sphinx documentation ready for Read the Docs.

Configuration

Minimal setup.py, .gitignore and .coveragerc files explained step by step.

Crash course

The repository wiki walks through each of the topics above.