A comprehensive personal finance management system built in Python with both console and GUI interfaces.
- Transaction Management: Add, edit, delete, and view income and expense transactions
- Category Management: Organize transactions with customizable categories
- Financial Reporting: Generate detailed reports with summaries and breakdowns
- Data Visualization: Create charts and graphs to visualize spending patterns
- Data Export: Export data to CSV and Excel formats
- Data Backup & Recovery: Automatic backups with restore capabilities
- Console Interface: Text-based interface for command-line users
- GUI Interface: User-friendly graphical interface built with tkinter
- Dual Interface Support: Switch between interfaces based on preference
- JSON Storage: Lightweight, human-readable data storage
- Data Validation: Comprehensive input validation and error handling
- Schema Migration: Automatic data migration for version updates
- Data Integrity: Built-in validation and corruption detection
- Python 3.8 or higher
- Optional dependencies for enhanced features (see below)
- Clone the repository:
git clone https://github.com/yourusername/expense-tracker.git
cd expense-tracker- Install the application:
pip install -e .For full functionality including charts and Excel export:
pip install -e .[full]Or install specific feature sets:
# For chart generation
pip install -e .[charts]
# For Excel export
pip install -e .[excel]
# For enhanced GUI features
pip install -e .[gui]For development with testing tools:
pip install -e .[dev]Start the application with various options:
# Start with GUI interface (default)
python main.py
# Start with console interface
python main.py --console
# Use custom data file
python main.py --data /path/to/custom/data.json
# Show application information
python main.py --info
# Validate data integrity
python main.py --validate
# Create data backup
python main.py --backup
# Restore from backup
python main.py --restore backup_file.json
# Set logging level
python main.py --log-level DEBUGThe console interface provides a menu-driven experience:
-
Transaction Management
- Add new transactions
- View and filter transactions
- Edit existing transactions
- Delete transactions
-
Category Management
- View categories
- Add custom categories
- Manage category types
-
Reports and Analytics
- View financial summaries
- Generate category breakdowns
- Create date range reports
-
Data Operations
- Export data to files
- Generate charts
- Backup and restore data
The GUI interface offers:
- Main Dashboard: Overview of financial status
- Transaction Entry: Easy-to-use forms for adding transactions
- Transaction List: Sortable and filterable transaction view
- Reports Window: Tabular reports with export options
- Chart Display: Interactive charts and graphs
- Settings Panel: Application configuration options
{
"id": "unique_transaction_id",
"amount": 50.00,
"description": "Grocery shopping",
"type": "EXPENSE",
"category": "Food & Dining",
"date": "2024-01-15T10:30:00",
"created_at": "2024-01-15T10:30:00",
"updated_at": "2024-01-15T10:30:00"
}{
"name": "Food & Dining",
"type": "EXPENSE",
"is_default": true,
"created_at": "2024-01-01T00:00:00"
}By default, data is stored in data/expense_data.json. You can specify a custom location:
python main.py --data /path/to/your/data.jsonApplication settings are stored within the data file:
{
"settings": {
"currency": "USD",
"date_format": "YYYY-MM-DD",
"decimal_places": 2,
"auto_backup": true,
"backup_frequency": "daily"
}
}- Backups are created automatically before data modifications
- Stored in the
backups/directory - Configurable backup frequency
# Create backup
python main.py --backup
# Restore from backup
python main.py --restore backup_file.json- List available backups
- Automatic cleanup of old backups
- Backup validation before restoration
- Amount validation (positive numbers, proper decimal places)
- Date validation (valid dates, reasonable ranges)
- Description validation (length, character restrictions)
- Category validation (valid types, naming conventions)
- Duplicate transaction ID detection
- Missing required fields validation
- Data type consistency checks
- Referential integrity validation
- Comprehensive error messages
- Graceful degradation on errors
- Automatic recovery suggestions
- Detailed logging for troubleshooting
- Summary Report: Total income, expenses, and net balance
- Category Breakdown: Spending by category
- Monthly Reports: Month-by-month analysis
- Date Range Reports: Custom period analysis
- Pie Charts: Category distribution
- Bar Charts: Monthly spending trends
- Line Charts: Balance over time
- Export Options: Save charts as images
- CSV: Compatible with spreadsheet applications
- Excel: Full-featured Excel workbooks with formatting
- JSON: Raw data export for integration
expense-tracker/
├── expense_tracker/ # Main application package
│ ├── models/ # Data models
│ ├── repositories/ # Data access layer
│ ├── services/ # Business logic
│ ├── ui/ # User interfaces
│ ├── controllers/ # Application controllers
│ └── utils/ # Utilities and helpers
├── tests/ # Unit tests
├── data/ # Default data directory
├── backups/ # Backup storage
├── main.py # Application entry point
├── setup.py # Installation configuration
└── requirements.txt # Dependencies
# Run all tests
python -m pytest
# Run with coverage
python -m pytest --cov=expense_tracker
# Run specific test file
python -m pytest tests/test_models/test_transaction.py# Format code
black expense_tracker/ tests/
# Lint code
flake8 expense_tracker/ tests/
# Type checking (if using mypy)
mypy expense_tracker/- Repository Pattern: Data access abstraction
- Service Layer: Business logic separation
- MVC Pattern: Clear separation of concerns
- Observer Pattern: UI updates and notifications
- Models: Data structures and validation
- Repositories: Data persistence and retrieval
- Services: Business logic and operations
- Controllers: Application coordination
- UI: User interface implementations
- Utils: Shared utilities and helpers
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow PEP 8 style guidelines
- Write comprehensive tests
- Document new features
- Update README for significant changes
- Use meaningful commit messages
Data file not found
- The application will create a new data file automatically
- Check file permissions if creation fails
Import errors
- Ensure all dependencies are installed
- Check Python version compatibility
GUI not displaying
- Verify display environment variables
- Use
--consoleflag as alternative
Backup/restore failures
- Check file permissions
- Verify backup file integrity
- Ensure sufficient disk space
Enable debug logging for troubleshooting:
python main.py --log-level DEBUGLogs include:
- Application startup and shutdown
- Data operations and validation
- Error details and stack traces
- Performance metrics
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Python standard library for maximum compatibility
- Uses tkinter for cross-platform GUI support
- Matplotlib for chart generation
- openpyxl for Excel export functionality
- Initial release
- Complete transaction and category management
- Dual interface support (console and GUI)
- Comprehensive reporting and analytics
- Data export and backup capabilities
- Full test coverage
For support, please:
- Check the troubleshooting section
- Review existing issues on GitHub
- Create a new issue with detailed information
- Include logs and system information
Future enhancements may include:
- Web interface
- Mobile app companion
- Cloud synchronization
- Advanced analytics and forecasting
- Multi-currency support
- Receipt scanning and OCR
- Integration with banking APIs