diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index da56e6df..3df913f6 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -1,16 +1,12 @@ -name: CI Workflow +name: CI/CD Workflow on: push: branches: - master - pull_request: - branches: - - master - jobs: - test: + build: runs-on: ubuntu-latest steps: @@ -20,21 +16,19 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.12.7' - - - name: Find and Install Dependencies - run: | - python -m pip install --upgrade pip - # Find all requirements.txt files and install dependencies for each - for req_file in $(find . -name "requirements.txt"); do - echo "Installing dependencies from $req_file" - pip install -r "$req_file" - done + python-version: '3.12.7' - - name: Run Tests + - name: Install dependencies for each subproject run: | - # Run tests in each subproject that contains tests - for test_dir in $(find . -type d -name "tests"); do - echo "Running tests in $test_dir" - pytest "$test_dir" + # Loop through each subproject directory + for dir in projects/*; do + if [ -d "$dir" ]; then + echo "Installing dependencies for $dir" + # Check if requirements.txt exists in the subproject + if [ -f "$dir/requirements.txt" ]; then + pip install -r "$dir/requirements.txt" + else + echo "No requirements.txt found in $dir" + fi + fi done diff --git a/Personal_Finance_Tracker/__pycache__/data_entry.cpython-312.pyc b/Personal_Finance_Tracker/__pycache__/data_entry.cpython-312.pyc index 93c0e834..fcde98c0 100644 Binary files a/Personal_Finance_Tracker/__pycache__/data_entry.cpython-312.pyc and b/Personal_Finance_Tracker/__pycache__/data_entry.cpython-312.pyc differ diff --git a/Personal_Finance_Tracker/data_entry.py b/Personal_Finance_Tracker/data_entry.py index ef995816..add03e9d 100644 --- a/Personal_Finance_Tracker/data_entry.py +++ b/Personal_Finance_Tracker/data_entry.py @@ -1,6 +1,7 @@ from datetime import datetime date_format = "%d-%m-%Y" + categories = { "I": "Income", "E": "Expense" diff --git a/Personal_Finance_Tracker/finance_date.csv b/Personal_Finance_Tracker/finance_date.csv index 014009bf..37bcc2a0 100644 --- a/Personal_Finance_Tracker/finance_date.csv +++ b/Personal_Finance_Tracker/finance_date.csv @@ -19,4 +19,4 @@ date,amount,category,description 28-07-2024,65.0,Expense,Concert ticket 09-09-2024,15.0,Expense,Cab fare to campus 24-09-2024,300.0,Expense,Monthly gym membership - +02-08-2024,800.0,Income,Testing pc diff --git a/Personal_Finance_Tracker/main.py b/Personal_Finance_Tracker/main.py index e71219af..6475c483 100644 --- a/Personal_Finance_Tracker/main.py +++ b/Personal_Finance_Tracker/main.py @@ -1,8 +1,8 @@ -import pandas as pd +import pandas as pd # type: ignore import csv from datetime import datetime from data_entry import get_amount, get_category, get_date, get_description -from matplotlib import pyplot as plt +from matplotlib import pyplot as plt # type: ignore class CSV: CSV_FILE = "finance_date.csv" #name of the csv file that will store the data @@ -65,12 +65,13 @@ def get_transactions(cls, start_date, end_date): print("\n Summary") print(f"Total Income: €{total_income: .2f}") print(f"Total Expense: €{total_expense: .2f}") - print(f"Net savings: €{(total_income - total_expense): .2f}") + print(f"Net savings: €{(total_income - total_expense):.2f}") return filtered_df @classmethod def plot_transactions(cls,df): + df["date"] = pd.to_datetime(df["date"], format="%d-%m-%Y") df.set_index("date", inplace=True) income_df = df[df["category"] == "Income"].resample("D").sum().reindex(df.index, fill_value=0) #Resampling the data to daily frequency diff --git a/Personal_Finance_Tracker/requirements.txt b/Personal_Finance_Tracker/requirements.txt index 6d4dc8b1..93f268cc 100644 Binary files a/Personal_Finance_Tracker/requirements.txt and b/Personal_Finance_Tracker/requirements.txt differ diff --git a/Personal_Finance_Tracker/tempCodeRunnerFile.py b/Personal_Finance_Tracker/tempCodeRunnerFile.py new file mode 100644 index 00000000..79d95c35 --- /dev/null +++ b/Personal_Finance_Tracker/tempCodeRunnerFile.py @@ -0,0 +1 @@ +print(f"Net savings: €{(total_income - total_expense):.2f}")