mail2task 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,105 @@
1
+ Metadata-Version: 2.4
2
+ Name: mail2task
3
+ Version: 0.1.0
4
+ Summary: Extract actionable tasks from emails using Python
5
+ Author: Eby J Kavungal
6
+ Requires-Python: >=3.9
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: dateparser
9
+
10
+ # mail2task
11
+
12
+ Extract actionable tasks from messy emails using Python.
13
+
14
+ ## Features
15
+
16
+ - Extract task-like sentences
17
+ - Detect due dates
18
+ - Detect priority levels
19
+ - Clean JSON output
20
+ - CLI support
21
+
22
+ ---
23
+
24
+ ## Installation
25
+
26
+ ```bash
27
+ pip install mail2task
28
+ ```
29
+
30
+ ---
31
+
32
+ ## Usage
33
+
34
+ ### Python
35
+
36
+ ```python
37
+ from mail2task import extract_tasks
38
+
39
+ email = """
40
+ Please submit the compliance report by Friday.
41
+
42
+ Schedule the onboarding meeting tomorrow.
43
+ """
44
+
45
+ tasks = extract_tasks(email)
46
+
47
+ print(tasks)
48
+ ```
49
+
50
+ ---
51
+
52
+ ### CLI
53
+
54
+ Create a text file:
55
+
56
+ ```text
57
+ Please submit the report by Friday.
58
+ Schedule the client call tomorrow.
59
+ ```
60
+
61
+ Run:
62
+
63
+ ```bash
64
+ mail2task sample_email.txt
65
+ ```
66
+
67
+ Output:
68
+
69
+ ```json
70
+ [
71
+ {
72
+ "title": "submit the report by Friday.",
73
+ "due_date": "2026-05-29T00:00:00",
74
+ "priority": "normal"
75
+ }
76
+ ]
77
+ ```
78
+
79
+ ---
80
+
81
+ ## Example Use Cases
82
+
83
+ - Email automation
84
+ - Productivity apps
85
+ - AI assistants
86
+ - CRM workflows
87
+ - Task management systems
88
+
89
+ ---
90
+
91
+ ## Project Structure
92
+
93
+ ```text
94
+ mail2task/
95
+ ├── src/
96
+ ├── tests/
97
+ ├── README.md
98
+ ├── pyproject.toml
99
+ ```
100
+
101
+ ---
102
+
103
+ ## License
104
+
105
+ MIT License
@@ -0,0 +1,96 @@
1
+ # mail2task
2
+
3
+ Extract actionable tasks from messy emails using Python.
4
+
5
+ ## Features
6
+
7
+ - Extract task-like sentences
8
+ - Detect due dates
9
+ - Detect priority levels
10
+ - Clean JSON output
11
+ - CLI support
12
+
13
+ ---
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ pip install mail2task
19
+ ```
20
+
21
+ ---
22
+
23
+ ## Usage
24
+
25
+ ### Python
26
+
27
+ ```python
28
+ from mail2task import extract_tasks
29
+
30
+ email = """
31
+ Please submit the compliance report by Friday.
32
+
33
+ Schedule the onboarding meeting tomorrow.
34
+ """
35
+
36
+ tasks = extract_tasks(email)
37
+
38
+ print(tasks)
39
+ ```
40
+
41
+ ---
42
+
43
+ ### CLI
44
+
45
+ Create a text file:
46
+
47
+ ```text
48
+ Please submit the report by Friday.
49
+ Schedule the client call tomorrow.
50
+ ```
51
+
52
+ Run:
53
+
54
+ ```bash
55
+ mail2task sample_email.txt
56
+ ```
57
+
58
+ Output:
59
+
60
+ ```json
61
+ [
62
+ {
63
+ "title": "submit the report by Friday.",
64
+ "due_date": "2026-05-29T00:00:00",
65
+ "priority": "normal"
66
+ }
67
+ ]
68
+ ```
69
+
70
+ ---
71
+
72
+ ## Example Use Cases
73
+
74
+ - Email automation
75
+ - Productivity apps
76
+ - AI assistants
77
+ - CRM workflows
78
+ - Task management systems
79
+
80
+ ---
81
+
82
+ ## Project Structure
83
+
84
+ ```text
85
+ mail2task/
86
+ ├── src/
87
+ ├── tests/
88
+ ├── README.md
89
+ ├── pyproject.toml
90
+ ```
91
+
92
+ ---
93
+
94
+ ## License
95
+
96
+ MIT License
@@ -0,0 +1,23 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "mail2task"
7
+ version = "0.1.0"
8
+ description = "Extract actionable tasks from emails using Python"
9
+ authors = [
10
+ { name="Eby J Kavungal" }
11
+ ]
12
+ readme = "README.md"
13
+ requires-python = ">=3.9"
14
+
15
+ dependencies = [
16
+ "dateparser"
17
+ ]
18
+
19
+ [project.scripts]
20
+ mail2task = "mail2task.cli:main"
21
+
22
+ [tool.setuptools.packages.find]
23
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1 @@
1
+ from .extractor import extract_tasks
@@ -0,0 +1,25 @@
1
+ import sys
2
+ import json
3
+ from .extractor import extract_tasks
4
+
5
+
6
+ def main():
7
+ if len(sys.argv) < 2:
8
+ print("Usage: mail2task <file>")
9
+ return
10
+
11
+ file_path = sys.argv[1]
12
+
13
+ try:
14
+ with open(file_path, "r", encoding="utf-8") as f:
15
+ content = f.read()
16
+
17
+ tasks = extract_tasks(content)
18
+
19
+ print(json.dumps(tasks, indent=2))
20
+
21
+ except FileNotFoundError:
22
+ print(f"File not found: {file_path}")
23
+
24
+ except Exception as e:
25
+ print(f"Error: {e}")
@@ -0,0 +1,100 @@
1
+ import re
2
+ import dateparser
3
+
4
+
5
+ ACTION_WORDS = [
6
+ "submit",
7
+ "schedule",
8
+ "send",
9
+ "complete",
10
+ "review",
11
+ "update",
12
+ "prepare",
13
+ "finish",
14
+ "call",
15
+ "email",
16
+ "organize",
17
+ "create",
18
+ "fix"
19
+ ]
20
+
21
+
22
+ PRIORITY_KEYWORDS = {
23
+ "high": ["urgent", "asap", "important", "immediately"],
24
+ "medium": ["soon", "priority"],
25
+ "low": ["later", "whenever"]
26
+ }
27
+
28
+
29
+ def clean_text(text: str):
30
+ return re.sub(r"\s+", " ", text).strip()
31
+
32
+
33
+ def detect_priority(text: str):
34
+ text_lower = text.lower()
35
+
36
+ for level, keywords in PRIORITY_KEYWORDS.items():
37
+ for keyword in keywords:
38
+ if keyword in text_lower:
39
+ return level
40
+
41
+ return "normal"
42
+
43
+
44
+ def extract_due_date(text: str):
45
+ date = dateparser.parse(
46
+ text,
47
+ settings={"PREFER_DATES_FROM": "future"}
48
+ )
49
+
50
+ if date:
51
+ return date.isoformat()
52
+
53
+ return None
54
+
55
+
56
+ def is_task_sentence(text: str):
57
+ text_lower = text.lower()
58
+
59
+ return any(word in text_lower for word in ACTION_WORDS)
60
+
61
+
62
+ def extract_tasks(email_text: str):
63
+ lines = email_text.splitlines()
64
+
65
+ tasks = []
66
+ seen_titles = set()
67
+
68
+ for line in lines:
69
+ line = clean_text(line)
70
+
71
+ if not line:
72
+ continue
73
+
74
+ if len(line.split()) < 3:
75
+ continue
76
+
77
+ if not is_task_sentence(line):
78
+ continue
79
+
80
+ title = re.sub(
81
+ r"\b(please|kindly)\b",
82
+ "",
83
+ line,
84
+ flags=re.IGNORECASE
85
+ ).strip()
86
+
87
+ if title.lower() in seen_titles:
88
+ continue
89
+
90
+ seen_titles.add(title.lower())
91
+
92
+ task = {
93
+ "title": title,
94
+ "due_date": extract_due_date(line),
95
+ "priority": detect_priority(line)
96
+ }
97
+
98
+ tasks.append(task)
99
+
100
+ return tasks
File without changes
@@ -0,0 +1,105 @@
1
+ Metadata-Version: 2.4
2
+ Name: mail2task
3
+ Version: 0.1.0
4
+ Summary: Extract actionable tasks from emails using Python
5
+ Author: Eby J Kavungal
6
+ Requires-Python: >=3.9
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: dateparser
9
+
10
+ # mail2task
11
+
12
+ Extract actionable tasks from messy emails using Python.
13
+
14
+ ## Features
15
+
16
+ - Extract task-like sentences
17
+ - Detect due dates
18
+ - Detect priority levels
19
+ - Clean JSON output
20
+ - CLI support
21
+
22
+ ---
23
+
24
+ ## Installation
25
+
26
+ ```bash
27
+ pip install mail2task
28
+ ```
29
+
30
+ ---
31
+
32
+ ## Usage
33
+
34
+ ### Python
35
+
36
+ ```python
37
+ from mail2task import extract_tasks
38
+
39
+ email = """
40
+ Please submit the compliance report by Friday.
41
+
42
+ Schedule the onboarding meeting tomorrow.
43
+ """
44
+
45
+ tasks = extract_tasks(email)
46
+
47
+ print(tasks)
48
+ ```
49
+
50
+ ---
51
+
52
+ ### CLI
53
+
54
+ Create a text file:
55
+
56
+ ```text
57
+ Please submit the report by Friday.
58
+ Schedule the client call tomorrow.
59
+ ```
60
+
61
+ Run:
62
+
63
+ ```bash
64
+ mail2task sample_email.txt
65
+ ```
66
+
67
+ Output:
68
+
69
+ ```json
70
+ [
71
+ {
72
+ "title": "submit the report by Friday.",
73
+ "due_date": "2026-05-29T00:00:00",
74
+ "priority": "normal"
75
+ }
76
+ ]
77
+ ```
78
+
79
+ ---
80
+
81
+ ## Example Use Cases
82
+
83
+ - Email automation
84
+ - Productivity apps
85
+ - AI assistants
86
+ - CRM workflows
87
+ - Task management systems
88
+
89
+ ---
90
+
91
+ ## Project Structure
92
+
93
+ ```text
94
+ mail2task/
95
+ ├── src/
96
+ ├── tests/
97
+ ├── README.md
98
+ ├── pyproject.toml
99
+ ```
100
+
101
+ ---
102
+
103
+ ## License
104
+
105
+ MIT License
@@ -0,0 +1,13 @@
1
+ README.md
2
+ pyproject.toml
3
+ src/mail2task/__init__.py
4
+ src/mail2task/cli.py
5
+ src/mail2task/extractor.py
6
+ src/mail2task/parser.py
7
+ src/mail2task.egg-info/PKG-INFO
8
+ src/mail2task.egg-info/SOURCES.txt
9
+ src/mail2task.egg-info/dependency_links.txt
10
+ src/mail2task.egg-info/entry_points.txt
11
+ src/mail2task.egg-info/requires.txt
12
+ src/mail2task.egg-info/top_level.txt
13
+ tests/test_extractor.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ mail2task = mail2task.cli:main
@@ -0,0 +1 @@
1
+ dateparser
@@ -0,0 +1 @@
1
+ mail2task
@@ -0,0 +1,12 @@
1
+ from mail2task import extract_tasks
2
+
3
+
4
+ def test_extract_tasks():
5
+ email = """
6
+ Please submit the report by Friday.
7
+ Schedule the meeting tomorrow.
8
+ """
9
+
10
+ tasks = extract_tasks(email)
11
+
12
+ assert len(tasks) >= 1