meerschaum 2.8.4__py3-none-any.whl → 2.9.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.
- meerschaum/api/_chunks.py +67 -0
- meerschaum/api/dash/callbacks/__init__.py +5 -2
- meerschaum/api/dash/callbacks/custom.py +21 -8
- meerschaum/api/dash/callbacks/dashboard.py +26 -4
- meerschaum/api/dash/callbacks/settings/__init__.py +8 -0
- meerschaum/api/dash/callbacks/settings/password_reset.py +76 -0
- meerschaum/api/dash/components.py +136 -25
- meerschaum/api/dash/pages/__init__.py +1 -0
- meerschaum/api/dash/pages/dashboard.py +11 -9
- meerschaum/api/dash/pages/plugins.py +31 -27
- meerschaum/api/dash/pages/settings/__init__.py +8 -0
- meerschaum/api/dash/pages/settings/password_reset.py +63 -0
- meerschaum/api/dash/webterm.py +6 -3
- meerschaum/api/resources/static/css/dash.css +8 -1
- meerschaum/api/resources/templates/termpage.html +4 -0
- meerschaum/api/routes/_pipes.py +232 -79
- meerschaum/config/_default.py +4 -0
- meerschaum/config/_version.py +1 -1
- meerschaum/connectors/__init__.py +1 -0
- meerschaum/connectors/api/_APIConnector.py +12 -1
- meerschaum/connectors/api/_pipes.py +106 -45
- meerschaum/connectors/api/_plugins.py +51 -45
- meerschaum/connectors/api/_request.py +1 -1
- meerschaum/connectors/parse.py +1 -2
- meerschaum/connectors/sql/_SQLConnector.py +3 -0
- meerschaum/connectors/sql/_cli.py +1 -0
- meerschaum/connectors/sql/_create_engine.py +51 -4
- meerschaum/connectors/sql/_pipes.py +38 -6
- meerschaum/connectors/sql/_sql.py +35 -4
- meerschaum/connectors/valkey/_ValkeyConnector.py +2 -0
- meerschaum/connectors/valkey/_pipes.py +51 -39
- meerschaum/core/Pipe/__init__.py +1 -0
- meerschaum/core/Pipe/_data.py +1 -2
- meerschaum/core/Pipe/_sync.py +64 -4
- meerschaum/plugins/_Plugin.py +21 -5
- meerschaum/plugins/__init__.py +32 -8
- meerschaum/utils/dataframe.py +139 -2
- meerschaum/utils/dtypes/__init__.py +211 -1
- meerschaum/utils/dtypes/sql.py +296 -5
- meerschaum/utils/formatting/_shell.py +1 -4
- meerschaum/utils/misc.py +1 -1
- meerschaum/utils/packages/_packages.py +7 -1
- meerschaum/utils/sql.py +139 -11
- meerschaum/utils/venv/__init__.py +6 -1
- {meerschaum-2.8.4.dist-info → meerschaum-2.9.0.dist-info}/METADATA +17 -3
- {meerschaum-2.8.4.dist-info → meerschaum-2.9.0.dist-info}/RECORD +52 -52
- {meerschaum-2.8.4.dist-info → meerschaum-2.9.0.dist-info}/WHEEL +1 -1
- meerschaum/_internal/gui/__init__.py +0 -43
- meerschaum/_internal/gui/app/__init__.py +0 -50
- meerschaum/_internal/gui/app/_windows.py +0 -74
- meerschaum/_internal/gui/app/actions.py +0 -30
- meerschaum/_internal/gui/app/pipes.py +0 -47
- {meerschaum-2.8.4.dist-info → meerschaum-2.9.0.dist-info}/LICENSE +0 -0
- {meerschaum-2.8.4.dist-info → meerschaum-2.9.0.dist-info}/NOTICE +0 -0
- {meerschaum-2.8.4.dist-info → meerschaum-2.9.0.dist-info}/entry_points.txt +0 -0
- {meerschaum-2.8.4.dist-info → meerschaum-2.9.0.dist-info}/top_level.txt +0 -0
- {meerschaum-2.8.4.dist-info → meerschaum-2.9.0.dist-info}/zip-safe +0 -0
@@ -1,43 +0,0 @@
|
|
1
|
-
#! /usr/bin/env python3
|
2
|
-
# -*- coding: utf-8 -*-
|
3
|
-
# vim:fenc=utf-8
|
4
|
-
|
5
|
-
"""
|
6
|
-
Meerschaum GUI definition. Start the GUI with `start gui`.
|
7
|
-
"""
|
8
|
-
|
9
|
-
from meerschaum.config.static import STATIC_CONFIG
|
10
|
-
from meerschaum.utils.packages import attempt_import
|
11
|
-
from meerschaum.config import __version__
|
12
|
-
from meerschaum.config._paths import PACKAGE_ROOT_PATH
|
13
|
-
from meerschaum.utils.threading import Lock
|
14
|
-
|
15
|
-
from meerschaum._internal.gui.app import MeerschaumApp
|
16
|
-
|
17
|
-
icon_path = PACKAGE_ROOT_PATH / 'api' / 'dash' / 'assets' / 'logo_500x500.png'
|
18
|
-
|
19
|
-
locks = {'app': Lock()}
|
20
|
-
_app = None
|
21
|
-
|
22
|
-
def get_app(**kw) -> MeerschaumApp:
|
23
|
-
"""Instantiate and return the main app."""
|
24
|
-
global _app
|
25
|
-
if _app is None:
|
26
|
-
with locks['app']:
|
27
|
-
_app = build_app(**kw)
|
28
|
-
return _app
|
29
|
-
|
30
|
-
def build_app(**kw) -> MeerschaumApp:
|
31
|
-
"""Construct and return an instance of the GUI application."""
|
32
|
-
_kw = dict(
|
33
|
-
formal_name = STATIC_CONFIG['setup']['formal_name'],
|
34
|
-
app_id = STATIC_CONFIG['setup']['app_id'],
|
35
|
-
app_name = STATIC_CONFIG['setup']['name'],
|
36
|
-
author = STATIC_CONFIG['setup']['author'],
|
37
|
-
description = STATIC_CONFIG['setup']['description'],
|
38
|
-
icon = icon_path,
|
39
|
-
version = __version__,
|
40
|
-
home_page = STATIC_CONFIG['setup']['url'],
|
41
|
-
)
|
42
|
-
_kw.update(kw)
|
43
|
-
return MeerschaumApp(**_kw)
|
@@ -1,50 +0,0 @@
|
|
1
|
-
#! /usr/bin/env python3
|
2
|
-
# -*- coding: utf-8 -*-
|
3
|
-
# vim:fenc=utf-8
|
4
|
-
|
5
|
-
"""
|
6
|
-
Define the `toga.App` implementation here.
|
7
|
-
"""
|
8
|
-
|
9
|
-
from __future__ import annotations
|
10
|
-
from meerschaum.utils.typing import Optional, List, Dict, Any
|
11
|
-
|
12
|
-
from meerschaum.utils.packages import attempt_import
|
13
|
-
toga = attempt_import('toga', lazy=False, venv=None)
|
14
|
-
|
15
|
-
from meerschaum._internal.gui.app._windows import get_windows, get_main_window
|
16
|
-
|
17
|
-
class MeerschaumApp(toga.App):
|
18
|
-
|
19
|
-
|
20
|
-
def __init__(
|
21
|
-
self,
|
22
|
-
*args: Any,
|
23
|
-
mrsm_instance: Optional[str] = None,
|
24
|
-
debug: bool = False,
|
25
|
-
**kw: Any
|
26
|
-
):
|
27
|
-
"""
|
28
|
-
Set the initial state of the GUI application from the keyword arguments.
|
29
|
-
"""
|
30
|
-
from meerschaum.utils.misc import filter_keywords
|
31
|
-
self._windows = get_windows(instance=mrsm_instance, debug=debug, **kw)
|
32
|
-
windows_list = list(kw.pop('windows', []))
|
33
|
-
windows_list += [w for k, w in self._windows.items()]
|
34
|
-
_init = super(MeerschaumApp, self).__init__
|
35
|
-
_init(*args, **filter_keywords(_init, windows=windows_list, **kw))
|
36
|
-
self._debug = debug
|
37
|
-
self._instance = mrsm_instance
|
38
|
-
self._kw = kw
|
39
|
-
|
40
|
-
def startup(self) -> None:
|
41
|
-
"""Entrypoint for the GUI application."""
|
42
|
-
self.main_window = get_main_window(instance=self._instance, debug=self._debug, **self._kw)
|
43
|
-
for k, w in self._windows.items():
|
44
|
-
if k == 'main':
|
45
|
-
continue
|
46
|
-
w.app = self
|
47
|
-
self._windows['main'] = self.main_window
|
48
|
-
|
49
|
-
self.main_window.show()
|
50
|
-
print('CLOSE')
|
@@ -1,74 +0,0 @@
|
|
1
|
-
#! /usr/bin/env python3
|
2
|
-
# -*- coding: utf-8 -*-
|
3
|
-
# vim:fenc=utf-8
|
4
|
-
|
5
|
-
"""
|
6
|
-
Define different windows for the GUI application.
|
7
|
-
"""
|
8
|
-
|
9
|
-
from __future__ import annotations
|
10
|
-
from meerschaum.utils.typing import List, Dict, Optional
|
11
|
-
|
12
|
-
from meerschaum._internal.gui.app import toga
|
13
|
-
|
14
|
-
def get_windows(**kw) -> Dict[str, toga.window.Window]:
|
15
|
-
return {
|
16
|
-
# 'main': get_main_window(**kw),
|
17
|
-
'terminal': get_terminal_window(**kw),
|
18
|
-
}
|
19
|
-
|
20
|
-
|
21
|
-
def get_main_window(instance: Optional[str], debug: bool = False, **kw) -> toga.window.Window:
|
22
|
-
from meerschaum.config.static import _static_config
|
23
|
-
from meerschaum.utils.misc import get_connector_labels
|
24
|
-
from meerschaum.connectors import instance_types
|
25
|
-
from meerschaum._internal.gui.app.pipes import build_pipes_tree
|
26
|
-
|
27
|
-
main_window = toga.MainWindow(title=_static_config()['setup']['formal_name'], size=(1280, 720))
|
28
|
-
tree = build_pipes_tree(mrsm_instance=instance, debug=debug, **kw)
|
29
|
-
sub_menu = toga.Group("Sub Menu", parent=toga.Group.COMMANDS, order=2)
|
30
|
-
|
31
|
-
left_box = toga.Box(children=[
|
32
|
-
toga.Box(children=[
|
33
|
-
toga.Selection(items=get_connector_labels(*instance_types), style=toga.style.Pack(flex=1)),
|
34
|
-
tree,
|
35
|
-
toga.Button('Hello, world!', style=toga.style.Pack(flex=1, padding=10), on_press=show_test_window),
|
36
|
-
], style=toga.style.Pack(flex=1, padding=10, direction='column', width=200))
|
37
|
-
|
38
|
-
])
|
39
|
-
label = toga.Label("foo!")
|
40
|
-
right_box = toga.Box(children=[], style=toga.style.Pack(flex=1))
|
41
|
-
|
42
|
-
main_box = toga.Box(children=[left_box, right_box])
|
43
|
-
|
44
|
-
option_container = toga.OptionContainer()
|
45
|
-
option_container.add('foo', label)
|
46
|
-
# option_container.add('Terminal', self.webview)
|
47
|
-
# main_box = toga.Box(option_container)
|
48
|
-
# main_box = option_container
|
49
|
-
main_window.content = main_box
|
50
|
-
|
51
|
-
from meerschaum.config._paths import PACKAGE_ROOT_PATH
|
52
|
-
icon_path = PACKAGE_ROOT_PATH / 'api' / 'dash' / 'assets' / 'logo_500x500.png'
|
53
|
-
command = toga.Command(_open_webterm, label='Open Terminal', icon=icon_path, tooltip=_open_webterm.__doc__)
|
54
|
-
# main_window.toolbar.add(command)
|
55
|
-
# self._windows['main_window'] = main_window
|
56
|
-
# return self._windows['main_window']
|
57
|
-
return main_window
|
58
|
-
|
59
|
-
|
60
|
-
def get_terminal_window(**kw):
|
61
|
-
window = toga.Window(title='Terminal')
|
62
|
-
webview = toga.WebView(url='http://localhost:8765', style=toga.style.Pack(flex=1))
|
63
|
-
box = toga.Box(children=[webview])
|
64
|
-
|
65
|
-
window.content = box
|
66
|
-
return window
|
67
|
-
|
68
|
-
|
69
|
-
def _open_webterm():
|
70
|
-
"""Foo bar"""
|
71
|
-
|
72
|
-
def show_test_window(button):
|
73
|
-
from meerschaum._internal.gui import get_app
|
74
|
-
get_app()._windows['terminal'].show()
|
@@ -1,30 +0,0 @@
|
|
1
|
-
#! /usr/bin/env python3
|
2
|
-
# -*- coding: utf-8 -*-
|
3
|
-
# vim:fenc=utf-8
|
4
|
-
|
5
|
-
"""
|
6
|
-
Wrap the Meerschaum actions into Toga commands.
|
7
|
-
"""
|
8
|
-
|
9
|
-
from meerschaum.utils.packages import attempt_import
|
10
|
-
toga = attempt_import('toga', lazy=False, venv=None)
|
11
|
-
|
12
|
-
from meerschaum.config._paths import PACKAGE_ROOT_PATH
|
13
|
-
icon_path = PACKAGE_ROOT_PATH / 'api' / 'dash' / 'assets' / 'logo_500x500.png'
|
14
|
-
|
15
|
-
def add_actions_as_commands(app) -> None:
|
16
|
-
"""Add the standard Meerschaum actions as commands."""
|
17
|
-
from meerschaum.actions import actions
|
18
|
-
commands = []
|
19
|
-
for action, fn in actions.items():
|
20
|
-
try:
|
21
|
-
doc = fn.__doc__
|
22
|
-
except Exception as e:
|
23
|
-
doc = "No help available."
|
24
|
-
commands.append(toga.Command(_action_to_command_wrapper, label=action, tooltip=doc, icon=icon_path))
|
25
|
-
app.commands.add(*commands)
|
26
|
-
# app.main_window.toolbar.add(*commands)
|
27
|
-
|
28
|
-
|
29
|
-
def _action_to_command_wrapper(widget, **kw):
|
30
|
-
print(widget.key)
|
@@ -1,47 +0,0 @@
|
|
1
|
-
#! /usr/bin/env python3
|
2
|
-
# -*- coding: utf-8 -*-
|
3
|
-
# vim:fenc=utf-8
|
4
|
-
|
5
|
-
"""
|
6
|
-
Interact with Meerschaum Pipes via the GUI.
|
7
|
-
"""
|
8
|
-
|
9
|
-
from meerschaum._internal.gui.app import toga
|
10
|
-
|
11
|
-
def build_pipes_tree(**kw) -> toga.Tree:
|
12
|
-
"""Retrieve pipes and return a `toga.Tree` object."""
|
13
|
-
from meerschaum.utils.formatting import ANSI, CHARSET, UNICODE
|
14
|
-
from meerschaum.config import get_config
|
15
|
-
from meerschaum import get_pipes
|
16
|
-
|
17
|
-
icons = {'connector': '', 'metric': '', 'location': '',}
|
18
|
-
if UNICODE:
|
19
|
-
icons['connector'] = get_config('formatting', 'emoji', 'connector')
|
20
|
-
icons['metric'] = get_config('formatting', 'emoji', 'metric')
|
21
|
-
icons['location'] = get_config('formatting', 'emoji', 'location')
|
22
|
-
|
23
|
-
kw.pop('as_list', None)
|
24
|
-
pipes = get_pipes(as_list=False, **kw)
|
25
|
-
tree = toga.Tree(
|
26
|
-
headings = ["Pipes"],
|
27
|
-
style = toga.style.Pack(flex=1, padding=10, direction='column'),
|
28
|
-
on_select = _pipes_tree_on_select_handler,
|
29
|
-
)
|
30
|
-
for ck in pipes:
|
31
|
-
ck_root = tree.data.append(None, pipes=(icons['connector'] + ' ' + ck))
|
32
|
-
for mk in pipes[ck]:
|
33
|
-
mk_root = tree.data.append(ck_root, pipes=(icons['metric'] + ' ' + mk))
|
34
|
-
|
35
|
-
for lk in pipes[ck][mk]:
|
36
|
-
_lk = lk if lk is not None else "None"
|
37
|
-
tree.data.append(mk_root, pipes=(icons['location'] + ' ' + _lk + ' '))
|
38
|
-
return tree
|
39
|
-
|
40
|
-
|
41
|
-
def _pipes_tree_on_select_handler(
|
42
|
-
widget: toga.Widget,
|
43
|
-
node: toga.sources.tree_source.Node,
|
44
|
-
):
|
45
|
-
pass
|
46
|
-
# self.right_box._children = [toga.Label("memes")]
|
47
|
-
# self.label.text = 'memes'
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|