meerschaum 2.2.5.dev2__py3-none-any.whl → 2.2.6__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.
Files changed (54) hide show
  1. meerschaum/__init__.py +4 -1
  2. meerschaum/_internal/arguments/_parser.py +13 -3
  3. meerschaum/_internal/docs/index.py +513 -110
  4. meerschaum/_internal/term/__init__.py +2 -2
  5. meerschaum/actions/bootstrap.py +13 -14
  6. meerschaum/actions/python.py +11 -8
  7. meerschaum/actions/register.py +130 -32
  8. meerschaum/actions/show.py +92 -75
  9. meerschaum/actions/stack.py +12 -12
  10. meerschaum/actions/stop.py +11 -11
  11. meerschaum/api/__init__.py +0 -1
  12. meerschaum/api/dash/__init__.py +0 -1
  13. meerschaum/api/dash/callbacks/custom.py +1 -1
  14. meerschaum/api/dash/callbacks/login.py +21 -13
  15. meerschaum/api/dash/pages/login.py +2 -2
  16. meerschaum/api/dash/plugins.py +5 -6
  17. meerschaum/api/routes/_login.py +5 -5
  18. meerschaum/config/__init__.py +8 -1
  19. meerschaum/config/_paths.py +20 -2
  20. meerschaum/config/_version.py +1 -1
  21. meerschaum/config/paths.py +21 -2
  22. meerschaum/config/static/__init__.py +1 -0
  23. meerschaum/connectors/Connector.py +7 -2
  24. meerschaum/connectors/__init__.py +7 -5
  25. meerschaum/connectors/api/APIConnector.py +7 -2
  26. meerschaum/connectors/api/_actions.py +23 -31
  27. meerschaum/connectors/api/_uri.py +5 -5
  28. meerschaum/core/Pipe/__init__.py +7 -3
  29. meerschaum/core/Pipe/_data.py +23 -15
  30. meerschaum/core/Pipe/_deduplicate.py +1 -1
  31. meerschaum/core/Pipe/_dtypes.py +5 -0
  32. meerschaum/core/Pipe/_fetch.py +18 -16
  33. meerschaum/core/Pipe/_sync.py +20 -15
  34. meerschaum/plugins/_Plugin.py +6 -6
  35. meerschaum/plugins/__init__.py +1 -1
  36. meerschaum/utils/daemon/RotatingFile.py +15 -16
  37. meerschaum/utils/dataframe.py +12 -4
  38. meerschaum/utils/debug.py +9 -15
  39. meerschaum/utils/formatting/__init__.py +13 -12
  40. meerschaum/utils/misc.py +117 -11
  41. meerschaum/utils/packages/__init__.py +7 -1
  42. meerschaum/utils/typing.py +1 -0
  43. meerschaum/utils/venv/__init__.py +5 -1
  44. meerschaum/utils/warnings.py +9 -1
  45. meerschaum/utils/yaml.py +2 -2
  46. {meerschaum-2.2.5.dev2.dist-info → meerschaum-2.2.6.dist-info}/METADATA +1 -1
  47. {meerschaum-2.2.5.dev2.dist-info → meerschaum-2.2.6.dist-info}/RECORD +53 -54
  48. {meerschaum-2.2.5.dev2.dist-info → meerschaum-2.2.6.dist-info}/WHEEL +1 -1
  49. meerschaum/actions/backup.py +0 -43
  50. {meerschaum-2.2.5.dev2.dist-info → meerschaum-2.2.6.dist-info}/LICENSE +0 -0
  51. {meerschaum-2.2.5.dev2.dist-info → meerschaum-2.2.6.dist-info}/NOTICE +0 -0
  52. {meerschaum-2.2.5.dev2.dist-info → meerschaum-2.2.6.dist-info}/entry_points.txt +0 -0
  53. {meerschaum-2.2.5.dev2.dist-info → meerschaum-2.2.6.dist-info}/top_level.txt +0 -0
  54. {meerschaum-2.2.5.dev2.dist-info → meerschaum-2.2.6.dist-info}/zip-safe +0 -0
