Skip to main content

CLI app to read and plot budget definition to multiple formats.

Project description

PyBudgetPlot

CI/CD CI - Test
Package PyPI - Version PyPI - Python Version
Meta Hatch project code style - black linting: pylint imports - isort License - MIT

Table of Contents


Introduction

This project was inspired by the "Personal finance with Python" book.

It'll help you to get the answers to the following list of questions (and more):

  • I want to visit Greece during September, will I have saved-up enough to go?
  • I want to buy a car, but how much time do I need to save-up with my lifestyle?
    • What about if I change my current lifestyle a bit?
  • Got offered a slightly better salary than my current, should I take it or not?
    • I'll have different expenses, what's the total net-worth change then?
    • Are those 200 bucks change in salary worth the trouble at all?
    • What about if I work somewhere for smaller salary but fewer expenses too?
  • I want to lead the following lifestyle, how much money should I earn to do so?
  • Any other question concerned about how-much money you'll have on a given date.

While "some logic" from the "Personal finance with Python" book is reused,

the source-code and the contents of the produced outputs are quite different.


Overview

All the project's functionality revolves around a 'budget-definition' file.

The definition file is used for storing the budget data in YAML format.

The budget data consists of two components:

  • Period
    • Represents list of all dates that fall in the scope of the budget.
    • Defined by a start-date and an end-date values in ISO-format.
  • Events
    • Represents list of recurring events of spending or receiving money.
    • Each Event is defined by description, amount and frequency.

The definition file is used as input for the following operations:

  • Calculation of daily and cumulative totals for each date in the period.
    • The output can be saved as CSV or dynamic XLSX file that's using formulas.
  • Plotting (line-chart) graph visualization of the daily and cumulative totals.
    • The output can be saved as PNG or an interactive plotter can be opened.

Two budgets and their outputs are included in the 'examples' dir.

The difference between 1300 and 1500 salary in the long-term can be surprising.


Installation

The project can be installed from PyPI using the following commands:

# Windows - open admin-level CMD and run:
pip install pybudgetplot

# Linux / MacOS - open user-level Terminal and run:
pip3 install --user pybudgetplot

Usage

1. Init a sample budget-definition file.

# generates budget.yaml file in the current dir
budget init budget.yaml

2. Update the file as per your needs and save the changes.

3. Generate outputs in one or all of the supported formats.

# generates budget.csv, budget.png, budget.txt, budget.xlsx files in current dir
budget plot -c -p -t -x budget.yaml

CLI Commands

# ------------------------------------------------------------------------------
# see the 'budget' command help
# ------------------------------------------------------------------------------
> budget -h

    Usage: budget [OPTIONS] COMMAND [ARGS]...

      Composite CLI command for managing a 'budget-definition' file.

    Options:
      --version   Show the version and exit.
      -h, --help  Show this message and exit.

    Commands:
      init  Initialize a budget definition file with sample contents.
      plot  Plot a budget-definition .yaml file.

# ------------------------------------------------------------------------------
# see the 'budget init' command help
# ------------------------------------------------------------------------------
> budget init -h

    Usage: budget init [OPTIONS] [FILE]

      Initialize a budget definition file with sample contents.

    Options:
      -h, --help  Show this message and exit.

# ------------------------------------------------------------------------------
# see the 'budget plot' command help
# ------------------------------------------------------------------------------
> budget plot -h

    Usage: budget plot [OPTIONS] YAML_FILE

      Plot a budget-definition .yaml file.

    Options:
      -c, --csv          Write .CSV with the breakdown next to definition file.
      -p, --png          Write .PNG with the graph next to definition file.
      -t, --txt          Write .TXT with the breakdown next to definition file.
      -x, --xlsx         Write .XLSX with the breakdown next to definition file.
      -i, --interactive  Enter interactive plot mode.
      -h, --help         Show this message and exit.

# ------------------------------------------------------------------------------
# That's all folks!
# ------------------------------------------------------------------------------

License

pybudgetplot is distributed under the terms of the MIT license.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pybudgetplot-3.1.1.tar.gz (386.6 kB view hashes)

Uploaded Source

Built Distribution

pybudgetplot-3.1.1-py3-none-any.whl (17.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page