tasktracker-utils 0.1.0__tar.gz → 0.1.2__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.
@@ -1,18 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tasktracker-utils
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: Task Tracker utility library - validators and analytics
5
5
  Home-page: https://github.com/yogesh2881/task-traker
6
6
  Author: Yogesh
7
7
  Author-email: yogieecm@gmail.com
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Operating System :: OS Independent
11
8
  Requires-Python: >=3.9
12
9
  Description-Content-Type: text/markdown
13
10
  Dynamic: author
14
11
  Dynamic: author-email
15
- Dynamic: classifier
16
12
  Dynamic: description
17
13
  Dynamic: description-content-type
18
14
  Dynamic: home-page
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="tasktracker-utils",
5
- version="0.1.0",
5
+ version="0.1.2",
6
6
  author="Yogesh",
7
7
  author_email="yogieecm@gmail.com",
8
8
  description="Task Tracker utility library - validators and analytics",
@@ -10,11 +10,5 @@ setup(
10
10
  long_description_content_type="text/markdown",
11
11
  url="https://github.com/yogesh2881/task-traker",
12
12
  packages=find_packages(),
13
- classifiers=[
14
- "Programming Language :: Python :: 3",
15
- "License :: OSI Approved :: MIT License",
16
- "Operating System :: OS Independent",
17
- ],
18
13
  python_requires=">=3.9",
19
- install_requires=[],
20
- )
14
+ )
@@ -0,0 +1,4 @@
1
+ from .validators import TaskValidator
2
+ from .analytics import AnalyticsEngine
3
+
4
+ __all__ = ["TaskValidator", "AnalyticsEngine"]
@@ -0,0 +1,28 @@
1
+ from typing import Dict, List
2
+ from collections import defaultdict
3
+
4
+ class AnalyticsEngine:
5
+ """Provides analytics and calculations for tasks and projects"""
6
+
7
+ @staticmethod
8
+ def calculate_completion(tasks: List[Dict]) -> float:
9
+ if not tasks:
10
+ return 0.0
11
+ done_count = sum(1 for t in tasks if t.get("status") == "done")
12
+ return round((done_count / len(tasks)) * 100, 2)
13
+
14
+ @staticmethod
15
+ def get_status_counts(tasks: List[Dict]) -> Dict[str, int]:
16
+ return {
17
+ "pending": sum(1 for t in tasks if t.get("status") == "pending"),
18
+ "in_progress": sum(1 for t in tasks if t.get("status") == "in_progress"),
19
+ "done": sum(1 for t in tasks if t.get("status") == "done"),
20
+ "blocked": sum(1 for t in tasks if t.get("status") == "blocked")
21
+ }
22
+
23
+ @staticmethod
24
+ def get_tasks_by_project(tasks: List[Dict]) -> Dict[str, int]:
25
+ counts = defaultdict(int)
26
+ for t in tasks:
27
+ counts[t.get("project_id", "unknown")] += 1
28
+ return dict(counts)
@@ -0,0 +1,22 @@
1
+ from datetime import datetime
2
+ from typing import Dict, Any
3
+
4
+ class TaskValidator:
5
+ """Validates task data before saving to DynamoDB"""
6
+
7
+ @staticmethod
8
+ def validate(task_data: Dict[str, Any]) -> Dict[str, Any]:
9
+ if not task_data.get("title") or not str(task_data.get("title")).strip():
10
+ raise ValueError("Task title is required and cannot be empty")
11
+
12
+ if not task_data.get("due_date"):
13
+ raise ValueError("Due date is required")
14
+
15
+ valid_statuses = ["pending", "in_progress", "done", "blocked"]
16
+ if task_data.get("status") not in valid_statuses:
17
+ task_data["status"] = "pending"
18
+
19
+ if "created_at" not in task_data:
20
+ task_data["created_at"] = datetime.utcnow().isoformat()
21
+
22
+ return task_data
@@ -1,18 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tasktracker-utils
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: Task Tracker utility library - validators and analytics
5
5
  Home-page: https://github.com/yogesh2881/task-traker
6
6
  Author: Yogesh
7
7
  Author-email: yogieecm@gmail.com
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Operating System :: OS Independent
11
8
  Requires-Python: >=3.9
12
9
  Description-Content-Type: text/markdown
13
10
  Dynamic: author
14
11
  Dynamic: author-email
15
- Dynamic: classifier
16
12
  Dynamic: description
17
13
  Dynamic: description-content-type
18
14
  Dynamic: home-page
@@ -2,7 +2,8 @@ README.md
2
2
  pyproject.toml
3
3
  setup.py
4
4
  tasktracker_utils/__init__.py
5
- tasktracker_utils/core.py
5
+ tasktracker_utils/analytics.py
6
+ tasktracker_utils/validators.py
6
7
  tasktracker_utils.egg-info/PKG-INFO
7
8
  tasktracker_utils.egg-info/SOURCES.txt
8
9
  tasktracker_utils.egg-info/dependency_links.txt
@@ -1,3 +0,0 @@
1
- from .core import TaskValidator, AnalyticsEngine
2
-
3
- __all__ = ["TaskValidator", "AnalyticsEngine"]
@@ -1,54 +0,0 @@
1
- from datetime import datetime
2
- from typing import Dict, List, Any
3
-
4
- class TaskValidator:
5
- """Validates task data before saving to DynamoDB"""
6
-
7
- @staticmethod
8
- def validate(task_data: Dict[str, Any]) -> Dict[str, Any]:
9
- if not task_data.get("title") or not str(task_data.get("title")).strip():
10
- raise ValueError("Task title is required and cannot be empty")
11
-
12
- if not task_data.get("due_date"):
13
- raise ValueError("Due date is required")
14
-
15
- valid_statuses = ["pending", "in_progress", "done", "blocked"]
16
- if task_data.get("status") not in valid_statuses:
17
- task_data["status"] = "pending"
18
-
19
- # Auto add created_at if missing
20
- if "created_at" not in task_data:
21
- task_data["created_at"] = datetime.utcnow().isoformat()
22
-
23
- return task_data
24
-
25
-
26
- class AnalyticsEngine:
27
- """Provides analytics and calculations for tasks and projects"""
28
-
29
- @staticmethod
30
- def calculate_completion(tasks: List[Dict]) -> float:
31
- """Returns completion percentage (0-100)"""
32
- if not tasks:
33
- return 0.0
34
- done_count = sum(1 for t in tasks if t.get("status") == "done")
35
- return round((done_count / len(tasks)) * 100, 2)
36
-
37
- @staticmethod
38
- def get_status_counts(tasks: List[Dict]) -> Dict[str, int]:
39
- """Returns count of tasks by status"""
40
- return {
41
- "pending": sum(1 for t in tasks if t.get("status") == "pending"),
42
- "in_progress": sum(1 for t in tasks if t.get("status") == "in_progress"),
43
- "done": sum(1 for t in tasks if t.get("status") == "done"),
44
- "blocked": sum(1 for t in tasks if t.get("status") == "blocked")
45
- }
46
-
47
- @staticmethod
48
- def get_tasks_by_project(tasks: List[Dict]) -> Dict[str, int]:
49
- """Group tasks count by project_id"""
50
- from collections import defaultdict
51
- counts = defaultdict(int)
52
- for t in tasks:
53
- counts[t.get("project_id", "unknown")] += 1
54
- return dict(counts)