tqm 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.
- tqm-0.1.0/LICENSE.md +21 -0
- tqm-0.1.0/PKG-INFO +219 -0
- tqm-0.1.0/README.md +190 -0
- tqm-0.1.0/pyproject.toml +77 -0
- tqm-0.1.0/tqm/__init__.py +44 -0
- tqm-0.1.0/tqm/_core/logger.py +123 -0
- tqm-0.1.0/tqm/_core/queue.py +150 -0
- tqm-0.1.0/tqm/_core/settings.py +117 -0
- tqm-0.1.0/tqm/_core/shutdown.py +60 -0
- tqm-0.1.0/tqm/_core/task.py +112 -0
- tqm-0.1.0/tqm/_core/task_actions.py +29 -0
- tqm-0.1.0/tqm/_core/task_base.py +160 -0
- tqm-0.1.0/tqm/_core/task_builder.py +380 -0
- tqm-0.1.0/tqm/_core/task_callbacks.py +38 -0
- tqm-0.1.0/tqm/_core/task_executor.py +470 -0
- tqm-0.1.0/tqm/_core/task_options.py +24 -0
- tqm-0.1.0/tqm/_core/task_predicate.py +88 -0
- tqm-0.1.0/tqm/_core/task_runner.py +110 -0
- tqm-0.1.0/tqm/_core/task_state.py +212 -0
- tqm-0.1.0/tqm/_core/threadpool_interface.py +38 -0
- tqm-0.1.0/tqm/_main.py +172 -0
- tqm-0.1.0/tqm/_resources_rc.py +14737 -0
- tqm-0.1.0/tqm/_ui/context_menu.py +78 -0
- tqm-0.1.0/tqm/_ui/debug_widget.py +208 -0
- tqm-0.1.0/tqm/_ui/font_loader.py +37 -0
- tqm-0.1.0/tqm/_ui/mixins/multi_select_mixin.py +85 -0
- tqm-0.1.0/tqm/_ui/mixins/view_mixin.py +182 -0
- tqm-0.1.0/tqm/_ui/progress_bar_delegate.py +178 -0
- tqm-0.1.0/tqm/_ui/tab_logs.py +121 -0
- tqm-0.1.0/tqm/_ui/task_item.py +25 -0
- tqm-0.1.0/tqm/_ui/toolbar.py +124 -0
- tqm-0.1.0/tqm/_ui/ui_controller.py +270 -0
- tqm-0.1.0/tqm/_ui/ui_view_model.py +281 -0
- tqm-0.1.0/tqm/demo/__init__.py +5 -0
- tqm-0.1.0/tqm/demo/demo.py +313 -0
- tqm-0.1.0/tqm/exceptions.py +26 -0
- tqm-0.1.0/tqm/theme/style.qss +80 -0
- tqm-0.1.0/tqm/typings.py +9 -0
- tqm-0.1.0/tqm/utils/__init__.py +11 -0
- tqm-0.1.0/tqm/utils/extract_fn_name.py +27 -0
- tqm-0.1.0/tqm/utils/open_file.py +42 -0
- tqm-0.1.0/tqm/utils/random_color.py +56 -0
- tqm-0.1.0/tqm/utils/thread_info.py +21 -0
- tqm-0.1.0/tqm/version.py +1 -0
- tqm-0.1.0/tqm/widgets/__init__.py +9 -0
- tqm-0.1.0/tqm/widgets/frame.py +15 -0
- tqm-0.1.0/tqm/widgets/help_widget.py +86 -0
- tqm-0.1.0/tqm/widgets/tool_button.py +11 -0
tqm-0.1.0/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Virgil Sisoe
|
|
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.*
|
tqm-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: tqm
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python-based parallel task queuing and execution framework with PySide2 GUI for efficient workflow management.
|
|
5
|
+
Keywords: task,queue,manager,pyside2,gui,threading,parallel,vfx
|
|
6
|
+
Author: virgilsisoe
|
|
7
|
+
Author-email: 28490646+sisoe24@users.noreply.github.com
|
|
8
|
+
Requires-Python: >=3.7.7,<3.11
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
19
|
+
Classifier: Topic :: Desktop Environment :: Window Managers
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Classifier: Topic :: System :: Monitoring
|
|
22
|
+
Requires-Dist: pyside2 (>=5.15.2.1,<6.0.0.0)
|
|
23
|
+
Requires-Dist: pytest (>=7.4.3,<8.0.0)
|
|
24
|
+
Project-URL: Documentation, https://github.com/sisoe24/tqm#readme
|
|
25
|
+
Project-URL: Homepage, https://github.com/sisoe24/tqm
|
|
26
|
+
Project-URL: Repository, https://github.com/sisoe24/tqm
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# tqm: Task Queue Manager
|
|
30
|
+
|
|
31
|
+
A simple PySide2 no-dependency framework for managing and executing tasks in parallel with a nice UI. Helps you create, queue, and track multiple tasks with dependencies and progress reporting.
|
|
32
|
+
|
|
33
|
+

