Overview

In this workshop, you will learn how to package your Python code and publish it on PyPI, the Python Package Index, for others to use.

This workshop is targeted towards Python developers who are looking to distribute their code as a package, and who want to learn how to do it properly. You will learn best practices for packaging Python code, and walk through the process of creating a package from scratch.

Motivations

Packaging your code as a library or module is important for sharing your work with others, as it makes it easy for others to use your code in their own projects. This is especially important in the scientific community, where collaboration and reproducibility are crucial.

For Academics:

Being comfortable with Python packaging can be incredibly helpful for researchers looking to publish their work in academic journals. By packaging their code into a reusable and sharable format, they can increase the transparency and reproducibility of their work.

Packaging code makes it easier for other researchers to understand the implementation of novel algorithms and to build on them, leading to increased collaboration and faster scientific progress. Furthermore, it becomes simpler to create and share research software libraries, which can benefit the wider research community.

Becoming proficient in Python packaging is a valuable skill for any researcher looking to increase the impact and visibility of their work.

For Everyone:

Creating and distributing a Python package also has other benefits, such as:

  • Facilitating code maintenance and reuse
  • Making it easier to manage dependencies and ensure compatibility with other projects
  • Allowing you to version your code and manage releases more effectively
  • Helping to establish your code as a reputable and reliable tool in the community

Learning Outcomes

By the end of this workshop, you will be able to:

  • Understand the structure of a Python package
  • Create a setup.py file and a package directory for your code
  • Use setuptools to build and distribute your package
  • Publish your package on PyPI

Workshop Format

This workshop will be structured as a combination of lectures, demonstrations, and hands-on exercises. You will be provided with a sample project that you will use to package and distribute your code.

Note: conda packaging would encompass a separate followup workshop, as it is quite a bit more involved.

See the workshop structure page for more information about general workshop format.