thread-order 1.2.4__tar.gz → 1.3.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.
Files changed (24) hide show
  1. {thread_order-1.2.4/thread_order.egg-info → thread_order-1.3.0}/PKG-INFO +26 -2
  2. {thread_order-1.2.4 → thread_order-1.3.0}/README.md +24 -0
  3. {thread_order-1.2.4 → thread_order-1.3.0}/pyproject.toml +1 -1
  4. {thread_order-1.2.4 → thread_order-1.3.0}/thread_order/__init__.py +1 -1
  5. {thread_order-1.2.4 → thread_order-1.3.0}/thread_order/cli/app.py +6 -10
  6. {thread_order-1.2.4 → thread_order-1.3.0/thread_order.egg-info}/PKG-INFO +26 -2
  7. {thread_order-1.2.4 → thread_order-1.3.0}/thread_order.egg-info/requires.txt +1 -1
  8. {thread_order-1.2.4 → thread_order-1.3.0}/LICENSE +0 -0
  9. {thread_order-1.2.4 → thread_order-1.3.0}/setup.cfg +0 -0
  10. {thread_order-1.2.4 → thread_order-1.3.0}/tests/test_graph.py +0 -0
  11. {thread_order-1.2.4 → thread_order-1.3.0}/tests/test_init.py +0 -0
  12. {thread_order-1.2.4 → thread_order-1.3.0}/tests/test_scheduler.py +0 -0
  13. {thread_order-1.2.4 → thread_order-1.3.0}/thread_order/cli/__init__.py +0 -0
  14. {thread_order-1.2.4 → thread_order-1.3.0}/thread_order/graph.py +0 -0
  15. {thread_order-1.2.4 → thread_order-1.3.0}/thread_order/graph_summary.py +0 -0
  16. {thread_order-1.2.4 → thread_order-1.3.0}/thread_order/logger.py +0 -0
  17. {thread_order-1.2.4 → thread_order-1.3.0}/thread_order/scheduler.py +0 -0
  18. {thread_order-1.2.4 → thread_order-1.3.0}/thread_order/timer.py +0 -0
  19. {thread_order-1.2.4 → thread_order-1.3.0}/thread_order/ui/__init__.py +0 -0
  20. {thread_order-1.2.4 → thread_order-1.3.0}/thread_order/ui/app.py +0 -0
  21. {thread_order-1.2.4 → thread_order-1.3.0}/thread_order.egg-info/SOURCES.txt +0 -0
  22. {thread_order-1.2.4 → thread_order-1.3.0}/thread_order.egg-info/dependency_links.txt +0 -0
  23. {thread_order-1.2.4 → thread_order-1.3.0}/thread_order.egg-info/entry_points.txt +0 -0
  24. {thread_order-1.2.4 → thread_order-1.3.0}/thread_order.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: thread-order
3
- Version: 1.2.4
3
+ Version: 1.3.0
4
4
  Summary: A lightweight framework for running functions concurrently across multiple threads while maintaining a defined execution order.
5
5
  Author-email: Emilio Reyes <soda480@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -34,7 +34,7 @@ Requires-Dist: mock; extra == "dev"
34
34
  Requires-Dist: radon; extra == "dev"
35
35
  Requires-Dist: bandit; extra == "dev"
36
36
  Requires-Dist: coverage; extra == "dev"
37
- Requires-Dist: coverage-badge; extra == "dev"
37
+ Requires-Dist: genbadge[coverage]; extra == "dev"
38
38
  Requires-Dist: twine; extra == "dev"
39
39
  Provides-Extra: ui
40
40
  Requires-Dist: ttkbootstrap>=1.20.1; extra == "ui"
@@ -218,6 +218,30 @@ These appear in `initial_state` and can be processed in your module’s `setup_s
218
218
 
219
219
  This allows your module to compute initial state based on CLI parameters.
220
220
 
221
+ ## Custom Logging
222
+
223
+ If a module defines a `setup_logging()` function, `tdrun` will automatically detect and invoke it during module initialization. This allows the module to configure its own logging behavior in a consistent and structured way while remaining compatible with the execution model.
224
+
225
+ ```Python
226
+ def setup_logging(
227
+ workers, # Effective worker count resolved by CLI
228
+ verbose=False, # Enable verbose (debug-level) logging
229
+ add_stream_handler=False, # Attach console handler (disabled when progress/viewer active)
230
+ add_file_handler=False # Attach file handler when --log is enabled
231
+ ):
232
+ ```
233
+
234
+ At runtime, `tdrun` will invoke it as:
235
+
236
+ ```Python
237
+ setup_logging(
238
+ args.workers, # effective workers
239
+ verbose=args.verbose,
240
+ add_stream_handler=not args.progress and not args.viewer,
241
+ add_file_handler=args.log,
242
+ )
243
+ ```
244
+
221
245
  ### DAG Inspection
222
246
 
223
247
  Use graph-only mode to inspect dependency structure:
@@ -176,6 +176,30 @@ These appear in `initial_state` and can be processed in your module’s `setup_s
176
176
 
177
177
  This allows your module to compute initial state based on CLI parameters.
178
178
 