|
|
34
|
+
|
|
35
|
+
## What is this?
|
|
36
|
+
|
|
37
|
+
TQM lets you run multiple tasks in the background while showing their progress in a UI. It's built with only PySide2 and handles all the complex stuff like threading, dependencies between tasks and UI.
|
|
38
|
+
|
|
39
|
+
Basically, a Task Queue Manager.
|
|
40
|
+
|
|
41
|
+
## Features
|
|
42
|
+
|
|
43
|
+
- **Task Management**
|
|
44
|
+
- Run multiple tasks in parallel (multi-threaded)
|
|
45
|
+
- Create task groups with parent-child relationships
|
|
46
|
+
- Set dependencies so tasks wait for others to finish
|
|
47
|
+
- Retry tasks automatically if they fail
|
|
48
|
+
|
|
49
|
+
- **UI Features**
|
|
50
|
+
- Progress bars (both determinate and indeterminate)
|
|
51
|
+
- Task filtering and search
|
|
52
|
+
- Context menus for task actions
|
|
53
|
+
- Detailed debug view showing task properties
|
|
54
|
+
|
|
55
|
+
- **Developer Features**
|
|
56
|
+
- Simple API for creating and queuing tasks
|
|
57
|
+
- Callbacks for task lifecycle events (start, finish, fail, complete)
|
|
58
|
+
- Predicates to control when tasks should run
|
|
59
|
+
- Customizable task colors and more
|
|
60
|
+
- Comprehensive typing annotations
|
|
61
|
+
|
|
62
|
+
## Installation
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
poetry add tqm
|
|
66
|
+
# or pip
|
|
67
|
+
pip install tqm
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Dependencies:
|
|
71
|
+
- PySide2
|
|
72
|
+
|
|
73
|
+
## Quick Start
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
import time
|
|
77
|
+
from PySide2.QtWidgets import QApplication
|
|
78
|
+
from tqm import TQManager
|
|
79
|
+
|
|
80
|
+
def some_task(task):
|
|
81
|
+
# This will run in a separate thread
|
|
82
|
+
time.sleep(2)
|
|
83
|
+
task.log("Task completed!")
|
|
84
|
+
|
|
85
|
+
# Create the application
|
|
86
|
+
app = QApplication([])
|
|
87
|
+
app.setStyle('Fusion')
|
|
88
|
+
|
|
89
|
+
# Create the task manager window
|
|
90
|
+
task_manager = TQManager(app_name="my_app")
|
|
91
|
+
task_manager.show()
|
|
92
|
+
|
|
93
|
+
# Add a simple task
|
|
94
|
+
task_manager.add_event(
|
|
95
|
+
execute=some_task,
|
|
96
|
+
label="My First Task",
|
|
97
|
+
comment="This is a sample task"
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
# Start executing tasks
|
|
101
|
+
task_manager.start_workers()
|
|
102
|
+
|
|
103
|
+
# Run the application
|
|
104
|
+
app.exec_()
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Examples
|
|
108
|
+
|
|
109
|
+
### Creating a simple task
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
# Add a single task that does something
|
|
113
|
+
task_manager.add_event(
|
|
114
|
+
execute=lambda task: print("Hello, world!"),
|
|
115
|
+
label="Simple Task",
|
|
116
|
+
comment="Prints a greeting"
|
|
117
|
+
)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Creating a task group
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
# Create a group of related tasks
|
|
124
|
+
with task_manager.create_group("Download Files") as group:
|
|
125
|
+
group.add_event(lambda t: t.log("Downloading file 1"), label="File 1")
|
|
126
|
+
group.add_event(lambda t: t.log("Downloading file 2"), label="File 2")
|
|
127
|
+
group.add_event(lambda t: t.log("Downloading file 3"), label="File 3")
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Using the TaskBuilder for more control
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
from tqm import TaskBuilder
|
|
134
|
+
|
|
135
|
+
# Create a task with the builder pattern
|
|
136
|
+
task = (
|
|
137
|
+
TaskBuilder("Complex Task")
|
|
138
|
+
.with_event(lambda t: t.log("Task running..."))
|
|
139
|
+
.with_comment("A task with callbacks")
|
|
140
|
+
.with_on_start(lambda t: print("Starting task"))
|
|
141
|
+
.with_on_completed(lambda t: print("Task completed"))
|
|
142
|
+
.with_on_failed(lambda t: print("Task failed"))
|
|
143
|
+
.with_color("lightblue")
|
|
144
|
+
.with_retry_failed(max_retries=3) # Retry up to 3 times if it fails
|
|
145
|
+
.build()
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
# Add it to the task manager
|
|
149
|
+
task_manager.add_tasks(task)
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Tasks with dependencies
|
|
153
|
+
|
|
154
|
+
```python
|
|
155
|
+
# Create tasks with dependencies
|
|
156
|
+
task1 = TaskBuilder("Task 1").with_event(lambda t: t.log("Task 1 done")).build()
|
|
157
|
+
task2 = (
|
|
158
|
+
TaskBuilder("Task 2")
|
|
159
|
+
.with_event(lambda t: t.log("Task 2 done"))
|
|
160
|
+
.with_wait_for(task1) # This will wait for task1 to complete
|
|
161
|
+
.build()
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
task_manager.add_tasks(task1, task2)
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Configuration
|
|
168
|
+
|
|
169
|
+
tqm stores its settings in:
|
|
170
|
+
- Windows: `%LOCALAPPDATA%\tqm\[app_name]\`
|
|
171
|
+
- Linux/Mac: `~/.config/tqm/[app_name]/`
|
|
172
|
+
|
|
173
|
+
## Environment
|
|
174
|
+
|
|
175
|
+
- `TQM_CONFIG_PATH` - Configuration directory path
|
|
176
|
+
- `TQM_SETTINGS_PATH` - Settings file path
|
|
177
|
+
- `TQM_QSS_PATH` -Qt stylesheet path
|
|
178
|
+
- `TQM_MONO_FONT` - Monospace font family
|
|
179
|
+
- `TQM_DEBUG` - Enables debug logging when set to '1'
|
|
180
|
+
- `TQM_IDLE_TIMEOUT` - Timeout in milliseconds for idle system detection
|
|
181
|
+
|
|
182
|
+
## Python Version Support
|
|
183
|
+
|
|
184
|
+
TQM currently supports Python 3.7+ to ensure compatibility with VFX environments where older Python versions are still common. We intentionally keep zero dependencies (except PySide2) so VFX applications can use TQM right away.
|
|
185
|
+
However, we'll phase out support for older versions with major releases:
|
|
186
|
+
|
|
187
|
+
- Current (0.x): Python 3.7+
|
|
188
|
+
- Future (1.x): Python 3.10+ (dropping 3.7, 3.8, and 3.9 support)
|
|
189
|
+
|
|
190
|
+
Older TQM versions will remain available on the GitHub releases page, but won't receive updates once we move to newer Python versions.
|
|
191
|
+
|
|
192
|
+
## Current Status
|
|
193
|
+
|
|
194
|
+
tqm is still under development but stable enough for most use cases. The core functionality has been battle-tested in production environments for over a year, though this current version is a significant rewrite with improved architecture and features. Some features and documentation might be improved in future updates.
|
|
195
|
+
|
|
196
|
+
See the [GitHub Project](link) for more information.
|
|
197
|
+
|
|
198
|
+
## Theme and style
|
|
199
|
+
|
|
200
|
+
This application was designed under the OS **dark theme** using Qt's **Fusion** style. I have never tried it under light themes or other Qt styles (Windows, macOS native, Breeze, etc.) which means that I assume no responsibility for any eye damage or aesthetic trauma.
|
|
201
|
+
|
|
202
|
+
### Custom Styling
|
|
203
|
+
|
|
204
|
+
The application provides a style.qss file in the default config location which users can modify to customize the appearance of common widgets:
|
|
205
|
+
|
|
206
|
+
- `TqmTabsWidget`
|
|
207
|
+
- `TqmHeaderView`
|
|
208
|
+
- `TqmTasksLogs`
|
|
209
|
+
- `TqmTasksViewToolbar`
|
|
210
|
+
- `TqmSearchBar`
|
|
211
|
+
- `TqmStatusLabel`
|
|
212
|
+
- `TqmTasksTreeView`
|
|
213
|
+
- `TqmFrame`
|
|
214
|
+
- `TqmToolButton`
|
|
215
|
+
|
|
216
|
+
## License
|
|
217
|
+
|
|
218
|
+
This project is licensed under [MIT](./LICENSE.md).
|
|
219
|
+
|
tqm-0.1.0/README.md
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# tqm: Task Queue Manager
|
|
2
|
+
|
|
3
|
+
A simple PySide2 no-dependency framework for managing and executing tasks in parallel with a nice UI. Helps you create, queue, and track multiple tasks with dependencies and progress reporting.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## What is this?
|
|
8
|
+
|
|
9
|
+
TQM lets you run multiple tasks in the background while showing their progress in a UI. It's built with only PySide2 and handles all the complex stuff like threading, dependencies between tasks and UI.
|
|
10
|
+
|
|
11
|
+
Basically, a Task Queue Manager.
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
- **Task Management**
|
|
16
|
+
- Run multiple tasks in parallel (multi-threaded)
|
|
17
|
+
- Create task groups with parent-child relationships
|
|
18
|
+
- Set dependencies so tasks wait for others to finish
|
|
19
|
+
- Retry tasks automatically if they fail
|
|
20
|
+
|
|
21
|
+
- **UI Features**
|
|
22
|
+
- Progress bars (both determinate and indeterminate)
|
|
23
|
+
- Task filtering and search
|
|
24
|
+
- Context menus for task actions
|
|
25
|
+
- Detailed debug view showing task properties
|
|
26
|
+
|
|
27
|
+
- **Developer Features**
|
|
28
|
+
- Simple API for creating and queuing tasks
|
|
29
|
+
- Callbacks for task lifecycle events (start, finish, fail, complete)
|
|
30
|
+
- Predicates to control when tasks should run
|
|
31
|
+
- Customizable task colors and more
|
|
32
|
+
- Comprehensive typing annotations
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
poetry add tqm
|
|
38
|
+
# or pip
|
|
39
|
+
pip install tqm
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Dependencies:
|
|
43
|
+
- PySide2
|
|
44
|
+
|
|
45
|
+
## Quick Start
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
import time
|
|
49
|
+
from PySide2.QtWidgets import QApplication
|
|
50
|
+
from tqm import TQManager
|
|
51
|
+
|
|
52
|
+
def some_task(task):
|
|
53
|
+
# This will run in a separate thread
|
|
54
|
+
time.sleep(2)
|
|
55
|
+
task.log("Task completed!")
|
|
56
|
+
|
|
57
|
+
# Create the application
|
|
58
|
+
app = QApplication([])
|
|
59
|
+
app.setStyle('Fusion')
|
|
60
|
+
|
|
61
|
+
# Create the task manager window
|
|
62
|
+
task_manager = TQManager(app_name="my_app")
|
|
63
|
+
task_manager.show()
|
|
64
|
+
|
|
65
|
+
# Add a simple task
|
|
66
|
+
task_manager.add_event(
|
|
67
|
+
execute=some_task,
|
|
68
|
+
label="My First Task",
|
|
69
|
+
comment="This is a sample task"
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
# Start executing tasks
|
|
73
|
+
task_manager.start_workers()
|
|
74
|
+
|
|
75
|
+
# Run the application
|
|
76
|
+
app.exec_()
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Examples
|
|
80
|
+
|
|
81
|
+
### Creating a simple task
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
# Add a single task that does something
|
|
85
|
+
task_manager.add_event(
|
|
86
|
+
execute=lambda task: print("Hello, world!"),
|
|
87
|
+
label="Simple Task",
|
|
88
|
+
comment="Prints a greeting"
|
|
89
|
+
)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Creating a task group
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
# Create a group of related tasks
|
|
96
|
+
with task_manager.create_group("Download Files") as group:
|
|
97
|
+
group.add_event(lambda t: t.log("Downloading file 1"), label="File 1")
|
|
98
|
+
group.add_event(lambda t: t.log("Downloading file 2"), label="File 2")
|
|
99
|
+
group.add_event(lambda t: t.log("Downloading file 3"), label="File 3")
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Using the TaskBuilder for more control
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
from tqm import TaskBuilder
|
|
106
|
+
|
|
107
|
+
# Create a task with the builder pattern
|
|
108
|
+
task = (
|
|
109
|
+
TaskBuilder("Complex Task")
|
|
110
|
+
.with_event(lambda t: t.log("Task running..."))
|
|
111
|
+
.with_comment("A task with callbacks")
|
|
112
|
+
.with_on_start(lambda t: print("Starting task"))
|
|
113
|
+
.with_on_completed(lambda t: print("Task completed"))
|
|
114
|
+
.with_on_failed(lambda t: print("Task failed"))
|
|
115
|
+
.with_color("lightblue")
|
|
116
|
+
.with_retry_failed(max_retries=3) # Retry up to 3 times if it fails
|
|
117
|
+
.build()
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
# Add it to the task manager
|
|
121
|
+
task_manager.add_tasks(task)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Tasks with dependencies
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
# Create tasks with dependencies
|
|
128
|
+
task1 = TaskBuilder("Task 1").with_event(lambda t: t.log("Task 1 done")).build()
|
|
129
|
+
task2 = (
|
|
130
|
+
TaskBuilder("Task 2")
|
|
131
|
+
.with_event(lambda t: t.log("Task 2 done"))
|
|
132
|
+
.with_wait_for(task1) # This will wait for task1 to complete
|
|
133
|
+
.build()
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
task_manager.add_tasks(task1, task2)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Configuration
|
|
140
|
+
|
|
141
|
+
tqm stores its settings in:
|
|
142
|
+
- Windows: `%LOCALAPPDATA%\tqm\[app_name]\`
|
|
143
|
+
- Linux/Mac: `~/.config/tqm/[app_name]/`
|
|
144
|
+
|
|
145
|
+
## Environment
|
|
146
|
+
|
|
147
|
+
- `TQM_CONFIG_PATH` - Configuration directory path
|
|
148
|
+
- `TQM_SETTINGS_PATH` - Settings file path
|
|
149
|
+
- `TQM_QSS_PATH` -Qt stylesheet path
|
|
150
|
+
- `TQM_MONO_FONT` - Monospace font family
|
|
151
|
+
- `TQM_DEBUG` - Enables debug logging when set to '1'
|
|
152
|
+
- `TQM_IDLE_TIMEOUT` - Timeout in milliseconds for idle system detection
|
|
153
|
+
|
|
154
|
+
## Python Version Support
|
|
155
|
+
|
|
156
|
+
TQM currently supports Python 3.7+ to ensure compatibility with VFX environments where older Python versions are still common. We intentionally keep zero dependencies (except PySide2) so VFX applications can use TQM right away.
|
|
157
|
+
However, we'll phase out support for older versions with major releases:
|
|
158
|
+
|
|
159
|
+
- Current (0.x): Python 3.7+
|
|
160
|
+
- Future (1.x): Python 3.10+ (dropping 3.7, 3.8, and 3.9 support)
|
|
161
|
+
|
|
162
|
+
Older TQM versions will remain available on the GitHub releases page, but won't receive updates once we move to newer Python versions.
|
|
163
|
+
|
|
164
|
+
## Current Status
|
|
165
|
+
|
|
166
|
+
tqm is still under development but stable enough for most use cases. The core functionality has been battle-tested in production environments for over a year, though this current version is a significant rewrite with improved architecture and features. Some features and documentation might be improved in future updates.
|
|
167
|
+
|
|
168
|
+
See the [GitHub Project](link) for more information.
|
|
169
|
+
|
|
170
|
+
## Theme and style
|
|
171
|
+
|
|
172
|
+
This application was designed under the OS **dark theme** using Qt's **Fusion** style. I have never tried it under light themes or other Qt styles (Windows, macOS native, Breeze, etc.) which means that I assume no responsibility for any eye damage or aesthetic trauma.
|
|
173
|
+
|
|
174
|
+
### Custom Styling
|
|
175
|
+
|
|
176
|
+
The application provides a style.qss file in the default config location which users can modify to customize the appearance of common widgets:
|
|
177
|
+
|
|
178
|
+
- `TqmTabsWidget`
|
|
179
|
+
- `TqmHeaderView`
|
|
180
|
+
- `TqmTasksLogs`
|
|
181
|
+
- `TqmTasksViewToolbar`
|
|
182
|
+
- `TqmSearchBar`
|
|
183
|
+
- `TqmStatusLabel`
|
|
184
|
+
- `TqmTasksTreeView`
|
|
185
|
+
- `TqmFrame`
|
|
186
|
+
- `TqmToolButton`
|
|
187
|
+
|
|
188
|
+
## License
|
|
189
|
+
|
|
190
|
+
This project is licensed under [MIT](./LICENSE.md).
|
tqm-0.1.0/pyproject.toml
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "tqm"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Python-based parallel task queuing and execution framework with PySide2 GUI for efficient workflow management."
|
|
5
|
+
authors = ["virgilsisoe <28490646+sisoe24@users.noreply.github.com>"]
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
homepage = "https://github.com/sisoe24/tqm"
|
|
8
|
+
repository = "https://github.com/sisoe24/tqm"
|
|
9
|
+
documentation = "https://github.com/sisoe24/tqm#readme"
|
|
10
|
+
keywords = ["task", "queue", "manager", "pyside2", "gui", "threading", "parallel", "vfx"]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 4 - Beta",
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"License :: OSI Approved :: MIT License",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3.7",
|
|
17
|
+
"Programming Language :: Python :: 3.8",
|
|
18
|
+
"Programming Language :: Python :: 3.9",
|
|
19
|
+
"Programming Language :: Python :: 3.10",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
22
|
+
"Topic :: Desktop Environment :: Window Managers",
|
|
23
|
+
"Topic :: System :: Monitoring",
|
|
24
|
+
"Operating System :: OS Independent",
|
|
25
|
+
]
|
|
26
|
+
include = [
|
|
27
|
+
{ path = "tqm/_resources_rc.py", format = ["sdist", "wheel"] }
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[tool.poetry.scripts]
|
|
31
|
+
tqm-dev = "sandbox.dev:main"
|
|
32
|
+
tqm-demo = "tqm.demo.demo:run_demo"
|
|
33
|
+
|
|
34
|
+
[tool.coverage.paths]
|
|
35
|
+
source = ["tqm"]
|
|
36
|
+
|
|
37
|
+
[tool.coverage.html]
|
|
38
|
+
directory = "tmp/coverage"
|
|
39
|
+
|
|
40
|
+
[tool.coverage.run]
|
|
41
|
+
omit = ["tqm/tests/*", "tqm/__init__.py", "tqm/utils/*", "tqm/widgets/*"]
|
|
42
|
+
|
|
43
|
+
[tool.pytest.ini_options]
|
|
44
|
+
testpaths = "tests"
|
|
45
|
+
qt_api = "pyside2"
|
|
46
|
+
markers = ["quick: mark test"]
|
|
47
|
+
addopts = [
|
|
48
|
+
"--no-header",
|
|
49
|
+
"--tb=short",
|
|
50
|
+
"--cov=tqm",
|
|
51
|
+
"--cov-report=html",
|
|
52
|
+
"--cov-report=xml",
|
|
53
|
+
"-W ignore::DeprecationWarning",
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
[tool.autopep8]
|
|
57
|
+
max_line_length = 100
|
|
58
|
+
|
|
59
|
+
[tool.isort]
|
|
60
|
+
skip = ["__init__.py", "_resources_rc.py", "version.py"]
|
|
61
|
+
length_sort = true
|
|
62
|
+
add_imports = "from __future__ import annotations"
|
|
63
|
+
|
|
64
|
+
[tool.poetry.dependencies]
|
|
65
|
+
python = ">=3.7.7,<3.11"
|
|
66
|
+
pyside2 = "^5.15.2.1"
|
|
67
|
+
pytest = "^7.4.3"
|
|
68
|
+
|
|
69
|
+
[tool.poetry.group.dev.dependencies]
|
|
70
|
+
pytest-qt = "^4.2.0"
|
|
71
|
+
pytest-cov = "^4.1.0"
|
|
72
|
+
pytest-repeat = "^0.9.3"
|
|
73
|
+
pytest-randomly = "3.12.0"
|
|
74
|
+
|
|
75
|
+
[build-system]
|
|
76
|
+
requires = ["poetry-core"]
|
|
77
|
+
build-backend = "poetry.core.masonry.api"
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Queue Task Manager: PySide2 parallel task queuing and execution framework.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
from .version import __version__
|
|
8
|
+
|
|
9
|
+
from ._core import logger
|
|
10
|
+
from ._core.logger import write_log
|
|
11
|
+
try:
|
|
12
|
+
from . import _resources_rc
|
|
13
|
+
except ImportError:
|
|
14
|
+
import warnings
|
|
15
|
+
warnings.warn(
|
|
16
|
+
"Resource file '_resources_rc.py' not found. "
|
|
17
|
+
'Some UI resources may not be available. '
|
|
18
|
+
'If you are developing, ensure resources are compiled and available in the package.',
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
from ._main import TQManager
|
|
23
|
+
from . import exceptions
|
|
24
|
+
from ._core.task import TaskExecutable, TaskGroup, TaskUnit
|
|
25
|
+
from ._core.task_builder import TaskBuilder, TaskGroupBuilder
|
|
26
|
+
from ._core.task_executor import TaskExecutor
|
|
27
|
+
from ._core.task_actions import TaskActionVisibility
|
|
28
|
+
from .widgets.help_widget import about
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
__all__ = [
|
|
32
|
+
'write_log',
|
|
33
|
+
'exceptions',
|
|
34
|
+
'TaskExecutable',
|
|
35
|
+
'TaskUnit',
|
|
36
|
+
'TaskGroup',
|
|
37
|
+
'TaskBuilder',
|
|
38
|
+
'TaskGroupBuilder',
|
|
39
|
+
'TaskActionVisibility',
|
|
40
|
+
'TQManager',
|
|
41
|
+
'TaskExecutor',
|
|
42
|
+
'about',
|
|
43
|
+
'__version__',
|
|
44
|
+
]
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import sys
|
|
5
|
+
import logging
|
|
6
|
+
from typing import TYPE_CHECKING, TextIO, Optional
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from logging.handlers import TimedRotatingFileHandler
|
|
9
|
+
|
|
10
|
+
from PySide2.QtCore import Qt, Signal, QObject
|
|
11
|
+
|
|
12
|
+
if TYPE_CHECKING:
|
|
13
|
+
from .._ui.tab_logs import TasksLog
|
|
14
|
+
|
|
15
|
+
USER_LEVEL = 25
|
|
16
|
+
logging.addLevelName(USER_LEVEL, 'USER')
|
|
17
|
+
|
|
18
|
+
LOG_FILE_FORMAT = logging.Formatter(' - '.join([
|
|
19
|
+
'%(asctime)s',
|
|
20
|
+
'%(levelname)-8s',
|
|
21
|
+
'%(threadName)s ID:%(thread)-15d',
|
|
22
|
+
'%(message)s'
|
|
23
|
+
]), '%Y-%m-%d %H:%M:%S')
|
|
24
|
+
|
|
25
|
+
LOG_WIDGET_FORMAT = logging.Formatter(' - '.join([
|
|
26
|
+
'%(asctime)s',
|
|
27
|
+
'%(levelname)-8s',
|
|
28
|
+
'%(threadName)s ID:%(thread)-15d',
|
|
29
|
+
'%(message)s'
|
|
30
|
+
]), '%H:%M:%S')
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class TqmLogger(logging.Logger):
|
|
34
|
+
def __init__(self, name: str = 'tqm') -> None:
|
|
35
|
+
super().__init__(name)
|
|
36
|
+
self.setLevel(logging.DEBUG)
|
|
37
|
+
self._widget = logging.NullHandler()
|
|
38
|
+
|
|
39
|
+
@property
|
|
40
|
+
def widget(self) -> logging.Handler:
|
|
41
|
+
return self._widget
|
|
42
|
+
|
|
43
|
+
@widget.setter
|
|
44
|
+
def widget(self, handler: logging.Handler) -> None:
|
|
45
|
+
self._widget = handler
|
|
46
|
+
self.addHandler(self._widget)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class HandlerSignal(QObject):
|
|
50
|
+
log_message = Signal(str, str, str)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class WidgetLogHandler(logging.Handler):
|
|
54
|
+
|
|
55
|
+
def __init__(self, widget: TasksLog, debug: bool = False) -> None:
|
|
56
|
+
super().__init__()
|
|
57
|
+
self.set_name('widget_handler')
|
|
58
|
+
self.setLevel(logging.DEBUG if debug else logging.INFO)
|
|
59
|
+
self.setFormatter(LOG_WIDGET_FORMAT)
|
|
60
|
+
|
|
61
|
+
self._widget = widget
|
|
62
|
+
self._signal = HandlerSignal()
|
|
63
|
+
self._signal.log_message.connect(self._widget.log, Qt.QueuedConnection)
|
|
64
|
+
|
|
65
|
+
def emit(self, record: logging.LogRecord) -> None:
|
|
66
|
+
self._signal.log_message.emit(
|
|
67
|
+
self.format(record) + '\n',
|
|
68
|
+
record.levelname.upper(),
|
|
69
|
+
str(record.thread)
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def log_file_handler(config_path: Path) -> TimedRotatingFileHandler:
|
|
74
|
+
tqm_log_dir = config_path / 'logs'
|
|
75
|
+
tqm_log_dir.mkdir(parents=True, exist_ok=True)
|
|
76
|
+
|
|
77
|
+
handler = TimedRotatingFileHandler(
|
|
78
|
+
filename=tqm_log_dir / 'tqm.log',
|
|
79
|
+
when='midnight',
|
|
80
|
+
backupCount=7
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
handler.setLevel(logging.DEBUG)
|
|
84
|
+
handler.set_name('file_handler')
|
|
85
|
+
handler.setFormatter(LOG_FILE_FORMAT)
|
|
86
|
+
|
|
87
|
+
return handler
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def _console_handler() -> logging.StreamHandler[TextIO]:
|
|
91
|
+
handler = logging.StreamHandler(sys.stdout)
|
|
92
|
+
handler.setLevel(logging.DEBUG)
|
|
93
|
+
handler.set_name('console_handler')
|
|
94
|
+
handler.setFormatter(LOG_WIDGET_FORMAT)
|
|
95
|
+
return handler
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def write_log(msg: str, *, stream: Optional[TextIO] = None) -> None:
|
|
99
|
+
"""Write a log level USER message to the logger.
|
|
100
|
+
|
|
101
|
+
Args:
|
|
102
|
+
msg (str): The message to log.
|
|
103
|
+
stream (Optional[TextIO], optional): The stream to write to. Defaults to None.
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
write_log('Hello, World!')
|
|
107
|
+
write_log('Hello, World!', stream=sys.stdout)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
"""
|
|
111
|
+
if stream:
|
|
112
|
+
try:
|
|
113
|
+
stream.write(msg + '\n')
|
|
114
|
+
stream.flush()
|
|
115
|
+
except Exception as e:
|
|
116
|
+
LOGGER.error('Invalid stream: %s', e)
|
|
117
|
+
|
|
118
|
+
LOGGER.log(USER_LEVEL, msg)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
LOGGER = TqmLogger()
|
|
122
|
+
if os.getenv('TQM_DEBUG') == '1':
|
|
123
|
+
LOGGER.addHandler(_console_handler())
|