PomCli 0.1.0__py3-none-any.whl → 0.2.0__py3-none-any.whl
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.
- pomcli/__about__.py +1 -2
- pomcli/pomodoro.py +46 -10
- {pomcli-0.1.0.dist-info → pomcli-0.2.0.dist-info}/METADATA +3 -1
- pomcli-0.2.0.dist-info/RECORD +8 -0
- pomcli-0.1.0.dist-info/RECORD +0 -8
- {pomcli-0.1.0.dist-info → pomcli-0.2.0.dist-info}/WHEEL +0 -0
- {pomcli-0.1.0.dist-info → pomcli-0.2.0.dist-info}/entry_points.txt +0 -0
- {pomcli-0.1.0.dist-info → pomcli-0.2.0.dist-info}/licenses/LICENSE.txt +0 -0
pomcli/__about__.py
CHANGED
pomcli/pomodoro.py
CHANGED
@@ -1,43 +1,79 @@
|
|
1
|
-
import time
|
2
1
|
import logging
|
2
|
+
import time
|
3
|
+
|
3
4
|
|
4
5
|
class PomodoroTimer:
|
5
|
-
def __init__(self, work_minutes=25, break_minutes=5, logger=None):
|
6
|
+
def __init__(self, work_minutes=25, break_minutes=5, repetitions=1, logger=None, use_tqdm=False):
|
7
|
+
"""
|
8
|
+
Initializes the Pomodoro timer.
|
9
|
+
:param work_minutes: Work duration in minutes.
|
10
|
+
:param break_minutes: Break duration in minutes.
|
11
|
+
:param repetitions: Number of Pomodoro repetitions.
|
12
|
+
:param logger: Logger instance for logging messages. If None, a default logger is created.
|
13
|
+
:param use_tqdm: Whether to use tqdm for progress bar display.
|
14
|
+
"""
|
6
15
|
self.work_minutes = work_minutes
|
7
16
|
self.break_minutes = break_minutes
|
17
|
+
self.repetitions = repetitions
|
8
18
|
self.is_running = False
|
19
|
+
if logger is None:
|
20
|
+
logging.basicConfig(level=logging.INFO, format='%(levelname)s:%(message)s')
|
9
21
|
self.logger = logger or logging.getLogger(__name__)
|
10
22
|
|
23
|
+
self.use_tqdm = use_tqdm
|
24
|
+
|
11
25
|
def start(self):
|
26
|
+
"""
|
27
|
+
Starts the Pomodoro timer.
|
28
|
+
"""
|
12
29
|
self.is_running = True
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
30
|
+
for i in range(self.repetitions):
|
31
|
+
self.logger.info(f"Pomodoro round {i + 1} of {self.repetitions}")
|
32
|
+
self.logger.info(f"Starting Pomodoro: {self.work_minutes} minutes of work.")
|
33
|
+
self._countdown(self.work_minutes * 60, "Work")
|
34
|
+
if i < self.repetitions - 1:
|
35
|
+
self.logger.info(f"Time for a break: {self.break_minutes} minutes.")
|
17
36
|
self.logger.info("Pomodoro session complete!")
|
18
37
|
self.is_running = False
|
19
38
|
|
20
39
|
def _countdown(self, seconds, label):
|
21
|
-
|
22
|
-
|
40
|
+
if self.use_tqdm:
|
41
|
+
try:
|
42
|
+
from tqdm import tqdm
|
43
|
+
except ImportError:
|
44
|
+
self.logger.warning("tqdm is not installed. Progress bar will not be shown.")
|
45
|
+
tqdm = None
|
46
|
+
else:
|
47
|
+
tqdm = None
|
48
|
+
seconds = int(seconds)
|
49
|
+
iterator = tqdm(range(seconds), desc=f"{label} Timer",
|
50
|
+
ncols=70) if self.use_tqdm and 'tqdm' in locals() and tqdm else range(seconds)
|
51
|
+
for s in iterator:
|
52
|
+
if not self.is_running:
|
53
|
+
break
|
54
|
+
mins, secs = divmod(int(seconds - s - 1), 60)
|
23
55
|
timeformat = f'{mins:02d}:{secs:02d}'
|
24
56
|
self.logger.debug(f'{label} Timer: {timeformat}')
|
25
57
|
time.sleep(1)
|
26
|
-
seconds -= 1
|
27
58
|
|
28
59
|
def stop(self):
|
29
60
|
self.is_running = False
|
30
61
|
self.logger.info("Pomodoro stopped.")
|
31
62
|
|
63
|
+
|
32
64
|
def main():
|
33
65
|
import argparse
|
34
66
|
logging.basicConfig(level=logging.INFO, format='%(message)s')
|
35
67
|
parser = argparse.ArgumentParser(description="Simple Pomodoro CLI Timer")
|
36
68
|
parser.add_argument('--work', type=float, default=25, help='Work duration in minutes (default: 25)')
|
37
69
|
parser.add_argument('--break_time', type=float, default=5, help='Break duration in minutes (default: 5)')
|
70
|
+
parser.add_argument('--repetitions', type=int, default=1, help='Number of Pomodoro repetitions (default: 1)')
|
71
|
+
parser.add_argument('--tqdm', action='store_true', help='Show progress bar using tqdm')
|
38
72
|
args = parser.parse_args()
|
39
|
-
timer = PomodoroTimer(work_minutes=args.work, break_minutes=args.break_time
|
73
|
+
timer = PomodoroTimer(work_minutes=args.work, break_minutes=args.break_time, repetitions=args.repetitions,
|
74
|
+
use_tqdm=args.tqdm)
|
40
75
|
timer.start()
|
41
76
|
|
77
|
+
|
42
78
|
if __name__ == "__main__":
|
43
79
|
main()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: PomCli
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.2.0
|
4
4
|
Summary: A simple Pomodoro timer CLI tool.
|
5
5
|
Project-URL: Documentation, https://github.com/YanivGrosskopf/PomCli#readme
|
6
6
|
Project-URL: Issues, https://github.com/YanivGrosskopf/PomCli/issues
|
@@ -18,6 +18,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
18
18
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
19
19
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
20
20
|
Requires-Python: >=3.8
|
21
|
+
Requires-Dist: tqdm>=4.0.0
|
21
22
|
Description-Content-Type: text/markdown
|
22
23
|
|
23
24
|
# PomCli
|
@@ -49,6 +50,7 @@ pomcli --work 25 --break_time 5
|
|
49
50
|
|
50
51
|
- `--work`: Work duration in minutes (default: 25)
|
51
52
|
- `--break_time`: Break duration in minutes (default: 5)
|
53
|
+
- `--repetitions`: Number of repetitions (default: 1)
|
52
54
|
|
53
55
|
## License
|
54
56
|
|
@@ -0,0 +1,8 @@
|
|
1
|
+
pomcli/__about__.py,sha256=jQQMZf9fwFtHN4EYZ5lzgx1UbtVXBpgSwOPkMlvaIpQ,48
|
2
|
+
pomcli/__init__.py,sha256=2zy7pZumqjDIPLGZmvuOaIVysoyA3_nalte80rBtgVI,51
|
3
|
+
pomcli/pomodoro.py,sha256=JcNetYjsyTINsb3Ui8CuvgBoL1p6soMMdVDR9aLbpDg,3254
|
4
|
+
pomcli-0.2.0.dist-info/METADATA,sha256=A2_kSuDnv2HIvvG6K2I8hCnc_OJ9_8phaVd7BJuwwyY,1719
|
5
|
+
pomcli-0.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
6
|
+
pomcli-0.2.0.dist-info/entry_points.txt,sha256=EsG-SyM-zrCdXBtmq-PEIfzBEXwfpx-KllRdwh-Lp5I,48
|
7
|
+
pomcli-0.2.0.dist-info/licenses/LICENSE.txt,sha256=5zLfrtTszH1_25tE0YXo59VwxkhGCgBOJGxqoXovzGc,1127
|
8
|
+
pomcli-0.2.0.dist-info/RECORD,,
|
pomcli-0.1.0.dist-info/RECORD
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
pomcli/__about__.py,sha256=du_4yJifWeX0m-F8IMXg2XTqlPMFbM-41n3S4E44IqI,49
|
2
|
-
pomcli/__init__.py,sha256=2zy7pZumqjDIPLGZmvuOaIVysoyA3_nalte80rBtgVI,51
|
3
|
-
pomcli/pomodoro.py,sha256=hBCz_u-kUCW7hEVDjRPfjogoVJvQ6gzcIkfJ1m6aoF8,1675
|
4
|
-
pomcli-0.1.0.dist-info/METADATA,sha256=GeoVB6CUP3GGVFbVC62p_VFkQ9dnGpFIWdKl3I9Dv8s,1638
|
5
|
-
pomcli-0.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
6
|
-
pomcli-0.1.0.dist-info/entry_points.txt,sha256=EsG-SyM-zrCdXBtmq-PEIfzBEXwfpx-KllRdwh-Lp5I,48
|
7
|
-
pomcli-0.1.0.dist-info/licenses/LICENSE.txt,sha256=5zLfrtTszH1_25tE0YXo59VwxkhGCgBOJGxqoXovzGc,1127
|
8
|
-
pomcli-0.1.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|