@@ -221,18 +221,17 @@ def _bootstrap_pipes(
221
221
  return (successes > 0), msg
222
222
 
223
223
  def _bootstrap_connectors(
224
- action : Optional[List[str]] = None,
225
- connector_keys : Optional[List[str]] = None,
226
- yes : bool = False,
227
- force : bool = False,
228
- noask : bool = False,
229
- debug : bool = False,
230
- return_keys : bool = False,
231
- **kw : Any
232
- ) -> Union[SuccessTuple, Tuple[str, str]]:
224
+ action: Optional[List[str]] = None,
225
+ connector_keys: Optional[List[str]] = None,
226
+ yes: bool = False,
227
+ force: bool = False,
228
+ noask: bool = False,
229
+ debug: bool = False,
230
+ return_keys: bool = False,
231
+ **kw: Any
232
+ ) -> Union[SuccessTuple, Tuple[str, str]]:
233
233
  """
234
234
  Prompt the user for the details necessary to create a Connector.
235
-
236
235
  """
237
236
  from meerschaum.connectors.parse import is_valid_connector_keys
238
237
  from meerschaum.connectors import connectors, get_connector, types, custom_types
@@ -386,10 +385,10 @@ def _bootstrap_connectors(
386
385
 
387
386
 
388
387
  def _bootstrap_plugins(
389
- action: Optional[List[str]] = None,
390
- debug: bool = False,
391
- **kwargs: Any
392
- ) -> SuccessTuple:
388
+ action: Optional[List[str]] = None,
389
+ debug: bool = False,
390
+ **kwargs: Any
391
+ ) -> SuccessTuple:
393
392
  """
394
393
  Launch an interactive wizard to guide the user to creating a new plugin.
395
394
  """
@@ -9,14 +9,14 @@ from __future__ import annotations
9
9
  from meerschaum.utils.typing import SuccessTuple, Any, List, Optional
10
10
 
11
11
  def python(
12
- action: Optional[List[str]] = None,
13
- sub_args: Optional[List[str]] = None,
14
- nopretty: bool = False,
15
- noask: bool = False,
16
- venv: Optional[str] = None,
17
- debug: bool = False,
18
- **kw: Any
19
- ) -> SuccessTuple:
12
+ action: Optional[List[str]] = None,
13
+ sub_args: Optional[List[str]] = None,
14
+ nopretty: bool = False,
15
+ noask: bool = False,
16
+ venv: Optional[str] = None,
17
+ debug: bool = False,
18
+ **kw: Any
19
+ ) -> SuccessTuple:
20
20
  """
21
21
  Launch a virtual environment's Python interpreter with Meerschaum imported.
22
22
  You may pass flags to the Python binary by surrounding each flag with `[]`.
@@ -56,6 +56,9 @@ def python(
56
56
  if action is None:
57
57
  action = []
58
58
 
59
+ if noask:
60
+ nopretty = True
61
+
59
62
  joined_actions = (
60
63
  ["import meerschaum as mrsm"]
61
64
  if venv is None and not sub_args
@@ -7,12 +7,13 @@ Register new Pipes. Requires the API to be running.
7
7
  """
8
8
 
9
9
  from __future__ import annotations
10
+ import meerschaum as mrsm
10
11
  from meerschaum.utils.typing import SuccessTuple, Any, List, Optional, Dict
11
12
 
12
13
  def register(
13
- action: Optional[List[str]] = None,
14
- **kw: Any
15
- ) -> SuccessTuple:
14
+ action: Optional[List[str]] = None,
15
+ **kw: Any
16
+ ) -> SuccessTuple:
16
17
  """
17
18
  Register new items (pipes, plugins, users).
18
19
 
@@ -23,22 +24,25 @@ def register(
23
24
  'pipes' : _register_pipes,
24
25
  'plugins' : _register_plugins,
25
26
  'users' : _register_users,
27
+ 'connectors': _register_connectors,
26
28
  }
27
29
  return choose_subaction(action, options, **kw)
28
30
 
29
31
 
30
32
  def _complete_register(
31
- action: Optional[List[str]] = None,
32
- **kw: Any
33
- ) -> List[str]:
33
+ action: Optional[List[str]] = None,
34
+ **kw: Any
35
+ ) -> List[str]:
34
36
  """
35
37
  Override the default Meerschaum `complete_` function.
