diff --git a/bac_analyze.py b/bac_analyze.py index afb7f3a..c3808c0 100755 --- a/bac_analyze.py +++ b/bac_analyze.py @@ -12,7 +12,11 @@ import sys from collections import defaultdict from pathlib import Path -import matplotlib.pyplot as plt +try: + import matplotlib.pyplot as plt + HAS_MATPLOTLIB = True +except ImportError: + HAS_MATPLOTLIB = False def load_transactions(json_files: list[Path]) -> list[dict]: @@ -204,6 +208,10 @@ def main(): if not path.exists(): sys.exit(f"Error: File not found: {path}") + # Check matplotlib early if graph requested + if args.graph and not HAS_MATPLOTLIB: + sys.exit("Error: matplotlib is required for graphs. Install with: pip install matplotlib") + # Load categories if not args.categories.exists(): sys.exit(f"Error: Categories file not found: {args.categories}") diff --git a/setup.py b/setup.py deleted file mode 100644 index df5f98f..0000000 --- a/setup.py +++ /dev/null @@ -1,16 +0,0 @@ -from setuptools import setup - -setup( - name="bac-import", - description="Extract and analyze BAC Costa Rica credit card statements", - author="Fabian Montero ", - version="0.1.0", - py_modules=["bac_extract", "bac_analyze"], - install_requires=["pdfplumber>=0.10.0", "matplotlib>=3.5.0"], - entry_points={ - "console_scripts": [ - "bac-extract=bac_extract:main", - "bac-analyze=bac_analyze:main", - ], - }, -)