Skip to content

dmotte/cashlog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

22 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

cashlog

GitHub main workflow PyPI

๐Ÿ Cash flow tracker.

Installation

This utility is available as a Python package on PyPI:

python3 -mpip install cashlog

Usage

There are some files in the example directory of this repo that can be useful to demonstrate how this tool works, so let's change directory first:

cd example/

We need a Python virtual environment ("venv") with some packages to do the demonstration:

python3 -mvenv venv
venv/bin/python3 -mpip install -r requirements.txt

Now we need some input data. You can take a look at the tests in test_cli.py to understand the file format and create your own CSV input file.

Tip: you can join multiple input files that are in the same format with the following command:

cat input-*.csv | (read -r header; echo "$header"; while read -r i; do [ "$i" = "$header" ] || echo "$i"; done)

Then we can compute the totals:

python3 -mcashlog --fmt-amount='{:+.2f}' --fmt-total='{:.2f}' input.csv output.csv

And finally display some nice plots using the plots.py script (which uses the Plotly Python library):

venv/bin/python3 plots.py -at output.csv

Tip: if you want to somehow filter the data before generating the plots, you can use the awk command:

awk -F, 'NR==1 || ($2+0 >= 5 || $2+0 <= -5)' output.csv > output-filtered.csv

For more details on how to use this command, you can also refer to its help message (--help).

Development

If you want to contribute to this project, you can install the package in editable mode:

python3 -mpip install -e . --user

This will just link the package to the original location, basically meaning any changes to the original package would reflect directly in your environment (source).

If you want to run the tests, you'll have to install the pytest package and then run:

python3 -mpytest test