36
38
  """
37
39
  if action is None:
38
40
  action = []
39
41
  options = {
40
- 'plugin' : _complete_register_plugins,
41
- 'plugins' : _complete_register_plugins,
42
+ 'plugin': _complete_register_plugins,
43
+ 'plugins': _complete_register_plugins,
44
+ 'connector': _complete_register_connectors,
45
+ 'connectors': _complete_register_connectors,
42
46
  }
43
47
 
44
48
  if len(action) > 0 and action[0] in options:
@@ -51,14 +55,14 @@ def _complete_register(
51
55
 
52
56
 
53
57
  def _register_pipes(
54
- connector_keys: Optional[List[str]] = None,
55
- metric_keys: Optional[List[str]] = None,
56
- location_keys: Optional[List[str]] = None,
57
- params: Optional[Dict[str, Any]] = None,
58
- tags: Optional[List[str]] = None,
59
- debug: bool = False,
60
- **kw: Any
61
- ) -> SuccessTuple:
58
+ connector_keys: Optional[List[str]] = None,
59
+ metric_keys: Optional[List[str]] = None,
60
+ location_keys: Optional[List[str]] = None,
61
+ params: Optional[Dict[str, Any]] = None,
62
+ tags: Optional[List[str]] = None,
63
+ debug: bool = False,
64
+ **kw: Any
65
+ ) -> SuccessTuple:
62
66
  """
63
67
  Create and register Pipe objects.
64
68
 
@@ -147,15 +151,18 @@ def _register_pipes(
147
151
 
148
152
 
149
153
  def _register_plugins(
150
- action: Optional[List[str]] = None,
151
- repository: Optional[str] = None,
152
- shell: bool = False,
153
- debug: bool = False,
154
- yes: bool = False,
155
- noask: bool = False,
156
- force: bool = False,
157
- **kw: Any
158
- ) -> SuccessTuple:
154
+ action: Optional[List[str]] = None,
155
+ repository: Optional[str] = None,
156
+ shell: bool = False,
157
+ debug: bool = False,
158
+ yes: bool = False,
159
+ noask: bool = False,
160
+ force: bool = False,
161
+ **kw: Any
162
+ ) -> SuccessTuple:
163
+ """
164
+ Upload plugins to an API instance (repository).
165
+ """
159
166
  from meerschaum.utils.debug import dprint
160
167
  from meerschaum.plugins import reload_plugins, get_plugins_names
161
168
  from meerschaum.connectors.parse import parse_repo_keys
@@ -246,17 +253,19 @@ def _register_plugins(
246
253
  reload_plugins(debug=debug)
247
254
  return total_success > 0, msg
248
255
 
256
+
249
257
  def _complete_register_plugins(*args, **kw):
250
258
  from meerschaum.actions.uninstall import _complete_uninstall_plugins
251
259
  return _complete_uninstall_plugins(*args, **kw)
252
260
 
261
+
253
262
  def _register_users(
254
- action: Optional[List[str]] = None,
255
- mrsm_instance: Optional[str] = None,
256
- shell: bool = False,
257
- debug: bool = False,
258
- **kw: Any
259
- ) -> SuccessTuple:
263
+ action: Optional[List[str]] = None,
264
+ mrsm_instance: Optional[str] = None,
265
+ shell: bool = False,
266
+ debug: bool = False,
267
+ **kw: Any
268
+ ) -> SuccessTuple:
260
269
  """
261
270
  Register a new user to a Meerschaum instance.
262
271
  """
