savings-analyzer 0.1.0__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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Your Name
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,75 @@
1
+ Metadata-Version: 2.4
2
+ Name: savings-analyzer
3
+ Version: 0.1.0
4
+ Summary: A simple package for analyzing monthly savings and savings targets
5
+ Author: Your Name
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Your Name
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/yourusername/savings-analyzer
29
+ Classifier: Programming Language :: Python :: 3
30
+ Classifier: License :: OSI Approved :: MIT License
31
+ Classifier: Operating System :: OS Independent
32
+ Requires-Python: >=3.7
33
+ Description-Content-Type: text/markdown
34
+ License-File: LICENSE
35
+ Dynamic: license-file
36
+
37
+ # savings-analyzer
38
+
39
+ A simple Python package for analyzing monthly savings, savings rate,
40
+ and progress toward a savings target.
41
+
42
+ ## Install
43
+
44
+ ```bash
45
+ pip install savings-analyzer
46
+ ```
47
+
48
+ ## Usage
49
+
50
+ ```python
51
+ from savings_analyzer import calculate_savings, savings_rate, target_progress, months_to_target
52
+
53
+ # How much did I save this month?
54
+ savings = calculate_savings(income=25000, expenses={"Rent": 8000, "Food": 4000})
55
+
56
+ # What % of my income did I save?
57
+ rate = savings_rate(income=25000, savings=savings)
58
+
59
+ # How close am I to my savings goal?
60
+ progress, remaining = target_progress(current_savings=10000, target=50000)
61
+
62
+ # How many more months until I hit my goal?
63
+ months = months_to_target(remaining=remaining, monthly_savings=savings)
64
+ ```
65
+
66
+ ## Functions
67
+
68
+ - `calculate_savings(income, expenses)` -- expenses can be a dict or a list
69
+ - `savings_rate(income, savings)` -- savings as a % of income
70
+ - `target_progress(current_savings, target)` -- returns `(percent, remaining)`
71
+ - `months_to_target(remaining, monthly_savings)` -- months needed to close the gap
72
+
73
+ ## License
74
+
75
+ MIT
@@ -0,0 +1,39 @@
1
+ # savings-analyzer
2
+
3
+ A simple Python package for analyzing monthly savings, savings rate,
4
+ and progress toward a savings target.
5
+
6
+ ## Install
7
+
8
+ ```bash
9
+ pip install savings-analyzer
10
+ ```
11
+
12
+ ## Usage
13
+
14
+ ```python
15
+ from savings_analyzer import calculate_savings, savings_rate, target_progress, months_to_target
16
+
17
+ # How much did I save this month?
18
+ savings = calculate_savings(income=25000, expenses={"Rent": 8000, "Food": 4000})
19
+
20
+ # What % of my income did I save?
21
+ rate = savings_rate(income=25000, savings=savings)
22
+
23
+ # How close am I to my savings goal?
24
+ progress, remaining = target_progress(current_savings=10000, target=50000)
25
+
26
+ # How many more months until I hit my goal?
27
+ months = months_to_target(remaining=remaining, monthly_savings=savings)
28
+ ```
29
+
30
+ ## Functions
31
+
32
+ - `calculate_savings(income, expenses)` -- expenses can be a dict or a list
33
+ - `savings_rate(income, savings)` -- savings as a % of income
34
+ - `target_progress(current_savings, target)` -- returns `(percent, remaining)`
35
+ - `months_to_target(remaining, monthly_savings)` -- months needed to close the gap
36
+
37
+ ## License
38
+
39
+ MIT
@@ -0,0 +1,25 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "savings-analyzer"
7
+ version = "0.1.0"
8
+ description = "A simple package for analyzing monthly savings and savings targets"
9
+ readme = "README.md"
10
+ requires-python = ">=3.7"
11
+ license = { file = "LICENSE" }
12
+ authors = [
13
+ { name = "Your Name" }
14
+ ]
15
+ classifiers = [
16
+ "Programming Language :: Python :: 3",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Operating System :: OS Independent",
19
+ ]
20
+
21
+ [project.urls]
22
+ Homepage = "https://github.com/yourusername/savings-analyzer"
23
+
24
+ [tool.setuptools.packages.find]
25
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,22 @@
1
+ """
2
+ savings_analyzer
3
+ ================
4
+ A simple Python package for analyzing monthly savings, savings rate,
5
+ and progress toward a savings target.
6
+ """
7
+
8
+ from .core import (
9
+ calculate_savings,
10
+ savings_rate,
11
+ target_progress,
12
+ months_to_target,
13
+ )
14
+
15
+ __version__ = "0.1.0"
16
+
17
+ __all__ = [
18
+ "calculate_savings",
19
+ "savings_rate",
20
+ "target_progress",
21
+ "months_to_target",
22
+ ]
@@ -0,0 +1,59 @@
1
+ """core.py - function definitions for the Monthly Savings Analyzer."""
2
+
3
+
4
+ def _validate_number(value, name):
5
+ """Helper: make sure a value is a non-negative number."""
6
+ if isinstance(value, bool) or not isinstance(value, (int, float)):
7
+ raise TypeError(f"{name} must be a number")
8
+ if value < 0:
9
+ raise ValueError(f"{name} cannot be negative")
10
+
11
+
12
+ def calculate_savings(income, expenses):
13
+ """Return monthly savings = income - total expenses.
14
+
15
+ expenses can be a dict {"Rent": 8000, ...} or a list [8000, 2000, ...].
16
+ """
17
+ _validate_number(income, "Income")
18
+
19
+ amounts = expenses.values() if isinstance(expenses, dict) else expenses
20
+
21
+ total_expenses = 0
22
+ for amount in amounts:
23
+ _validate_number(amount, "Expense")
24
+ total_expenses += amount
25
+
26
+ return income - total_expenses
27
+
28
+
29
+ def savings_rate(income, savings):
30
+ """Return savings as a percentage of income."""
31
+ _validate_number(income, "Income")
32
+ if income == 0:
33
+ raise ValueError("Income must be greater than zero to find savings rate")
34
+ return (savings / income) * 100
35
+
36
+
37
+ def target_progress(current_savings, target):
38
+ """Return (percentage_completed, amount_remaining) toward a savings target."""
39
+ _validate_number(current_savings, "Current savings")
40
+ _validate_number(target, "Target")
41
+ if target == 0:
42
+ raise ValueError("Target must be greater than zero")
43
+
44
+ percentage = min((current_savings / target) * 100, 100)
45
+ remaining = max(target - current_savings, 0)
46
+ return percentage, remaining
47
+
48
+
49
+ def months_to_target(remaining, monthly_savings):
50
+ """Return the number of whole months needed to reach the remaining amount."""
51
+ _validate_number(remaining, "Remaining amount")
52
+ if monthly_savings <= 0:
53
+ raise ValueError("Monthly savings must be positive to reach a target")
54
+
55
+ months = 0
56
+ while remaining > 0:
57
+ remaining -= monthly_savings
58
+ months += 1
59
+ return months
@@ -0,0 +1,75 @@
1
+ Metadata-Version: 2.4
2
+ Name: savings-analyzer
3
+ Version: 0.1.0
4
+ Summary: A simple package for analyzing monthly savings and savings targets
5
+ Author: Your Name
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Your Name
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/yourusername/savings-analyzer
29
+ Classifier: Programming Language :: Python :: 3
30
+ Classifier: License :: OSI Approved :: MIT License
31
+ Classifier: Operating System :: OS Independent
32
+ Requires-Python: >=3.7
33
+ Description-Content-Type: text/markdown
34
+ License-File: LICENSE
35
+ Dynamic: license-file
36
+
37
+ # savings-analyzer
38
+
39
+ A simple Python package for analyzing monthly savings, savings rate,
40
+ and progress toward a savings target.
41
+
42
+ ## Install
43
+
44
+ ```bash
45
+ pip install savings-analyzer
46
+ ```
47
+
48
+ ## Usage
49
+
50
+ ```python
51
+ from savings_analyzer import calculate_savings, savings_rate, target_progress, months_to_target
52
+
53
+ # How much did I save this month?
54
+ savings = calculate_savings(income=25000, expenses={"Rent": 8000, "Food": 4000})
55
+
56
+ # What % of my income did I save?
57
+ rate = savings_rate(income=25000, savings=savings)
58
+
59
+ # How close am I to my savings goal?
60
+ progress, remaining = target_progress(current_savings=10000, target=50000)
61
+
62
+ # How many more months until I hit my goal?
63
+ months = months_to_target(remaining=remaining, monthly_savings=savings)
64
+ ```
65
+
66
+ ## Functions
67
+
68
+ - `calculate_savings(income, expenses)` -- expenses can be a dict or a list
69
+ - `savings_rate(income, savings)` -- savings as a % of income
70
+ - `target_progress(current_savings, target)` -- returns `(percent, remaining)`
71
+ - `months_to_target(remaining, monthly_savings)` -- months needed to close the gap
72
+
73
+ ## License
74
+
75
+ MIT
@@ -0,0 +1,9 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/savings_analyzer/__init__.py
5
+ src/savings_analyzer/core.py
6
+ src/savings_analyzer.egg-info/PKG-INFO
7
+ src/savings_analyzer.egg-info/SOURCES.txt
8
+ src/savings_analyzer.egg-info/dependency_links.txt
9
+ src/savings_analyzer.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ savings_analyzer