A simple shopping list cost breakdown calculator
shopping_list
is a simple tool to calculate the cost breakdown and total of a shopping list containing items in multiple categories.
It allows to create different variation of prices, to compare the influence in the total cost.
See the corresponding section Pro Tip - Price combinations
shopping_list
in actionThe project was originally created to estimate the total cost of devices in a Home-Automation project and see the influence of different purchase decisions.
> shoppinglist shopping_list.yaml prices.yaml
Total cost breakdown
---
Living Room: 77.5 €
Kitchen: 45 €
Extra: 15 €
---
Total: 137.5 €
shopping_list.yaml
Living-room:
- InWallSwitch
- InWallSwitch
- PaddleSwitch
- MotionSensor
Kitchen:
- BulbBasic
- BulbAmbiance
Extra:
- Shipping
prices.yaml
InWallSwitch: 26
PaddleSwitch: 15
MotionSensor: 10.5
BulbBasic: 15
BulbAmbiance: 30
Shipping: 15
demo/
cd demo
shoppinglist shopping_list.yaml prices.yaml
pip3 install shoppinglist
# Or
pip3 install --user shoppinglist
Warning: Use python 3!
Usage: shoppinglist [OPTIONS] SHOPPING_LIST_FILE PRICES_FILE
[PRICE_OVERRIDES_FILES]...
Options:
--with-count Display the count for each item
--without-breakdown Hide the cost breakdown for each category
--help Show this message and exit.
SHOPPING_LIST_FILE
shopping_list.yaml
in the previous examplesPRICES_FILE
prices.yaml
in the previous examples[PRICE_OVERRIDES_FILES]
PRICES_FILE
filePRICE_OVERRIDES_FILES
define prices overridings the base prices present in PRICES_FILE
prices.yaml
and price_overrides_*.yaml
shopping_list.yaml
prices.yaml
Create different combination of prices to see quickly see the influence of your purchase decisions.
amazon.yaml
InWallSwitch: 56 <- More expensive InWallSwitch
PaddleSwitch: 7 <- Cheaper PaddleSwitch
MotionSensor: 10.5
BulbBasic: 15
BulbAmbiance: 30
Shipping: 0 <- Free shipping
upgrade_basic_to_ambiance.yaml
InWallSwitch: 26
PaddleSwitch: 15
MotionSensor: 10.5
BulbBasic: 30 <- Bump the price of 'basic' bulb to match
BulbAmbiance: 30 the one of the 'ambiance' variation
and see how it affects the Total!
Shipping: 15
# In 'demo/' folder
> shoppinglist shopping_list.yaml prices.yaml
...
Total: 137.5 €
> shoppinglist shopping_list.yaml amazon.yaml
...
Total: 174.5 €
> shoppinglist shopping_list.yaml upgrade_basic_to_ambiance.yaml
...
Total: 152.5 €
prices.yaml
InWallSwitch: 26
PaddleSwitch: 15
MotionSensor: 10.5
BulbBasic: 15
BulbAmbiance: 30
Shipping: 15
free_shipping.yaml
Shipping: 0 <- Free shipping
tradfri_bulb_instead_of_hue.yaml
BulbBasic: 10 <- Cheaper Bulbs
BulbAmbiance: 20 <- Cheaper Bulbs
# In 'demo/' folder
> shoppinglist shopping_list.yaml prices.yaml
...
Total: 137.5 €
> shoppinglist shopping_list.yaml prices.yaml free_shipping.yaml
...
Total: 122.5 €
> shoppinglist shopping_list.yaml prices.yaml free_shipping.yaml tradfri_bulb_instead_of_hue.yaml
...
Total: 107.5 €
This project needs pipenv
in order to work.
If you haven’t set it up already… please do yourself a favor and read about it. That thing made my life just slightly better… but to the point where I actually notice an increase in my mood while working with python projects.
Kudos to them :)
More info on: Pipenv: Python Development Workflow for Humans
Interested in having that setup automatically for you?
Then check out my ansible role that does just that ;)
==> FlorianKempenich.python-virtualenv
git clone git@github.com:FlorianKempenich/Shopping-List.git
cd Shopping-List
pipenv install --dev
pipenv shell
pytest
# Or
./start_tdd.sh
Follow me on Twitter: @ThisIsFlorianK
Find out more about my work: Florian Kempenich - Personal Website