@@ -294,7 +303,7 @@ def _register_users(
294
303
  nonregistered_users.append(user)
295
304
 
296
305
  ### prompt for passwords and emails, then try to register
297
- success = dict()
306
+ success = {}
298
307
  successfully_registered_users = set()
299
308
  for _user in nonregistered_users:
300
309
  try:
@@ -337,6 +346,95 @@ def _register_users(
337
346
  )
338
347
  return succeeded > 0, msg
339
348
 
349
+
350
+ def _register_connectors(
351
+ action: Optional[List[str]] = None,
352
+ connector_keys: Optional[List[str]] = None,
353
+ params: Optional[Dict[str, Any]] = None,
354
+ **kwargs: Any
355
+ ) -> SuccessTuple:
356
+ """
357
+ Create new connectors programmatically with `--params`.
358
+ See `bootstrap connector`.
359
+
360
+ Examples:
361
+
362
+ mrsm register connector sql:tmp --params 'uri:sqlite:////tmp/tmp.db'
363
+
364
+ mrsm register connector -c sql:new --params '{"database": "/tmp/new.db"}'
365
+ """
366
+ from meerschaum.config import get_config, write_config
367
+ from meerschaum.utils.prompt import yes_no
368
+ from meerschaum.utils.warnings import warn
369
+ all_keys = (action or []) + (connector_keys or [])
370
+ if len(all_keys) != 1:
371
+ return (
372
+ False,
373
+ "Provide one pair of keys for the connector to be registered."
374
+ )
375
+
376
+ keys = all_keys[0]
377
+
378
+ if keys.count(':') != 1:
379
+ return False, "Connector keys must be in the format `type:label`."
380
+
381
+ type_, label = keys.split(':', maxsplit=1)
382
+ mrsm_config = get_config('meerschaum')
383
+ if 'connectors' not in mrsm_config:
384
+ mrsm_config['connectors'] = {}
385
+
386
+ if type_ not in mrsm_config['connectors']:
387
+ mrsm_config['connectors'] = {}
388
+
389
+ is_new = True
390
+ if label in mrsm_config['connectors'][type_]:
391
+ rich_table, rich_json, rich_box = mrsm.attempt_import(
392
+ 'rich.table',
393
+ 'rich.json',
394
+ 'rich.box',
395
+ )
396
+ existing_params = mrsm_config['connectors'][type_][label]
397
+ if existing_params == params:
398
+ return True, "Connector exists, nothing to do."
399
+
400
+ table = rich_table.Table(box=rich_box.MINIMAL)
401
+ table.add_column('Existing Parameters')
402
+ table.add_column('New Parameters')
403
+ table.add_row(
404
+ rich_json.JSON.from_data(existing_params),
405
+ rich_json.JSON.from_data(params or {}),
406
+ )
407
+
408
+ mrsm.pprint(table)
409
+ warn(f"Connector '{keys}' already exists.", stack=False)
410
+ if not yes_no(
411
+ f"Do you want to overwrite connector '{keys}'?",
412
+ default='n',
413
+ **kwargs
414
+ ):
415
+ return False, "Nothing was changed."
416
+
417
+ is_new = False
418
+
419
+ mrsm_config['connectors'][type_][label] = params
420
+ if not write_config({'meerschaum': mrsm_config}):
421
+ return False, "Failed to update configuration."
422
+
423
+ msg = (
424
+ "Successfully "
425
+ + ("registered" if is_new else "updated")
426
+ + f" connector '{keys}'."
427
+ )
428
+ return True, msg
429
+
430
+
431
+ def _complete_register_connectors(
432
+ action: Optional[List[str]] = None, **kw: Any
433
+ ) -> List[str]:
434
+ from meerschaum.actions.show import _complete_show_connectors
435
+ return _complete_show_connectors(action)
436
+
437
+
340
438
  ### NOTE: This must be the final statement of the module.
341
439
  ### Any subactions added below these lines will not
342
440
  ### be added to the `help` docstring.
@@ -48,9 +48,9 @@ def show(
48
48
 
49
49
 
50
50
  def _complete_show(
51
- action: Optional[List[str]] = None,
52
- **kw: Any
53
- ) -> List[str]:
51
+ action: Optional[List[str]] = None,
52
+ **kw: Any
53
+ ) -> List[str]:
54
54
  """
55
55
  Override the default Meerschaum `complete_` function.
56
56
  """
@@ -91,7 +91,13 @@ def _show_actions(**kw: Any) -> SuccessTuple:
91
91
  from meerschaum.utils.misc import print_options
92
92
  from meerschaum._internal.shell.Shell import hidden_commands
93
93
  _actions = [ _a for _a in actions if _a not in hidden_commands ]
94
- print_options(options=_actions, name='actions', actions=False, **kw)
94
+ print_options(
95
+ options=_actions,
96
+ name='actions',
97
+ actions=False,
98
+ sort_options=True,
99
+ **kw
100
+ )
95
101
  return True, "Success"
96
102
 
97
103
 
@@ -219,15 +225,24 @@ def _show_connectors(
219
225
  from meerschaum.config import get_config
220
226
  from meerschaum.utils.formatting import make_header
221
227
  from meerschaum.utils.formatting import pprint
228
+
229
+ conn_type = action[0].split(':')[0] if action else None
230
+
222
231
  if not nopretty:
223
- print(make_header("\nConfigured connectors:"))
224
- pprint(get_config('meerschaum', 'connectors'), nopretty=nopretty)
225
- if not nopretty:
232
+ print(make_header(
233
+ f"""\nConfigured {"'" + (conn_type + "' ") if conn_type else ''}Connectors:"""
234
+ ))
235
+
236
+ keys = ['meerschaum', 'connectors']
237
+ if conn_type:
238
+ keys.append(conn_type)
239
+ pprint(get_config(*keys), nopretty=nopretty)
240
+ if not nopretty and not conn_type:
226
241
  print(make_header("\nActive connectors:"))
227
242
  pprint(connectors, nopretty=nopretty)
228
243
 
229
244
  from meerschaum.connectors.parse import parse_instance_keys
230
- if action:
245
+ if action and ':' in action[0]:
231
246
  attr, keys = parse_instance_keys(action[0], construct=False, as_tuple=True, debug=debug)
232
247
  if attr:
233
248
  if not nopretty:
@@ -238,16 +253,16 @@ def _show_connectors(
238
253
 
239
254
 
240
255
  def _complete_show_connectors(
241
- action: Optional[List[str]] = None, **kw: Any
242
- ) -> List[str]:
256
+ action: Optional[List[str]] = None, **kw: Any
257
+ ) -> List[str]:
243
258
  from meerschaum.utils.misc import get_connector_labels
244
259
  _text = action[0] if action else ""
245
260
  return get_connector_labels(search_term=_text, ignore_exact_match=True)
246
261
 
247
262
 
248
263
  def _show_arguments(
249
- **kw: Any
250
- ) -> SuccessTuple:
264
+ **kw: Any
265
+ ) -> SuccessTuple:
251
266
  """
252
267
  Show the parsed keyword arguments.
253
268
  """
@@ -257,16 +272,16 @@ def _show_arguments(
257
272
 
258
273
 
259
274
  def _show_data(
260
- action: Optional[List[str]] = None,
261
- gui: bool = False,
262
- begin: Optional[datetime.datetime] = None,
263
- end: Optional[datetime.datetime] = None,
264
- params: Optional[Dict[str, Any]] = None,
265
- chunksize: Optional[int] = -1,
266
- nopretty: bool = False,
267
- debug: bool = False,
268
- **kw: Any
269
- ) -> SuccessTuple:
275
+ action: Optional[List[str]] = None,
276
+ gui: bool = False,
277
+ begin: Optional[datetime.datetime] = None,
278
+ end: Optional[datetime.datetime] = None,
279
+ params: Optional[Dict[str, Any]] = None,
280
+ chunksize: Optional[int] = -1,
281
+ nopretty: bool = False,
282
+ debug: bool = False,
283
+ **kw: Any
284
+ ) -> SuccessTuple:
270
285
  """
271
286
  Show pipes data as Pandas DataFrames.
272
287
 
@@ -365,11 +380,11 @@ def _show_data(
365
380
 
366
381
 
367
382
  def _show_columns(
368
- action: Optional[List[str]] = None,
369
- debug: bool = False,
370
- nopretty: bool = False,
371
- **kw: Any
372
- ) -> SuccessTuple:
383
+ action: Optional[List[str]] = None,
384
+ debug: bool = False,
385
+ nopretty: bool = False,
386
+ **kw: Any
387
+ ) -> SuccessTuple:
373
388
  """
374
389
  Show the registered and table columns for pipes.
375
390
  """
@@ -383,11 +398,11 @@ def _show_columns(
383
398
 
384
399
 
385
400
  def _show_rowcounts(
386
- action: Optional[List[str]] = None,
387
- workers: Optional[int] = None,
388
- debug: bool = False,
389
- **kw: Any
390
- ) -> SuccessTuple:
401
+ action: Optional[List[str]] = None,
402
+ workers: Optional[int] = None,
403
+ debug: bool = False,
404
+ **kw: Any
405
+ ) -> SuccessTuple:
391
406
  """
392
407
  Show the rowcounts for pipes.
393
408
 
@@ -424,12 +439,12 @@ def _show_rowcounts(
424
439
  return True, "Success"
425
440
 
426
441
  def _show_plugins(
427
- action: Optional[List[str]] = None,
428
- repository: Optional[str] = None,
429
- nopretty: bool = False,
430
- debug: bool = False,
431
- **kw: Any
432
- ) -> SuccessTuple:
442
+ action: Optional[List[str]] = None,
443
+ repository: Optional[str] = None,
444
+ nopretty: bool = False,
445
+ debug: bool = False,
446
+ **kw: Any
447
+ ) -> SuccessTuple:
433
448
  """
434
449
  Show the installed plugins.
435
450
  """
@@ -466,10 +481,10 @@ def _show_plugins(
466
481
  return True, "Success"
467
482
 
468
483
  def _show_users(
469
- mrsm_instance: Optional[str] = None,
470
- debug: bool = False,
471
- **kw: Any
472
- ) -> SuccessTuple:
484
+ mrsm_instance: Optional[str] = None,
485
+ debug: bool = False,
486
+ **kw: Any
487
+ ) -> SuccessTuple:
473
488
  """
474
489
  Show the registered users in a Meerschaum instance (default is the current instance).
475
490
  """
@@ -489,10 +504,10 @@ def _show_users(
489
504
  return True, "Success"
490
505
 
491
506
  def _show_packages(
492
- action: Optional[List[str]] = None,
493
- nopretty: bool = False,
494
- **kw: Any
495
- ) -> SuccessTuple:
507
+ action: Optional[List[str]] = None,
508
+ nopretty: bool = False,
509
+ **kw: Any
510
+ ) -> SuccessTuple:
496
511
  """
497
512
  Show the packages in dependency groups, or as a list with `--nopretty`.
498
513
  """
@@ -521,9 +536,9 @@ def _show_packages(
521
536
  return True, "Success"
522
537
 
523
538
  def _complete_show_packages(
524
- action: Optional[List[str]] = None,
525
- **kw: Any
526
- ) -> List[str]:
539
+ action: Optional[List[str]] = None,
540
+ **kw: Any
541
+ ) -> List[str]:
527
542
  from meerschaum.utils.packages import packages
528
543
  if not action:
529
544
  return sorted(list(packages.keys()))
@@ -536,10 +551,10 @@ def _complete_show_packages(
536
551
  return possibilities
537
552
 
538
553
  def _show_jobs(
539
- action: Optional[List[str]] = None,
540
- nopretty: bool = False,
541
- **kw: Any
542
- ) -> SuccessTuple:
554
+ action: Optional[List[str]] = None,
555
+ nopretty: bool = False,
556
+ **kw: Any
557
+ ) -> SuccessTuple:
543
558
  """
544
559
  Show the currently running and stopped jobs.
545
560
  """
@@ -563,10 +578,10 @@ def _show_jobs(
563
578
 
564
579
 
565
580
  def _show_logs(
566
- action: Optional[List[str]] = None,
567
- nopretty: bool = False,
568
- **kw
569
- ) -> SuccessTuple:
581
+ action: Optional[List[str]] = None,
582
+ nopretty: bool = False,
583
+ **kw
584
+ ) -> SuccessTuple:
570
585
  """
571
586
  Show the logs for jobs.
572
587
 
@@ -598,13 +613,15 @@ def _show_logs(
598
613
  now_follow_str = now.strftime(follow_timestamp_format)
599
614
 
600
615
  def build_buffer_spaces(daemons) -> Dict[str, str]:
601
- max_len_id = max(len(d.daemon_id) for d in daemons) if daemons else 0
616
+ max_len_id = (
617
+ max(len(d.daemon_id) for d in daemons) + 1
618
+ ) if daemons else 0
602
619
  buffer_len = max(
603
620
  get_config('jobs', 'logs', 'min_buffer_len'),
604
- max_len_id
621
+ max_len_id
605
622
  )
606
623
  return {
607
- d.daemon_id: ''.join([' ' for i in range(buffer_len - len(d.daemon_id))])
624
+ d.daemon_id: ''.join([' '] * (buffer_len - len(d.daemon_id)))
608
625
  for d in daemons
609
626
  }
610
627
 
@@ -754,9 +771,9 @@ def _show_logs(
754
771
 
755
772
 
756
773
  def _show_environment(
757
- nopretty: bool = False,
758
- **kw
759
- ) -> SuccessTuple:
774
+ nopretty: bool = False,
775
+ **kw
776
+ ) -> SuccessTuple:
760
777
  """
761
778
  Show all of the current environment variables with begin with `'MRSM_'`.
762
779
  """
@@ -774,12 +791,12 @@ def _show_environment(
774
791
 
775
792
 
776
793
  def _show_tags(
777
- action: Optional[List[str]] = None,
778
- tags: Optional[List[str]] = None,
779
- workers: Optional[int] = None,
780
- nopretty: bool = False,
781
- **kwargs
782
- ) -> SuccessTuple:
794
+ action: Optional[List[str]] = None,
795
+ tags: Optional[List[str]] = None,
796
+ workers: Optional[int] = None,
797
+ nopretty: bool = False,
798
+ **kwargs
799
+ ) -> SuccessTuple:
783
800
  """
784
801
  Show the existing tags and their associated pipes.
785
802
  """
@@ -854,10 +871,10 @@ def _show_tags(
854
871
 
855
872
 
856
873
  def _show_schedules(
857
- action: Optional[List[str]] = None,
858
- nopretty: bool = False,
859
- **kwargs: Any
860
- ) -> SuccessTuple:
874
+ action: Optional[List[str]] = None,
875
+ nopretty: bool = False,
876
+ **kwargs: Any
877
+ ) -> SuccessTuple:
861
878
  """
862
879
  Print the upcoming timestamps according to the given schedule.
863
880
 
@@ -905,8 +922,8 @@ def _show_schedules(
905
922
 
906
923
 
907
924
  def _show_venvs(
908
- **kwargs: Any
909
- ):
925
+ **kwargs: Any
926
+ ):
910
927
  """
911
928
  Print the available virtual environments in the current MRSM_ROOT_DIR.
912
929
  """
@@ -7,7 +7,7 @@ Functions for running the Docker Compose stack
7
7
  """
8
8
 
9
9
  from __future__ import annotations
10
- from meerschaum.utils.typing import SuccessTuple, Any, List, Optional
10
+ from meerschaum.utils.typing import SuccessTuple, Any, List, Optional, Union
11
11
 
12
12
  def stack(
13
13
  action: Optional[List[str]] = None,
@@ -19,7 +19,7 @@ def stack(
19
19
  debug: bool = False,
20
20
  _capture_output: bool = False,
21
21
  **kw: Any
22
- ) -> SuccessTuple:
22
+ ) -> Union[SuccessTuple, 'subprocess.Popen']:
23
23
  """
24
24
  Control the Meerschaum stack with Docker Compose.
25
25
  Usage: `stack {command}`
@@ -147,18 +147,18 @@ def stack(
147
147
  ['docker', 'compose'] if has_builtin_compose
148
148
  else ['docker-compose']
149
149
  ) + cmd_list,
150
- cwd = STACK_COMPOSE_PATH.parent,
151
- stdout = stdout,
152
- stderr = stderr,
153
- env = stack_env_dict,
150
+ cwd=STACK_COMPOSE_PATH.parent,
151
+ stdout=stdout,
152
+ stderr=stderr,
153
+ env=stack_env_dict,
154
154
  ) if (has_builtin_compose or has_binary_compose) else run_python_package(
155
155
  'compose',
156
- args = cmd_list,
157
- cwd = STACK_COMPOSE_PATH.parent,
158
- venv = _compose_venv,
159
- capture_output = _capture_output,
160
- as_proc = True,
161
- env = stack_env_dict,
156
+ args=cmd_list,
157
+ cwd=STACK_COMPOSE_PATH.parent,
158
+ venv=_compose_venv,
159
+ capture_output=_capture_output,
160
+ as_proc=True,
161
+ env=stack_env_dict,
162
162
  )
