batch24-28 1.2.1__tar.gz → 1.2.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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: batch24-28
3
- Version: 1.2.1
3
+ Version: 1.2.2
4
4
  Summary: A multi featured Python terminal
5
5
  Requires-Python: >=3.7
6
6
  Description-Content-Type: text/markdown
@@ -109,14 +109,26 @@ start_system_monitor()
109
109
 
110
110
  ---
111
111
 
112
- ### 7. File-Watcher & Automation Engine
112
+ ### 7. System Performance Sentinel
113
113
 
114
- Monitor any directory for file system changes in real-time. This utility uses the watchdog library to detect when files are created, modified, or deleted, allowing you to trigger automated tasks.
114
+ Monitor your CPU usage and receive real-time alerts when it exceeds a set threshold.
115
+
116
+ ```python
117
+ from batch24_28 import monitor_performance
118
+
119
+ # Monitor for CPU usage > 80%
120
+ monitor_performance(threshold=80)
121
+ ```
122
+
123
+ ---
124
+
125
+ ### 8. System Performance Sentinel
126
+
127
+ Monitor a directory for file system changes (created, modified, or deleted).
115
128
 
116
129
  ```python
117
130
  from batch24_28 import start_file_watcher
118
131
 
119
- # Starts watching the current directory for file modifications
120
- # Press Ctrl + C to stop the watcher
132
+ # Watch the current directory
121
133
  start_file_watcher(path=".")
122
134
  ```
@@ -100,14 +100,26 @@ start_system_monitor()
100
100
 
101
101
  ---
102
102
 
103
- ### 7. File-Watcher & Automation Engine
103
+ ### 7. System Performance Sentinel
104
104
 
105
- Monitor any directory for file system changes in real-time. This utility uses the watchdog library to detect when files are created, modified, or deleted, allowing you to trigger automated tasks.
105
+ Monitor your CPU usage and receive real-time alerts when it exceeds a set threshold.
106
+
107
+ ```python
108
+ from batch24_28 import monitor_performance
109
+
110
+ # Monitor for CPU usage > 80%
111
+ monitor_performance(threshold=80)
112
+ ```
113
+
114
+ ---
115
+
116
+ ### 8. System Performance Sentinel
117
+
118
+ Monitor a directory for file system changes (created, modified, or deleted).
106
119
 
107
120
  ```python
108
121
  from batch24_28 import start_file_watcher
109
122
 
110
- # Starts watching the current directory for file modifications
111
- # Press Ctrl + C to stop the watcher
123
+ # Watch the current directory
112
124
  start_file_watcher(path=".")
113
125
  ```
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "batch24-28"
3
- version = "1.2.1"
3
+ version = "1.2.2"
4
4
  description = "A multi featured Python terminal"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.7"
@@ -1,9 +1,9 @@
1
- __version__ = "1.2.1"
1
+ __version__ = "1.2.2"
2
2
 
3
3
  from .timers import start_countdown, start_stopwatch, run_interactive_timer
4
4
  from .art import print_hello
5
5
  from .calculator import AdvancedCalculator
6
6
  from .games import RockPaperScissors
7
7
  from .chess_game import TerminalChess
8
- from .monitor import start_system_monitor
9
- from .watcher import start_file_watcher
8
+ from .watcher import start_file_watcher
9
+ from .monitor import monitor_performance
@@ -0,0 +1 @@
1
+ from .calculator import AdvancedCalculator
@@ -0,0 +1,17 @@
1
+ import psutil
2
+ import time
3
+
4
+ def monitor_performance(threshold=90):
5
+ """
6
+ Monitors CPU usage and alerts if it exceeds the threshold.
7
+ """
8
+ print(f"[*] Performance Sentinel active. Monitoring for CPU usage > {threshold}%")
9
+ try:
10
+ while True:
11
+ # interval=1 means it checks over a 1-second period
12
+ cpu_usage = psutil.cpu_percent(interval=1)
13
+ if cpu_usage > threshold:
14
+ print(f"[!] WARNING: High CPU usage detected: {cpu_usage}%")
15
+ time.sleep(1)
16
+ except KeyboardInterrupt:
17
+ print("\n[*] Sentinel stopped.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: batch24-28
3
- Version: 1.2.1
3
+ Version: 1.2.2
4
4
  Summary: A multi featured Python terminal
5
5
  Requires-Python: >=3.7
6
6
  Description-Content-Type: text/markdown
@@ -109,14 +109,26 @@ start_system_monitor()
109
109
 
110
110
  ---
111
111
 
112
- ### 7. File-Watcher & Automation Engine
112
+ ### 7. System Performance Sentinel
113
113
 
114
- Monitor any directory for file system changes in real-time. This utility uses the watchdog library to detect when files are created, modified, or deleted, allowing you to trigger automated tasks.
114
+ Monitor your CPU usage and receive real-time alerts when it exceeds a set threshold.
115
+
116
+ ```python
117
+ from batch24_28 import monitor_performance
118
+
119
+ # Monitor for CPU usage > 80%
120
+ monitor_performance(threshold=80)
121
+ ```
122
+
123
+ ---
124
+
125
+ ### 8. System Performance Sentinel
126
+
127
+ Monitor a directory for file system changes (created, modified, or deleted).
115
128
 
116
129
  ```python
117
130
  from batch24_28 import start_file_watcher
118
131
 
119
- # Starts watching the current directory for file modifications
120
- # Press Ctrl + C to stop the watcher
132
+ # Watch the current directory
121
133
  start_file_watcher(path=".")
122
134
  ```
@@ -4,6 +4,7 @@ src/batch24_28/__init__.py
4
4
  src/batch24_28/art.py
5
5
  src/batch24_28/calculator.py
6
6
  src/batch24_28/chess_game.py
7
+ src/batch24_28/from .py
7
8
  src/batch24_28/games.py
8
9
  src/batch24_28/monitor.py
9
10
  src/batch24_28/timers.py
@@ -1,16 +0,0 @@
1
- import psutil
2
- import time
3
-
4
- def start_system_monitor():
5
- """Displays real-time CPU and Memory usage in the terminal."""
6
- print("Starting System Monitor (Press Ctrl+C to stop)...")
7
- try:
8
- while True:
9
- # Fetch usage percentages
10
- cpu = psutil.cpu_percent(interval=1)
11
- memory = psutil.virtual_memory().percent
12
-
13
- # Print using \r to overwrite the line, keeping the terminal clean
14
- print(f"\rCPU Usage: {cpu}% | Memory Usage: {memory}%", end="", flush=True)
15
- except KeyboardInterrupt:
16
- print("\nMonitoring stopped.")
File without changes