laypatel13-expense-tracker 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- laypatel13_expense_tracker-0.1.2/PKG-INFO +84 -0
- laypatel13_expense_tracker-0.1.2/README.md +67 -0
- laypatel13_expense_tracker-0.1.2/expense_tracker/__init__.py +0 -0
- laypatel13_expense_tracker-0.1.2/expense_tracker/main.py +132 -0
- laypatel13_expense_tracker-0.1.2/laypatel13_expense_tracker.egg-info/PKG-INFO +84 -0
- laypatel13_expense_tracker-0.1.2/laypatel13_expense_tracker.egg-info/SOURCES.txt +10 -0
- laypatel13_expense_tracker-0.1.2/laypatel13_expense_tracker.egg-info/dependency_links.txt +1 -0
- laypatel13_expense_tracker-0.1.2/laypatel13_expense_tracker.egg-info/entry_points.txt +2 -0
- laypatel13_expense_tracker-0.1.2/laypatel13_expense_tracker.egg-info/requires.txt +2 -0
- laypatel13_expense_tracker-0.1.2/laypatel13_expense_tracker.egg-info/top_level.txt +1 -0
- laypatel13_expense_tracker-0.1.2/pyproject.toml +31 -0
- laypatel13_expense_tracker-0.1.2/setup.cfg +4 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: laypatel13-expense-tracker
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: A colorful CLI expense tracker
|
|
5
|
+
Author-email: Lay Patel <lay.patel.1313@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/laypatel13/expense-tracker
|
|
8
|
+
Keywords: cli,expense,tracker,finance
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
Requires-Dist: colorama==0.4.6
|
|
16
|
+
Requires-Dist: tabulate>=0.9.0
|
|
17
|
+
|
|
18
|
+
# 💰 Expense Tracker - CLI
|
|
19
|
+
|
|
20
|
+
A simple command-line Expense Tracker built using Python.
|
|
21
|
+
This project helps you record, view, and summarize your daily expenses with a colorful and neatly formatted tabular interface.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## ✨ Features
|
|
26
|
+
|
|
27
|
+
- Add expenses with amount, category, and date
|
|
28
|
+
- View all recorded expenses in a tabular format
|
|
29
|
+
- Get category-wise summary and total spending
|
|
30
|
+
- Save data in a JSON file (`expenses.json`)
|
|
31
|
+
- Reset all expenses when needed
|
|
32
|
+
- Colorful CLI output for better readability
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 📦 Install via pip
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install laypatel13-expense-tracker
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Then run it from anywhere in your terminal:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
expense-tracker
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 🛠️ Install from source
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
git clone https://github.com/laypatel13/expense-tracker.git
|
|
54
|
+
cd expense-tracker
|
|
55
|
+
pip install -r requirements.txt
|
|
56
|
+
pip install -e .
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Then run:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
expense-tracker
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## 📂 Project Structure
|
|
68
|
+
|
|
69
|
+
```text
|
|
70
|
+
expense-tracker/
|
|
71
|
+
├── expense_tracker/
|
|
72
|
+
│ ├── __init__.py
|
|
73
|
+
│ └── main.py
|
|
74
|
+
├── pyproject.toml
|
|
75
|
+
├── requirements.txt
|
|
76
|
+
└── README.md
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## 🧰 Built With
|
|
82
|
+
|
|
83
|
+
- Used [Colorama](https://pypi.org/project/colorama/) for colored terminal output.
|
|
84
|
+
- Used [Tabulate](https://pypi.org/project/tabulate/) for formatted table display.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# 💰 Expense Tracker - CLI
|
|
2
|
+
|
|
3
|
+
A simple command-line Expense Tracker built using Python.
|
|
4
|
+
This project helps you record, view, and summarize your daily expenses with a colorful and neatly formatted tabular interface.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## ✨ Features
|
|
9
|
+
|
|
10
|
+
- Add expenses with amount, category, and date
|
|
11
|
+
- View all recorded expenses in a tabular format
|
|
12
|
+
- Get category-wise summary and total spending
|
|
13
|
+
- Save data in a JSON file (`expenses.json`)
|
|
14
|
+
- Reset all expenses when needed
|
|
15
|
+
- Colorful CLI output for better readability
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 📦 Install via pip
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install laypatel13-expense-tracker
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Then run it from anywhere in your terminal:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
expense-tracker
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 🛠️ Install from source
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
git clone https://github.com/laypatel13/expense-tracker.git
|
|
37
|
+
cd expense-tracker
|
|
38
|
+
pip install -r requirements.txt
|
|
39
|
+
pip install -e .
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Then run:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
expense-tracker
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 📂 Project Structure
|
|
51
|
+
|
|
52
|
+
```text
|
|
53
|
+
expense-tracker/
|
|
54
|
+
├── expense_tracker/
|
|
55
|
+
│ ├── __init__.py
|
|
56
|
+
│ └── main.py
|
|
57
|
+
├── pyproject.toml
|
|
58
|
+
├── requirements.txt
|
|
59
|
+
└── README.md
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 🧰 Built With
|
|
65
|
+
|
|
66
|
+
- Used [Colorama](https://pypi.org/project/colorama/) for colored terminal output.
|
|
67
|
+
- Used [Tabulate](https://pypi.org/project/tabulate/) for formatted table display.
|
|
File without changes
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
from colorama import init, Fore, Back, Style
|
|
4
|
+
from tabulate import tabulate
|
|
5
|
+
|
|
6
|
+
init(autoreset=True)
|
|
7
|
+
|
|
8
|
+
data = []
|
|
9
|
+
totals = {}
|
|
10
|
+
|
|
11
|
+
def load_expenses():
|
|
12
|
+
if os.path.exists("expenses.json"):
|
|
13
|
+
try:
|
|
14
|
+
with open("expenses.json", "r") as f:
|
|
15
|
+
content = f.read()
|
|
16
|
+
if content.strip() == "":
|
|
17
|
+
return []
|
|
18
|
+
return json.loads(content)
|
|
19
|
+
except (json.JSONDecodeError, IOError) as e:
|
|
20
|
+
print(Fore.WHITE + Back.RED + f"Fatal Error: Failed to load expenses. {e}" + Style.RESET_ALL)
|
|
21
|
+
return []
|
|
22
|
+
return []
|
|
23
|
+
|
|
24
|
+
def add_expense():
|
|
25
|
+
while True:
|
|
26
|
+
amount_input = input(Fore.WHITE + Style.NORMAL + "Enter Amount Of Expense (or 'quit' to finish): " + Style.RESET_ALL)
|
|
27
|
+
if amount_input.lower() == 'quit':
|
|
28
|
+
break
|
|
29
|
+
try:
|
|
30
|
+
amount = int(amount_input)
|
|
31
|
+
category = input(Fore.WHITE + Style.NORMAL + "Enter Category Of Expense: " + Style.RESET_ALL)
|
|
32
|
+
date = input(Fore.WHITE + Style.NORMAL + "Enter Date Of Expense (DD-MM-YYYY): " + Style.RESET_ALL)
|
|
33
|
+
new_entry = {"amount": amount, "category": category, "date": date,}
|
|
34
|
+
data.append(new_entry)
|
|
35
|
+
print(Fore.GREEN + Back.BLACK + Style.BRIGHT + "Expense Added Successfully!" + Style.RESET_ALL + "\n")
|
|
36
|
+
except ValueError:
|
|
37
|
+
print(Fore.RED + Style.BRIGHT + "Invalid Amount. Please Enter a Number." + Style.RESET_ALL + "\n")
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def save_expense():
|
|
41
|
+
try:
|
|
42
|
+
with open("expenses.json", "w") as f:
|
|
43
|
+
json.dump(data, f)
|
|
44
|
+
except IOError as e:
|
|
45
|
+
print(Fore.WHITE + Back.RED + f"Fatal Error: Failed to save expenses. {e}" + Style.RESET_ALL)
|
|
46
|
+
|
|
47
|
+
def view_expenses():
|
|
48
|
+
if not data:
|
|
49
|
+
print(Fore.WHITE + Back.BLACK + Style.BRIGHT + "No Expenses Recorded Yet." + Style.RESET_ALL)
|
|
50
|
+
return
|
|
51
|
+
print("\n" + Fore.BLACK + Back.WHITE + "--- Your Expenses ---" + Style.RESET_ALL)
|
|
52
|
+
table_data = []
|
|
53
|
+
for expense in data:
|
|
54
|
+
table_data.append([
|
|
55
|
+
Fore.WHITE + Style.BRIGHT + expense['date'] + Style.RESET_ALL,
|
|
56
|
+
Fore.WHITE + Style.BRIGHT + expense['category'] + Style.RESET_ALL,
|
|
57
|
+
Fore.WHITE + Style.BRIGHT + f"{expense['amount']}" + Style.RESET_ALL
|
|
58
|
+
])
|
|
59
|
+
headers = [Style.BRIGHT + "DateOfExpense" + Style.RESET_ALL, Style.BRIGHT + "CategoryOfExpense" + Style.RESET_ALL, Style.BRIGHT + "AmountOfExpense" + Style.RESET_ALL]
|
|
60
|
+
print(tabulate(table_data, headers=headers, tablefmt="pretty", disable_numparse=True))
|
|
61
|
+
|
|
62
|
+
def summary():
|
|
63
|
+
if not data:
|
|
64
|
+
print(Fore.WHITE + Back.BLACK + Style.BRIGHT + "No Expenses To Summarize." + Style.RESET_ALL)
|
|
65
|
+
return
|
|
66
|
+
|
|
67
|
+
totals.clear()
|
|
68
|
+
for expense in data:
|
|
69
|
+
category = expense["category"]
|
|
70
|
+
amount = expense["amount"]
|
|
71
|
+
if category in totals:
|
|
72
|
+
totals[category] += amount
|
|
73
|
+
else:
|
|
74
|
+
totals[category] = amount
|
|
75
|
+
|
|
76
|
+
print("\n" + Fore.BLACK + Back.WHITE + "--- Expense Summary ---" + Style.RESET_ALL)
|
|
77
|
+
table_data = []
|
|
78
|
+
for category, total in totals.items():
|
|
79
|
+
table_data.append([
|
|
80
|
+
Fore.WHITE + Style.DIM + f"{category}" + Style.RESET_ALL,
|
|
81
|
+
Fore.WHITE + Style.DIM + f"{total}" + Style.RESET_ALL
|
|
82
|
+
])
|
|
83
|
+
|
|
84
|
+
table_data.append([
|
|
85
|
+
Fore.WHITE + Style.NORMAL + "Total Expense Done!" + Style.RESET_ALL,
|
|
86
|
+
Fore.WHITE + Style.NORMAL + f"{sum(totals.values())}" + Style.RESET_ALL
|
|
87
|
+
])
|
|
88
|
+
|
|
89
|
+
headers = [Style.BRIGHT + "CategoryOfExpense" + Style.RESET_ALL, Style.BRIGHT + "Total-AmountOfExpense" + Style.RESET_ALL]
|
|
90
|
+
print(tabulate(table_data, headers=headers, tablefmt="pretty", disable_numparse=True))
|
|
91
|
+
|
|
92
|
+
def reset_expenses():
|
|
93
|
+
global data
|
|
94
|
+
confirm = input(Fore.RED + Style.BRIGHT + "Are You Sure You Want To Reset All Expenses? (yes/no): " + Style.RESET_ALL)
|
|
95
|
+
if confirm.lower() == "yes":
|
|
96
|
+
data = []
|
|
97
|
+
save_expense()
|
|
98
|
+
print(Fore.GREEN + Back.BLACK + "All Expenses Cleared!" + Style.RESET_ALL)
|
|
99
|
+
else:
|
|
100
|
+
print(Fore.RED + Style.NORMAL + "Reset Cancelled." + Style.RESET_ALL)
|
|
101
|
+
|
|
102
|
+
def main():
|
|
103
|
+
global data
|
|
104
|
+
data = load_expenses()
|
|
105
|
+
|
|
106
|
+
while True:
|
|
107
|
+
print("\n" + Fore.BLACK + Back.WHITE + "--- Expense Tracker ---" + Style.RESET_ALL)
|
|
108
|
+
print(Fore.YELLOW + Style.NORMAL + "(1) Add New Expense" + Style.RESET_ALL)
|
|
109
|
+
print(Fore.YELLOW + Style.NORMAL + "(2) View Expenses" + Style.RESET_ALL)
|
|
110
|
+
print(Fore.YELLOW + Style.NORMAL + "(3) View Summary Of Expenses" + Style.RESET_ALL)
|
|
111
|
+
print(Fore.YELLOW + Style.NORMAL + "(4) Quit Expense Tracker" + Style.RESET_ALL)
|
|
112
|
+
print(Fore.YELLOW + Style.NORMAL + "(5) Reset Expenses" + Style.RESET_ALL)
|
|
113
|
+
|
|
114
|
+
choice = input("\n" + Fore.CYAN + Style.BRIGHT + "Enter Your Choice: " + Style.RESET_ALL)
|
|
115
|
+
|
|
116
|
+
if choice == "1":
|
|
117
|
+
add_expense()
|
|
118
|
+
save_expense()
|
|
119
|
+
elif choice == "2":
|
|
120
|
+
view_expenses()
|
|
121
|
+
elif choice == "3":
|
|
122
|
+
summary()
|
|
123
|
+
elif choice == "4":
|
|
124
|
+
print(Fore.WHITE + Style.BRIGHT + "Bye! Thanks For Using The Expense Tracker.!" + Style.RESET_ALL)
|
|
125
|
+
break
|
|
126
|
+
elif choice == "5":
|
|
127
|
+
reset_expenses()
|
|
128
|
+
else:
|
|
129
|
+
print(Fore.RED + Style.BRIGHT + "Invalid choice, try again!" + Style.RESET_ALL)
|
|
130
|
+
|
|
131
|
+
if __name__ == "__main__":
|
|
132
|
+
main()
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: laypatel13-expense-tracker
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: A colorful CLI expense tracker
|
|
5
|
+
Author-email: Lay Patel <lay.patel.1313@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/laypatel13/expense-tracker
|
|
8
|
+
Keywords: cli,expense,tracker,finance
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
Requires-Dist: colorama==0.4.6
|
|
16
|
+
Requires-Dist: tabulate>=0.9.0
|
|
17
|
+
|
|
18
|
+
# 💰 Expense Tracker - CLI
|
|
19
|
+
|
|
20
|
+
A simple command-line Expense Tracker built using Python.
|
|
21
|
+
This project helps you record, view, and summarize your daily expenses with a colorful and neatly formatted tabular interface.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## ✨ Features
|
|
26
|
+
|
|
27
|
+
- Add expenses with amount, category, and date
|
|
28
|
+
- View all recorded expenses in a tabular format
|
|
29
|
+
- Get category-wise summary and total spending
|
|
30
|
+
- Save data in a JSON file (`expenses.json`)
|
|
31
|
+
- Reset all expenses when needed
|
|
32
|
+
- Colorful CLI output for better readability
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 📦 Install via pip
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install laypatel13-expense-tracker
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Then run it from anywhere in your terminal:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
expense-tracker
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 🛠️ Install from source
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
git clone https://github.com/laypatel13/expense-tracker.git
|
|
54
|
+
cd expense-tracker
|
|
55
|
+
pip install -r requirements.txt
|
|
56
|
+
pip install -e .
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Then run:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
expense-tracker
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## 📂 Project Structure
|
|
68
|
+
|
|
69
|
+
```text
|
|
70
|
+
expense-tracker/
|
|
71
|
+
├── expense_tracker/
|
|
72
|
+
│ ├── __init__.py
|
|
73
|
+
│ └── main.py
|
|
74
|
+
├── pyproject.toml
|
|
75
|
+
├── requirements.txt
|
|
76
|
+
└── README.md
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## 🧰 Built With
|
|
82
|
+
|
|
83
|
+
- Used [Colorama](https://pypi.org/project/colorama/) for colored terminal output.
|
|
84
|
+
- Used [Tabulate](https://pypi.org/project/tabulate/) for formatted table display.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
expense_tracker/__init__.py
|
|
4
|
+
expense_tracker/main.py
|
|
5
|
+
laypatel13_expense_tracker.egg-info/PKG-INFO
|
|
6
|
+
laypatel13_expense_tracker.egg-info/SOURCES.txt
|
|
7
|
+
laypatel13_expense_tracker.egg-info/dependency_links.txt
|
|
8
|
+
laypatel13_expense_tracker.egg-info/entry_points.txt
|
|
9
|
+
laypatel13_expense_tracker.egg-info/requires.txt
|
|
10
|
+
laypatel13_expense_tracker.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
expense_tracker
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "laypatel13-expense-tracker"
|
|
7
|
+
version = "0.1.2"
|
|
8
|
+
description = "A colorful CLI expense tracker"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Lay Patel", email = "lay.patel.1313@gmail.com"}
|
|
14
|
+
]
|
|
15
|
+
keywords = ["cli", "expense", "tracker", "finance"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"License :: OSI Approved :: MIT License",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
"Environment :: Console",
|
|
21
|
+
]
|
|
22
|
+
dependencies = [
|
|
23
|
+
"colorama==0.4.6",
|
|
24
|
+
"tabulate>=0.9.0",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.scripts]
|
|
28
|
+
expense-tracker = "expense_tracker.main:main"
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://github.com/laypatel13/expense-tracker"
|