163
163
  try:
164
164
  rc = proc.wait() if proc is not None else 1
@@ -21,9 +21,9 @@ def stop(action: Optional[List[str]] = None, **kw) -> SuccessTuple:
21
21
 
22
22
 
23
23
  def _complete_stop(
24
- action: Optional[List[str]] = None,
25
- **kw: Any
26
- ) -> List[str]:
24
+ action: Optional[List[str]] = None,
25
+ **kw: Any
26
+ ) -> List[str]:
27
27
  """
28
28
  Override the default Meerschaum `complete_` function.
29
29
  """
@@ -49,14 +49,14 @@ def _complete_stop(
49
49
 
50
50
 
51
51
  def _stop_jobs(
52
- action: Optional[List[str]] = None,
53
- timeout_seconds: Optional[int] = None,
54
- noask: bool = False,
55
- force: bool = False,
56
- yes: bool = False,
57
- nopretty: bool = False,
58
- **kw
59
- ) -> SuccessTuple:
52
+ action: Optional[List[str]] = None,
53
+ timeout_seconds: Optional[int] = None,
54
+ noask: bool = False,
55
+ force: bool = False,
56
+ yes: bool = False,
57
+ nopretty: bool = False,
58
+ **kw
59
+ ) -> SuccessTuple:
60
60
  """
61
61
  Stop running jobs that were started with `-d` or `start job`.
62
62