New Library Sprint

New Library Sprint

These instructions are for sprinters who want to create an open-source Python library.

Why?

A great way to contribute to Python is by taking code that you normally copy-paste over and over and packaging it up for the Python Package Index.

TODO screenshot of PyPI

Welcome

Do you have a script, function, or even a snippet of Python code you copy from project to project? Rather than copying this little bit of Python code, have you ever considered just releasing your code on the Python Package Index (PyPI)? That way you can add tests, documentation, and even get some help on your code. Sounds wonderful, right?

The downside of releasing something on PyPI is that it's not easy. There are a lot of finicky boilerplate files that go into a Python package. While pretty well documented, it's not easy and even the best Python coders often copy/paste the boilerplate code from one project to another. They do this because trying to work through finicky boilerplate simply isn't as productive as creating new packages from existing snippets of code.

This sprint is the an answer to learning how to quickly overcome getting around finicky boilerplate. It will introduce you to a number of useful concepts and a wonderful tool called cookiecutter.

Info "Boilerplate" refers to the starter code that every project begins with.

Who should participate

If you're comfortable writing simple Python scripts or programs, you should be fine.

Knowledge of Python past the "Hello World" basics is recommended. If you've never done a Python tutorial before, you should probably do one and practice writing Python scripts before joining this sprint.

Prerequisites

We assume the following of those using this book:

  • You have Python 2.7.x or 3.3 (or higher) installed.
  • You have pip and virtualenv installed. virtualenvwrapper is nice, but not mandatory.
  • You know how to write Python code.
  • You probably have a snippet of code that you copy from place to place.

What will you do during the sprint?

You will:

  • Take a bit of code that you've written, be it a module, function, class, or even a snippet, and turn it into a package that will be uploaded onto PyPI.
  • Install Cookiecutter.
  • Use Cookiecutter to generate Python package boilerplate.
  • Put your code into the package.
  • Add two useful tests.
  • Create an account on PyPI if you don't have one yet.
  • Upload your Python package onto PyPI.
  • Use pip to check if your Python package installs locally.
  • Share with your friends and colleagues your Python package.

Are you ready to package up some code? Learn some new things? Great! Let's get started.