Building an open-source Python application the right way

September 2013 · 4 minute read

If you love Python and love open source like I do, you’d probably be open sourcing something new every day/week/month. Sure that there are quite a lot of articles online that tell you the best practices of writing Python code, testing, packaging, distributing etc, I haven’t really found a good article that highlights what are the best practices/conventions to be followed while building a full fledged and open source Python application. So I decided to write one.

While I know that this was a good idea, I also wanted some sort of template code that I could reuse in every project. Hence, I decided to write one. Meet bootstrapy, a bootstrap python application that takes the pain out of setting up a sample application and lets you focus on writing code and tests for them. As a follow up of the application, I’ll try and explain the purpose of various files in as simple manner as possible.

First, let’s take a look at the directory structure of bootstrapy:

bootstrapy-screenshot Files

You can do other things like create your own package, zip it and even upload it to PyPi. For more details, refer Installing Python Modules and Getting started with setuptools and setup.py.

Directories

 

So now whenever I need to work on a Python application, all I need to do is to clone the bootstrapy repo, and voila ! I can start writing code. Sweet, isn’t it ?

This is the project structure that I would recommend, but there may be different opinions about the same. If you have a suggestion, feel free to raise an issue on github. If you have a question/feedback instead, ping me directly via email.

comments powered by Disqus