Skip to content

The Python command-line program makes it easy to track household budget expenses and analyze them.

Notifications You must be signed in to change notification settings

pamidev/budget-manager

Repository files navigation

Budget Manager

This command-line Python program makes it easy to track household budget expenses and analyze them. The program allows You to easily add new expenses and generate reports.

Table of Contents

General Information

The purpose of the program is to track Your own expenses and analyze them. You can add, report, import and export expenses right at run the program.

Tanks to this project, I learned how to:

  • write definitions with only one responsibility,
  • write easy classes using @dataclass decorator,
  • use Python standard library modules: csv, dataclasses, pickle, sys,
  • use Python third-party packages like click (Command Line Interface Creation Kit).

Technologies Used

  • Python - version 3.11.3
  • from Python's standard library:
  • from Python third-party packages:
    • click package - version 8.1.3
    • pytest package - version 7.3.1

Features

  • The program has subcommands: add, report, export-python and import-csv:
    • add - allows you to add a new expense,
    • report - displays all the expenses in the table with total sum,
    • import-csv - imports the list of expenses from a CSV file,
    • export-python - displays the list of all expenses as an object,
    • clear-db - clear database file.
  • The program stores a database of all expenses in data directory as budget-database.db file. If the file does not exist, automatically creates a new empty database in data directory.

Screenshots

Example screenshot

Setup

I assume You know how to cloning this repository. If not, I refer you to this publication.

Python version should not matter here, although the program was written and tested on version 3.11.3.

If You don't have any Python version, download and install from here.

You can verify Python version by typing in terminal:

$ python --version

Now You need to create and activate virtual environment like this:

$ python -m venv .venv
$ cd .venv\Scripts
$ activate
$ cd ..
$ cd ..

and install click package in the previously created virtual environment:

$ pip install -r requirements.txt

or

$ pip install -U click

You can also install pytest package with dependencies if You want to test my program:

$ pip install -r tests_requirements.txt

or

$ pip install -U pytest

After installation, run the program as shown below.

Usage

To add some expense type in terminal like this:

$ python budget_manager.py add 100 "some expense"

To import CSV file with expenses type in terminal:

$ python budget_manager.py import-csv data\expenses.csv

To report expenses, if You have saved in database any:

$ python budget_manager.py report

To display list of all expenses as an Python object:

$ python budget_manager.py export-python

To clear database file:

$ python budget_manager.py clear-db
$ Are You sure? (Y/N): N

Acknowledgements

About

The Python command-line program makes it easy to track household budget expenses and analyze them.

Topics

Resources

Stars

Watchers

Forks

Languages