Saturday, 24 April 2010

Pybill

The task of working out who owes who what amongst my flatmates was getting pretty complicated. There are always circular debts and bills being split amongst different groups of people. For these reasons I set about writing a program to do this for us. I have name it Pybill. It is written in Python and can be downloaded from gitorious:

git clone git://gitorious.org/pybill/pybill.git 


Or visit the project page: http://gitorious.org/pybill

The program takes a csv file (bills.csv) as an input with the format:


#comment
payee, amount, debtors


The program then outputs the minimum number of cheques required to settle all of the bills. Each person is identified by a single character and groups can be defined similarly. At present these are hard coded at the start of the pybill.py code, although I will change this to be a second CSV file soon. I am still in the process of testing the program but am confident that the algorithm to work out the payments is correct.

There are other freeware/shareware (mainly for windows) which claim to do this, along with many more websites which promise to do the same. However if you don't want all the guff that they come with, or want a simple file based solution then this may be useful.

No comments: