A Cli app that keeps track of time spent on hobbies. This app can track time for multiple hobbies over a period of time. I wanted to measure how much time I actually spend on programming daily.
The application's database model consists of a single entity called "worksessions" with the following attributes:
id
: Primary keydate
: Date when a work session startedactivity
: Name of the activity being trackedstart_time
: Timestamp when a work session startedstop_time
: Timestamp when the current work session stopped
pyClocker offers the following commands.
-
start
: This creates a new record in a database withdate
as current date andstart_time
as current timestamp. If there already exists an on going worksession(a record withdate
as current date andstop_time
as null), the app notifies the user to end the current worksession first. Optionally, one can specify the name of the activity with the flag--activity <activity name>
default activity isprogramming
. -
stop
: Ends the current work session by updating thestop_time
to the current timestamp. This updates thestop_time
of the record in a database that hasdate
as current date,start_time
as the timestamp with the latest value andstop_time
as null, with the current timestamp. If such a record does not exist in the database, the app notifies the user to start a new worksession first. -
today
: Displays the total hours spent on each activity for the current day in a tabular format. -
daily
: Generates a graph showing the hours invested in various hobbies each day.
-
To install the CLI, after activating a virtual environment run
pip install .
-
run
pyClocker init
to set the sqlite database file location. -
Optionally, generate fake data for visualization purposes by navigating to the
fakedatagen
directory and runningpython3 datagen.py
. -
Move the generated SQLite database file (
worksessions.db
) to the location set in step 2. -
Run
pyClocker daily
to visualize the time spent on various activities each day.
- Add the ability to track time for multiple activities.
- Create a plot to visualize time spent in each activity each day over time.
pyClocker relies on the following amazing projects