aishwarya-task-manager-cli 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Aishwarya
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,107 @@
1
+ Metadata-Version: 2.4
2
+ Name: aishwarya-task-manager-cli
3
+ Version: 0.1.0
4
+ Summary: A command-line task manager written in Python.
5
+ Author: Aishwarya
6
+ License-Expression: MIT
7
+ Keywords: cli,tasks,productivity
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Environment :: Console
10
+ Classifier: Intended Audience :: End Users/Desktop
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3 :: Only
13
+ Requires-Python: >=3.11
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Provides-Extra: dev
17
+ Requires-Dist: build; extra == "dev"
18
+ Requires-Dist: pytest; extra == "dev"
19
+ Requires-Dist: pytest-cov; extra == "dev"
20
+ Requires-Dist: ruff; extra == "dev"
21
+ Requires-Dist: twine; extra == "dev"
22
+ Dynamic: license-file
23
+
24
+ # Task Manager CLI
25
+
26
+ A simple command-line task manager written in Python.
27
+
28
+ ## Features
29
+
30
+ - Add tasks
31
+ - List tasks
32
+ - Mark tasks as completed
33
+ - Delete tasks
34
+ - Save tasks between runs in a JSON file
35
+
36
+ ## Requirements
37
+
38
+ - Python 3.11 or newer
39
+
40
+ ## Development setup
41
+
42
+ Create and activate a virtual environment:
43
+
44
+ ```powershell
45
+ python -m venv .venv
46
+ .\.venv\Scripts\Activate.ps1
47
+ ```
48
+
49
+ Install the package and its development tools:
50
+
51
+ ```powershell
52
+ python -m pip install --editable ".[dev]"
53
+ ```
54
+
55
+ ## Usage
56
+
57
+ Display help:
58
+
59
+ ```powershell
60
+ tasker --help
61
+ ```
62
+
63
+ Add a task:
64
+
65
+ ```powershell
66
+ tasker add "Review Python basics"
67
+ ```
68
+
69
+ List tasks:
70
+
71
+ ```powershell
72
+ tasker list
73
+ ```
74
+
75
+ Complete a task:
76
+
77
+ ```powershell
78
+ tasker complete 1
79
+ ```
80
+
81
+ Delete a task:
82
+
83
+ ```powershell
84
+ tasker delete 1
85
+ ```
86
+
87
+ Tasks are stored in `tasks.json` in the current directory.
88
+
89
+ ## Quality checks
90
+
91
+ Check the code:
92
+
93
+ ```powershell
94
+ ruff check .
95
+ ```
96
+
97
+ Run the tests:
98
+
99
+ ```powershell
100
+ pytest
101
+ ```
102
+
103
+ Run tests with coverage:
104
+
105
+ ```powershell
106
+ pytest --cov=task_manager --cov-report=term-missing
107
+ ```
@@ -0,0 +1,84 @@
1
+ # Task Manager CLI
2
+
3
+ A simple command-line task manager written in Python.
4
+
5
+ ## Features
6
+
7
+ - Add tasks
8
+ - List tasks
9
+ - Mark tasks as completed
10
+ - Delete tasks
11
+ - Save tasks between runs in a JSON file
12
+
13
+ ## Requirements
14
+
15
+ - Python 3.11 or newer
16
+
17
+ ## Development setup
18
+
19
+ Create and activate a virtual environment:
20
+
21
+ ```powershell
22
+ python -m venv .venv
23
+ .\.venv\Scripts\Activate.ps1
24
+ ```
25
+
26
+ Install the package and its development tools:
27
+
28
+ ```powershell
29
+ python -m pip install --editable ".[dev]"
30
+ ```
31
+
32
+ ## Usage
33
+
34
+ Display help:
35
+
36
+ ```powershell
37
+ tasker --help
38
+ ```
39
+
40
+ Add a task:
41
+
42
+ ```powershell
43
+ tasker add "Review Python basics"
44
+ ```
45
+
46
+ List tasks:
47
+
48
+ ```powershell
49
+ tasker list
50
+ ```
51
+
52
+ Complete a task:
53
+
54
+ ```powershell
55
+ tasker complete 1
56
+ ```
57
+
58
+ Delete a task:
59
+
60
+ ```powershell
61
+ tasker delete 1
62
+ ```
63
+
64
+ Tasks are stored in `tasks.json` in the current directory.
65
+
66
+ ## Quality checks
67
+
68
+ Check the code:
69
+
70
+ ```powershell
71
+ ruff check .
72
+ ```
73
+
74
+ Run the tests:
75
+
76
+ ```powershell
77
+ pytest
78
+ ```
79
+
80
+ Run tests with coverage:
81
+
82
+ ```powershell
83
+ pytest --cov=task_manager --cov-report=term-missing
84
+ ```
@@ -0,0 +1,47 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "aishwarya-task-manager-cli"
7
+ version = "0.1.0"
8
+ description = "A command-line task manager written in Python."
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ authors = [
12
+ { name = "Aishwarya" }
13
+ ]
14
+ dependencies = []
15
+ license = "MIT"
16
+ license-files = ["LICENSE"]
17
+ keywords = ["cli", "tasks", "productivity"]
18
+
19
+ classifiers = [
20
+ "Development Status :: 3 - Alpha",
21
+ "Environment :: Console",
22
+ "Intended Audience :: End Users/Desktop",
23
+ "Programming Language :: Python :: 3",
24
+ "Programming Language :: Python :: 3 :: Only",
25
+ ]
26
+
27
+ [project.optional-dependencies]
28
+ dev = [
29
+ "build",
30
+ "pytest",
31
+ "pytest-cov",
32
+ "ruff",
33
+ "twine",
34
+ ]
35
+
36
+ [project.scripts]
37
+ tasker = "task_manager.cli:main"
38
+
39
+ [tool.setuptools.packages.find]
40
+ where = ["src"]
41
+
42
+ [tool.pytest.ini_options]
43
+ testpaths = ["tests"]
44
+
45
+ [tool.ruff]
46
+ line-length = 88
47
+ target-version = "py311"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,107 @@
1
+ Metadata-Version: 2.4
2
+ Name: aishwarya-task-manager-cli
3
+ Version: 0.1.0
4
+ Summary: A command-line task manager written in Python.
5
+ Author: Aishwarya
6
+ License-Expression: MIT
7
+ Keywords: cli,tasks,productivity
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Environment :: Console
10
+ Classifier: Intended Audience :: End Users/Desktop
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3 :: Only
13
+ Requires-Python: >=3.11
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Provides-Extra: dev
17
+ Requires-Dist: build; extra == "dev"
18
+ Requires-Dist: pytest; extra == "dev"
19
+ Requires-Dist: pytest-cov; extra == "dev"
20
+ Requires-Dist: ruff; extra == "dev"
21
+ Requires-Dist: twine; extra == "dev"
22
+ Dynamic: license-file
23
+
24
+ # Task Manager CLI
25
+
26
+ A simple command-line task manager written in Python.
27
+
28
+ ## Features
29
+
30
+ - Add tasks
31
+ - List tasks
32
+ - Mark tasks as completed
33
+ - Delete tasks
34
+ - Save tasks between runs in a JSON file
35
+
36
+ ## Requirements
37
+
38
+ - Python 3.11 or newer
39
+
40
+ ## Development setup
41
+
42
+ Create and activate a virtual environment:
43
+
44
+ ```powershell
45
+ python -m venv .venv
46
+ .\.venv\Scripts\Activate.ps1
47
+ ```
48
+
49
+ Install the package and its development tools:
50
+
51
+ ```powershell
52
+ python -m pip install --editable ".[dev]"
53
+ ```
54
+
55
+ ## Usage
56
+
57
+ Display help:
58
+
59
+ ```powershell
60
+ tasker --help
61
+ ```
62
+
63
+ Add a task:
64
+
65
+ ```powershell
66
+ tasker add "Review Python basics"
67
+ ```
68
+
69
+ List tasks:
70
+
71
+ ```powershell
72
+ tasker list
73
+ ```
74
+
75
+ Complete a task:
76
+
77
+ ```powershell
78
+ tasker complete 1
79
+ ```
80
+
81
+ Delete a task:
82
+
83
+ ```powershell
84
+ tasker delete 1
85
+ ```
86
+
87
+ Tasks are stored in `tasks.json` in the current directory.
88
+
89
+ ## Quality checks
90
+
91
+ Check the code:
92
+
93
+ ```powershell
94
+ ruff check .
95
+ ```
96
+
97
+ Run the tests:
98
+
99
+ ```powershell
100
+ pytest
101
+ ```
102
+
103
+ Run tests with coverage:
104
+
105
+ ```powershell
106
+ pytest --cov=task_manager --cov-report=term-missing
107
+ ```
@@ -0,0 +1,14 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/aishwarya_task_manager_cli.egg-info/PKG-INFO
5
+ src/aishwarya_task_manager_cli.egg-info/SOURCES.txt
6
+ src/aishwarya_task_manager_cli.egg-info/dependency_links.txt
7
+ src/aishwarya_task_manager_cli.egg-info/entry_points.txt
8
+ src/aishwarya_task_manager_cli.egg-info/requires.txt
9
+ src/aishwarya_task_manager_cli.egg-info/top_level.txt
10
+ src/task_manager/__init__.py
11
+ src/task_manager/cli.py
12
+ src/task_manager/storage.py
13
+ tests/test_cli.py
14
+ tests/test_storage.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ tasker = task_manager.cli:main
@@ -0,0 +1,7 @@
1
+
2
+ [dev]
3
+ build
4
+ pytest
5
+ pytest-cov
6
+ ruff
7
+ twine
@@ -0,0 +1,3 @@
1
+ """A command-line task manager."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,113 @@
1
+ """Command-line interface for the task manager."""
2
+
3
+ from argparse import ArgumentParser, Namespace
4
+
5
+ from task_manager.storage import (
6
+ add_task,
7
+ complete_task,
8
+ delete_task,
9
+ load_tasks,
10
+ )
11
+
12
+
13
+ def build_parser() -> ArgumentParser:
14
+ """Create and configure the command-line argument parser."""
15
+ parser = ArgumentParser(
16
+ prog="tasker",
17
+ description="Create and manage tasks from the command line.",
18
+ )
19
+ parser.add_argument(
20
+ "--version",
21
+ action="version",
22
+ version="%(prog)s 0.1.0",
23
+ )
24
+
25
+ subparsers = parser.add_subparsers(
26
+ dest="command",
27
+ required=True,
28
+ )
29
+
30
+ add_parser = subparsers.add_parser(
31
+ "add",
32
+ help="Add a new task.",
33
+ )
34
+ add_parser.add_argument(
35
+ "title",
36
+ help="Description of the task.",
37
+ )
38
+
39
+ subparsers.add_parser(
40
+ "list",
41
+ help="List all tasks.",
42
+ )
43
+
44
+ complete_parser = subparsers.add_parser(
45
+ "complete",
46
+ help="Mark a task as completed.",
47
+ )
48
+ complete_parser.add_argument(
49
+ "task_id",
50
+ type=int,
51
+ help="ID of the task to complete.",
52
+ )
53
+
54
+ delete_parser = subparsers.add_parser(
55
+ "delete",
56
+ help="Delete a task.",
57
+ )
58
+ delete_parser.add_argument(
59
+ "task_id",
60
+ type=int,
61
+ help="ID of the task to delete.",
62
+ )
63
+
64
+ return parser
65
+
66
+
67
+ def handle_command(args: Namespace) -> None:
68
+ """Handle the command selected by the user."""
69
+ if args.command == "add":
70
+ if not args.title.strip():
71
+ print("Task title cannot be empty.")
72
+ return
73
+
74
+ task = add_task(args.title)
75
+ print(f'Added task {task["id"]}: {task["title"]}')
76
+
77
+ elif args.command == "list":
78
+ tasks = load_tasks()
79
+
80
+ if not tasks:
81
+ print("No tasks found.")
82
+ return
83
+
84
+ for task in tasks:
85
+ marker = "x" if task["completed"] else " "
86
+ print(f'[{marker}] {task["id"]}: {task["title"]}')
87
+
88
+ elif args.command == "complete":
89
+ task = complete_task(args.task_id)
90
+
91
+ if task is None:
92
+ print(f"Task {args.task_id} was not found.")
93
+ else:
94
+ print(f'Completed task {task["id"]}: {task["title"]}')
95
+
96
+ elif args.command == "delete":
97
+ task = delete_task(args.task_id)
98
+
99
+ if task is None:
100
+ print(f"Task {args.task_id} was not found.")
101
+ else:
102
+ print(f'Deleted task {task["id"]}: {task["title"]}')
103
+
104
+
105
+ def main() -> None:
106
+ """Run the task manager CLI."""
107
+ parser = build_parser()
108
+ args = parser.parse_args()
109
+ handle_command(args)
110
+
111
+
112
+ if __name__ == "__main__":
113
+ main()
@@ -0,0 +1,85 @@
1
+ """Read and write task data."""
2
+
3
+ import json
4
+ from pathlib import Path
5
+ from typing import TypedDict
6
+
7
+
8
+ class Task(TypedDict):
9
+ """Structure of one task."""
10
+
11
+ id: int
12
+ title: str
13
+ completed: bool
14
+
15
+
16
+ DEFAULT_TASKS_FILE = Path("tasks.json")
17
+
18
+
19
+ def load_tasks(file_path: Path = DEFAULT_TASKS_FILE) -> list[Task]:
20
+ """Load tasks from a JSON file."""
21
+ if not file_path.exists():
22
+ return []
23
+
24
+ with file_path.open(encoding="utf-8") as file:
25
+ return json.load(file)
26
+
27
+
28
+ def save_tasks(
29
+ tasks: list[Task],
30
+ file_path: Path = DEFAULT_TASKS_FILE,
31
+ ) -> None:
32
+ """Save tasks to a JSON file."""
33
+ with file_path.open("w", encoding="utf-8") as file:
34
+ json.dump(tasks, file, indent=2, ensure_ascii=False)
35
+
36
+
37
+ def add_task(
38
+ title: str,
39
+ file_path: Path = DEFAULT_TASKS_FILE,
40
+ ) -> Task:
41
+ """Create and save a new task."""
42
+ tasks = load_tasks(file_path)
43
+ next_id = max((task["id"] for task in tasks), default=0) + 1
44
+
45
+ task: Task = {
46
+ "id": next_id,
47
+ "title": title.strip(),
48
+ "completed": False,
49
+ }
50
+
51
+ tasks.append(task)
52
+ save_tasks(tasks, file_path)
53
+ return task
54
+
55
+
56
+ def complete_task(
57
+ task_id: int,
58
+ file_path: Path = DEFAULT_TASKS_FILE,
59
+ ) -> Task | None:
60
+ """Mark a task as completed."""
61
+ tasks = load_tasks(file_path)
62
+
63
+ for task in tasks:
64
+ if task["id"] == task_id:
65
+ task["completed"] = True
66
+ save_tasks(tasks, file_path)
67
+ return task
68
+
69
+ return None
70
+
71
+
72
+ def delete_task(
73
+ task_id: int,
74
+ file_path: Path = DEFAULT_TASKS_FILE,
75
+ ) -> Task | None:
76
+ """Delete a task."""
77
+ tasks = load_tasks(file_path)
78
+
79
+ for index, task in enumerate(tasks):
80
+ if task["id"] == task_id:
81
+ deleted_task = tasks.pop(index)
82
+ save_tasks(tasks, file_path)
83
+ return deleted_task
84
+
85
+ return None
@@ -0,0 +1,104 @@
1
+ """Tests for the command-line interface."""
2
+
3
+ import sys
4
+ from pathlib import Path
5
+
6
+ import pytest
7
+
8
+ from task_manager.cli import main
9
+
10
+
11
+ def run_cli(
12
+ monkeypatch: pytest.MonkeyPatch,
13
+ *arguments: str,
14
+ ) -> None:
15
+ """Run the CLI with the supplied arguments."""
16
+ monkeypatch.setattr(sys, "argv", ["tasker", *arguments])
17
+ main()
18
+
19
+
20
+ def test_list_command_with_no_tasks(
21
+ tmp_path: Path,
22
+ monkeypatch: pytest.MonkeyPatch,
23
+ capsys: pytest.CaptureFixture[str],
24
+ ) -> None:
25
+ """Listing an empty task collection should display a helpful message."""
26
+ monkeypatch.chdir(tmp_path)
27
+
28
+ run_cli(monkeypatch, "list")
29
+
30
+ assert capsys.readouterr().out == "No tasks found.\n"
31
+
32
+
33
+ def test_add_and_list_commands(
34
+ tmp_path: Path,
35
+ monkeypatch: pytest.MonkeyPatch,
36
+ capsys: pytest.CaptureFixture[str],
37
+ ) -> None:
38
+ """An added task should appear in the task list."""
39
+ monkeypatch.chdir(tmp_path)
40
+
41
+ run_cli(monkeypatch, "add", "Write automated tests")
42
+ assert capsys.readouterr().out == (
43
+ "Added task 1: Write automated tests\n"
44
+ )
45
+
46
+ run_cli(monkeypatch, "list")
47
+ assert capsys.readouterr().out == (
48
+ "[ ] 1: Write automated tests\n"
49
+ )
50
+
51
+
52
+ def test_complete_and_delete_commands(
53
+ tmp_path: Path,
54
+ monkeypatch: pytest.MonkeyPatch,
55
+ capsys: pytest.CaptureFixture[str],
56
+ ) -> None:
57
+ """A task should be completable and deletable through the CLI."""
58
+ monkeypatch.chdir(tmp_path)
59
+
60
+ run_cli(monkeypatch, "add", "Finish the project")
61
+ capsys.readouterr()
62
+
63
+ run_cli(monkeypatch, "complete", "1")
64
+ assert capsys.readouterr().out == (
65
+ "Completed task 1: Finish the project\n"
66
+ )
67
+
68
+ run_cli(monkeypatch, "list")
69
+ assert capsys.readouterr().out == (
70
+ "[x] 1: Finish the project\n"
71
+ )
72
+
73
+ run_cli(monkeypatch, "delete", "1")
74
+ assert capsys.readouterr().out == (
75
+ "Deleted task 1: Finish the project\n"
76
+ )
77
+
78
+
79
+ def test_missing_task_messages(
80
+ tmp_path: Path,
81
+ monkeypatch: pytest.MonkeyPatch,
82
+ capsys: pytest.CaptureFixture[str],
83
+ ) -> None:
84
+ """Missing task IDs should produce helpful messages."""
85
+ monkeypatch.chdir(tmp_path)
86
+
87
+ run_cli(monkeypatch, "complete", "99")
88
+ assert capsys.readouterr().out == "Task 99 was not found.\n"
89
+
90
+ run_cli(monkeypatch, "delete", "99")
91
+ assert capsys.readouterr().out == "Task 99 was not found.\n"
92
+
93
+
94
+ def test_empty_task_title_is_rejected(
95
+ tmp_path: Path,
96
+ monkeypatch: pytest.MonkeyPatch,
97
+ capsys: pytest.CaptureFixture[str],
98
+ ) -> None:
99
+ """A task title containing only spaces should be rejected."""
100
+ monkeypatch.chdir(tmp_path)
101
+
102
+ run_cli(monkeypatch, "add", " ")
103
+
104
+ assert capsys.readouterr().out == "Task title cannot be empty.\n"
@@ -0,0 +1,68 @@
1
+ """Tests for task storage operations."""
2
+
3
+ from pathlib import Path
4
+
5
+ from task_manager.storage import (
6
+ add_task,
7
+ complete_task,
8
+ delete_task,
9
+ load_tasks,
10
+ )
11
+
12
+
13
+ def test_load_tasks_returns_empty_list_when_file_is_missing(
14
+ tmp_path: Path,
15
+ ) -> None:
16
+ """A missing data file should represent an empty task list."""
17
+ file_path = tmp_path / "tasks.json"
18
+
19
+ assert load_tasks(file_path) == []
20
+
21
+
22
+ def test_add_task_saves_a_new_task(tmp_path: Path) -> None:
23
+ """Adding a task should create and persist it."""
24
+ file_path = tmp_path / "tasks.json"
25
+
26
+ task = add_task("Learn pytest", file_path)
27
+
28
+ assert task == {
29
+ "id": 1,
30
+ "title": "Learn pytest",
31
+ "completed": False,
32
+ }
33
+ assert load_tasks(file_path) == [task]
34
+
35
+
36
+ def test_add_task_assigns_increasing_ids(tmp_path: Path) -> None:
37
+ """Each new task should receive the next available ID."""
38
+ file_path = tmp_path / "tasks.json"
39
+
40
+ first_task = add_task("First task", file_path)
41
+ second_task = add_task("Second task", file_path)
42
+
43
+ assert first_task["id"] == 1
44
+ assert second_task["id"] == 2
45
+
46
+
47
+ def test_complete_task_marks_task_as_completed(tmp_path: Path) -> None:
48
+ """Completing a task should update the saved data."""
49
+ file_path = tmp_path / "tasks.json"
50
+ add_task("Finish project", file_path)
51
+
52
+ completed_task = complete_task(1, file_path)
53
+
54
+ assert completed_task is not None
55
+ assert completed_task["completed"] is True
56
+ assert load_tasks(file_path)[0]["completed"] is True
57
+
58
+
59
+ def test_delete_task_removes_the_task(tmp_path: Path) -> None:
60
+ """Deleting a task should remove it from saved data."""
61
+ file_path = tmp_path / "tasks.json"
62
+ add_task("Temporary task", file_path)
63
+
64
+ deleted_task = delete_task(1, file_path)
65
+
66
+ assert deleted_task is not None
67
+ assert deleted_task["title"] == "Temporary task"
68
+ assert load_tasks(file_path) == []