Skip to content

Latest commit

Β 

History

History
143 lines (109 loc) Β· 2.97 KB

File metadata and controls

143 lines (109 loc) Β· 2.97 KB

πŸ“‹ Tasker

A beginner-friendly Python package for managing tasks from the command line.
Built with Python + Click. Tasks are stored in ~/.tasker_data.json so they survive between terminal sessions.


πŸ“ Project Structure

tasker/
β”œβ”€β”€ pyproject.toml          ← package config & dependencies
β”œβ”€β”€ requirements.txt        ← dependencies list
β”œβ”€β”€ README.md
β”œβ”€β”€ LICENSE
β”œβ”€β”€ src/
β”‚   └── tasker/
β”‚       β”œβ”€β”€ __init__.py     ← public API
β”‚       β”œβ”€β”€ manager.py      ← core logic (TaskManager class)
β”‚       └── cli.py          ← Click CLI commands
└── tests/
    └── test_manager.py     ← unit tests

βš™οΈ Installation

Option A β€” Install as a package (recommended)

git clone https://github.com/gautam-oss/tasker.git
cd tasker
python -m venv venv
source venv/bin/activate        # Windows: venv\Scripts\activate
pip install -e .

Option B β€” Install dependencies only

pip install -r requirements.txt

πŸš€ CLI Usage

After installation the tasker command is available anywhere in your terminal.

βž• Add a task

tasker add-task "Buy groceries"
tasker add-task "Write unit tests"

πŸ“‹ List all tasks

tasker list-tasks

πŸ” List only pending tasks

tasker list-tasks --pending

βœ… Mark a task as complete

tasker complete-task 1

πŸ—‘οΈ Delete a task

tasker delete-task 2

❓ Built-in help

tasker --help
tasker add-task --help

🐍 Use as a Python Library

from tasker import TaskManager

manager = TaskManager()

task = manager.add_task("Learn Python packaging")
print(task.task_id, task.title)   # 1  Learn Python packaging

manager.complete_task(task.task_id)

for t in manager.list_tasks():
    status = "βœ”" if t.completed else "β—‹"
    print(f"[{status}] {t.task_id}. {t.title}")

πŸ’Ύ Data Storage

Tasks are saved to ~/.tasker_data.json automatically. You can inspect it anytime:

cat ~/.tasker_data.json
[
  {
    "task_id": 1,
    "title": "Buy groceries",
    "completed": true,
    "created_at": "2024-01-15 10:30:00"
  }
]

πŸ§ͺ Running Tests

pip install pytest
pytest tests/ -v

Expected: 12 tests passing βœ…


πŸ—οΈ How It Works

File Role
manager.py Task class + TaskManager β€” all logic for add/list/complete/delete, reads & writes JSON
cli.py Click commands that wrap TaskManager with coloured terminal output
__init__.py Makes tasker importable as a Python library
pyproject.toml Declares click dependency, registers tasker console script entry point
requirements.txt Flat list of dependencies for manual installs

πŸ“œ License

MIT Β© 2026 Gautam Kumar