Packaging Python Projects

February 14, 2016


A while ago I had quite a problem figuring out how to package a python project. This is because the python community has no set standard on how to package python projects.

So I decided to fix this for those who shall come after me and wish to make something quick in python. As an example project I came up with Arithmetic and had to come up with WaterInfrastructure.

It is something close to a python project quickstart.
Incidentally, it also happens to be an example of functional programming in python.

The point is to show you how to structure:

  • your tests (which testing framework might be good)
  • code
  • package it for distribution via a tool like pip or pypy and so forth
  • (all these in functional style)

I use Python 3.


The directory structure for this is as follows:

├── arithmetic
│   ├──
│   ├──
│   ├── division
│   │   ├──
│   │   ├──
│   │   └──
│   ├── multiplication
│   │   ├──
│   │   ├──
│   │   └──
│   └── tests
│       ├──
│       ├──
│       ├── division
│       │   └──
│       └── multiplication
│           └──


WaterInfrastructure is the other project I wrote following the above guidelines. This was as an interview question (this is a form of attribution :D).

Question: I have a problem, do python projects have to have .pyc files in the same directory as the source file?

There really isn't much to say here you can learn more by browsing through the code.