The making of a Python package
Submitted by poruri sai rahul (@rahulporuri) on Sunday, 27 August 2017
Technical level: Intermediate Status: Submitted
Writing a script that does something amazing is not enough to get people to use it, it needs to be packaged so that it’s easy to install, it needs to be open sourced so that it will live longer than you will, it needs to be tested continuously and it needs to have user-friendly documentation. This is what all of the popular Python packages have in common.
Over the course of this talk :
you will learn what a basic
you will understand how Git and GitHub can be used effectively to open source your project
you will look at how Sphinx can be used to easily generate docs, which can then be hosted as GitHub pages.
you will look at how tests and Continuous Integration tools like Travis can be used.
While a prior understanding of Python will definitely help you get more out of this talk, it is not necessary. Understanding how to deliver and sustain a Python project is what I will convey through this talk.
After briefly talking about how packaging your scripts makes them easily accessible, I’ll talk about the
setup.py script and the
setuptools.setup function. I’ll show what a basic setup script is and then i’ll talk about all the important arguments that can be passed to the
setup function in the script.
Now that we have a working package, we’ll talk about PyPI and how to use the
twine package to upload your package to
We’ll now talk about using Git & GitHub to host your package and it’s docs. We’ll talk about using Continuous Integration tools like Travis. Finally, we’ll look at examples from popular packages in the Python community.
I am a Scientific Software Developer at Enthought. By day, I work on Enthought’s Product offerings. I have a background in Physics. I like giving talks and conducting workshops because researching the topic increases my understanding of it. I’ve been (semi-) active in the Python community in Pune over the last year and I’ve given talks at local meetups & organized workshops.