179
+ ## Custom Logging
180
+
181
+ If a module defines a `setup_logging()` function, `tdrun` will automatically detect and invoke it during module initialization. This allows the module to configure its own logging behavior in a consistent and structured way while remaining compatible with the execution model.
182
+
183
+ ```Python
184
+ def setup_logging(
185
+ workers, # Effective worker count resolved by CLI
186
+ verbose=False, # Enable verbose (debug-level) logging
187
+ add_stream_handler=False, # Attach console handler (disabled when progress/viewer active)
188
+ add_file_handler=False # Attach file handler when --log is enabled
189
+ ):
190
+ ```
191
+
192
+ At runtime, `tdrun` will invoke it as:
193
+
194
+ ```Python
195
+ setup_logging(
196
+ args.workers, # effective workers
197
+ verbose=args.verbose,
198
+ add_stream_handler=not args.progress and not args.viewer,
199
+ add_file_handler=args.log,
200
+ )
201
+ ```
202
+
179
203
  ### DAG Inspection
180
204
 
181
205
  Use graph-only mode to inspect dependency structure:
@@ -53,7 +53,7 @@ dev = [
53
53
  "radon",
54
54
  "bandit",
55
55
  "coverage",
56
- "coverage-badge",
56
+ "genbadge[coverage]",
57
57
  "twine"
58
58
  ]
59
59
  ui = [
@@ -53,7 +53,7 @@ def __getattr__(name):
53
53
  try:
54
54
  __version__ = _metadata.version(__name__)
55
55
  except _metadata.PackageNotFoundError:
56
- __version__ = '1.2.4'
56
+ __version__ = '1.3.0'
57
57
 
58
58
  if getenv('DEV'):
59
59
  __version__ = f'{__version__}+dev'
@@ -1,4 +1,3 @@
1
- import re
2
1
  import sys
3
2
  import argparse
4
3
  import json
@@ -147,20 +146,13 @@ def _setup_output(scheduler, args):
147
146
  def on_task_done(name, thread_name, status, count, total):
148
147
  _percent = int((count / total) * 100)
149
148
  percent = f'{status.value} [{_percent:3d}% ]'
150
- base = f'[{_pad_thread_name(thread_name, args.effective_workers)}] {name}' \
151
- if thread_name else name
149
+ base = f'[{thread_name}] {name}' if thread_name else name
152
150
  dots = '.' * max(0, 75 - len(base) - len(percent))
153
151
  logger.info(f'{base} {dots} {percent}')
154
152
 
155
153
  scheduler.on_task_done(on_task_done, total)
156
154
  return nullcontext()
157
155
 
158
- def _pad_thread_name(name, workers):
159
- """ pad thread name numbers with leading zeros for consistent width
160
- """
161
- width = len(str(workers - 1))
162
- return re.sub(r'(\d+)$', lambda m: m.group(1).zfill(width), name)
163
-
164
156
  def _parse_tags_filter(tags):
165
157
  """ parse comma-separated tag list into a normalized filter list
166
158
  """
@@ -187,7 +179,11 @@ def _build_scheduler_kwargs(args, initial_state, clear_results_on_start, module)
187
179
  # prefer module-provided logging hook if available
188
180
  setup_logging_function = getattr(module, 'setup_logging', None)
189
181
  if callable(setup_logging_function):
190
- setup_logging_function(args.effective_workers, args.verbose)
182
+ setup_logging_function(
183
+ args.effective_workers,
184
+ verbose=args.verbose,
185
+ add_stream_handler=not args.progress and not args.viewer,
186
+ add_file_handler=args.log)
191
187
  else:
192
188
  scheduler_kwargs['setup_logging'] = True
193
189
  scheduler_kwargs['verbose'] = args.verbose
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: thread-order
3
- Version: 1.2.4
3
+ Version: 1.3.0
4
4
  Summary: A lightweight framework for running functions concurrently across multiple threads while maintaining a defined execution order.
5
5
  Author-email: Emilio Reyes <soda480@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -34,7 +34,7 @@ Requires-Dist: mock; extra == "dev"
34
34
  Requires-Dist: radon; extra == "dev"
35
35
  Requires-Dist: bandit; extra == "dev"
36
36
  Requires-Dist: coverage; extra == "dev"
37
- Requires-Dist: coverage-badge; extra == "dev"
37
+ Requires-Dist: genbadge[coverage]; extra == "dev"
38
38
  Requires-Dist: twine; extra == "dev"
39
39
  Provides-Extra: ui
40
40
  Requires-Dist: ttkbootstrap>=1.20.1; extra == "ui"
@@ -218,6 +218,30 @@ These appear in `initial_state` and can be processed in your module’s `setup_s
218
218
 
219
219
  This allows your module to compute initial state based on CLI parameters.
220
220
 
221
+ ## Custom Logging
222
+
223
+ If a module defines a `setup_logging()` function, `tdrun` will automatically detect and invoke it during module initialization. This allows the module to configure its own logging behavior in a consistent and structured way while remaining compatible with the execution model.
224
+
225
+ ```Python
226
+ def setup_logging(
227
+ workers, # Effective worker count resolved by CLI
228
+ verbose=False, # Enable verbose (debug-level) logging
229
+ add_stream_handler=False, # Attach console handler (disabled when progress/viewer active)
230
+ add_file_handler=False # Attach file handler when --log is enabled
231
+ ):
232
+ ```
233
+
234
+ At runtime, `tdrun` will invoke it as:
235
+
236
+ ```Python
237
+ setup_logging(
238
+ args.workers, # effective workers
239
+ verbose=args.verbose,
240
+ add_stream_handler=not args.progress and not args.viewer,
241
+ add_file_handler=args.log,
242
+ )
243
+ ```
244
+
221
245
  ### DAG Inspection
222
246
 
223
247
  Use graph-only mode to inspect dependency structure:
@@ -7,7 +7,7 @@ mock
7
7
  radon
8
8
  bandit
9
9
  coverage
10
- coverage-badge
10
+ genbadge[coverage]
11
11
  twine
12
12
 
13
13
  [ui]
File without changes
File without changes