A command-line application to help users create, track, and analyze habits systematically.
This habit tracker helps users:
- Create and manage habits with customizable tasks
- Track daily/weekly progress
- Monitor habit streaks and success rates
- Analyze performance through detailed statistics
-
Habit Management
- Create habits with multiple tasks for tracking
- Set importance levels and repeat intervals
- Categorization for fine tuning
- Updating and deleting always possible
-
Task Tracking
- Mark tasks as done/ignored
- Multi-selection
- Pause habits temporarily
- Track streaks automatically
-
Analytics
- View success rates
- Track longest streaks
- Filter and sort habits
- Monitor progress over time
- Filter and sort as you please
- Clone the repository using git into a folder of your choice
git clone https://github.com/DaSteff91/Habit_tracker_code- Optional: Create a virtual environment in the folder you will use the app
python -m venv .venv
source .venv/bin/activate- Install dependencies from the requirement.txt
pip install -r requirements.txt- Start the application using
python main.py- Navigation in the menu
- Arrow keys (↑↓) for menu selection
- Enter to confirm
- Space for multiple selection
- Workflow for Tracking
- Create habits in Habit Management
- Track tasks in Task Overview
- Check progress in Analytics
- Get details in the provided help.txt file
Habit Tracker Main Menu
│
├── Task Overview
│ ├── Mark tasks as done
│ ├── Mark tasks as ignored
│ ├── Pause habit
│ ├── Previous/Next Page
│ └── Back to Main Menu
│
├── Habit Management
│ ├── Create New Habit
│ ├── Update Habit
│ ├── Delete Habit
│ ├── Previous/Next Page
│ └── Back to Main Menu
│
├── Analytics
│ ├── Filter Habits
│ ├── Reset View
│ ├── Previous/Next Page
│ └── Back to Main Menu
│
├── Help
└── Exit- Python 3.12+
- SQLite3
- Dependencies in requirements.txt:
- pytest
- prettytables
- questionary
habit-tracker/
├── controllers/
│ ├── habit.py
│ ├── analytics.py
│ └── task.py
│
├── models/
│ ├── habit.py
│ ├── analytics.py
│ └── task.py
│
├── views/
│ ├── habit_ui.py
│ ├── analytics_ui.py
│ ├── task_ui.py
│ ├── core.py
│ └── menui_ui.py
│
├── database/
│ ├── connector.py
│ └── operations.py
│
├── utils/
│ ├── help.txt
│ ├── validators.py
│ └── date_utils.py
│
├── tests/
│ ├── db.py
│ ├── tests/
│ └── conftest.py
│
├── main.py
├── main.db
├── README.md
└── requirements.txtFollowing the model-view-controller pattern and a seperation of concern approach using
- models: Database access layer and business logic
- views: Taking care of the user interface
- controllers: Maintaining interactions between models and views
- database: Ensuring data is stored in a defined manner
- utils: Helper functions and validator
- tests: Test suite for key functionalities
SQLite database (main.db):
- If not existing: Gets created when launching the main.py
- habit table: habit definitions
- task table: task tracking
- Schema and dummy data in the SQlite file
- A dummy data creater is also provided in the project folder
Tests are provided for the basic functionality of the app:
- Creating, updating and deleting a habit
- Inceasing and resetting a streak
- Managing tasks
- Analytics menu functionality
Run test suite:
# Run with detailed output
python -m pytest -v tests/
# Run specific test category
python -m pytest tests/test_models/test_habit.py
python -m pytest tests/test_models/test_task.py
python -m pytest tests/test_models/test_analytics.py- Uses isolated SQLite test database (test.db)
- Auto-creates/removes test database for each session
- Includes fixtures for common test data
MIT License - See LICENSE for details