meerschaum 2.2.6__py3-none-any.whl → 2.2.7__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 (33) hide show
  1. meerschaum/__main__.py +10 -5
  2. meerschaum/_internal/entry.py +13 -13
  3. meerschaum/_internal/shell/Shell.py +26 -22
  4. meerschaum/_internal/shell/updates.py +175 -0
  5. meerschaum/actions/register.py +19 -5
  6. meerschaum/actions/sync.py +3 -3
  7. meerschaum/actions/upgrade.py +28 -36
  8. meerschaum/api/routes/_pipes.py +20 -20
  9. meerschaum/config/_formatting.py +1 -0
  10. meerschaum/config/_paths.py +4 -0
  11. meerschaum/config/_shell.py +78 -66
  12. meerschaum/config/_version.py +1 -1
  13. meerschaum/config/static/__init__.py +1 -0
  14. meerschaum/connectors/api/_misc.py +1 -1
  15. meerschaum/connectors/api/_request.py +13 -9
  16. meerschaum/core/Pipe/_sync.py +3 -0
  17. meerschaum/utils/daemon/Daemon.py +88 -129
  18. meerschaum/utils/daemon/FileDescriptorInterceptor.py +14 -5
  19. meerschaum/utils/daemon/RotatingFile.py +8 -1
  20. meerschaum/utils/daemon/__init__.py +28 -21
  21. meerschaum/utils/formatting/__init__.py +81 -36
  22. meerschaum/utils/formatting/_jobs.py +47 -9
  23. meerschaum/utils/packages/__init__.py +21 -15
  24. meerschaum/utils/prompt.py +5 -0
  25. meerschaum/utils/schedule.py +21 -15
  26. {meerschaum-2.2.6.dist-info → meerschaum-2.2.7.dist-info}/METADATA +1 -1
  27. {meerschaum-2.2.6.dist-info → meerschaum-2.2.7.dist-info}/RECORD +33 -32
  28. {meerschaum-2.2.6.dist-info → meerschaum-2.2.7.dist-info}/LICENSE +0 -0
  29. {meerschaum-2.2.6.dist-info → meerschaum-2.2.7.dist-info}/NOTICE +0 -0
  30. {meerschaum-2.2.6.dist-info → meerschaum-2.2.7.dist-info}/WHEEL +0 -0
  31. {meerschaum-2.2.6.dist-info → meerschaum-2.2.7.dist-info}/entry_points.txt +0 -0
  32. {meerschaum-2.2.6.dist-info → meerschaum-2.2.7.dist-info}/top_level.txt +0 -0
  33. {meerschaum-2.2.6.dist-info → meerschaum-2.2.7.dist-info}/zip-safe +0 -0
@@ -6,127 +6,139 @@
6
6
  Default configuration for the Meerschaum shell.
7
7
  """
8
8
 
9
- # import platform
10
- # default_cmd = 'cmd' if platform.system() != 'Windows' else 'cmd2'
11
9
  default_cmd = 'cmd'
12
10
 
13
11
  default_shell_config = {
14
- 'ansi' : {
15
- 'intro' : {
16
- 'rich' : {
17
- 'style' : "bold bright_blue",
12
+ 'ansi' : {
13
+ 'intro' : {
14
+ 'rich' : {
15
+ 'style' : "bold bright_blue",
18
16
  },
19
- 'color' : [
17
+ 'color' : [
20
18
  'bold',
21
19
  'bright blue',
22
20
  ],
23
21
  },
24
- 'close_message': {
25
- 'rich' : {
26
- 'style' : 'bright_blue',
22
+ 'close_message' : {
23
+ 'rich' : {
24
+ 'style' : 'bright_blue',
27
25
  },
28
- 'color' : [
26
+ 'color' : [
29
27
  'bright blue',
30
28
  ],
31
29
  },
32
- 'doc_header': {
33
- 'rich' : {
34
- 'style' : 'bright_blue',
30
+ 'doc_header' : {
31
+ 'rich' : {
32
+ 'style' : 'bright_blue',
35
33
  },
36
- 'color' : [
34
+ 'color' : [
37
35
  'bright blue',
38
36
  ],
39
37
  },
40
- 'undoc_header': {
41
- 'rich' : {
42
- 'style' : 'bright_blue',
38
+ 'undoc_header' : {
39
+ 'rich' : {
40
+ 'style' : 'bright_blue',
43
41
  },
44
- 'color' : [
42
+ 'color' : [
45
43
  'bright blue',
46
44
  ],
47
45
  },
48
- 'ruler': {
49
- 'rich' : {
50
- 'style' : 'bold bright_blue',
46
+ 'ruler' : {
47
+ 'rich' : {
48
+ 'style' : 'bold bright_blue',
51
49
  },
52
- 'color' : [
50
+ 'color' : [
53
51
  'bold',
54
52
  'bright blue',
55
53
  ],
56
54
  },
57
- 'prompt': {
58
- 'rich' : {
59
- 'style' : 'green',
55
+ 'prompt' : {
56
+ 'rich' : {
57
+ 'style' : 'green',
60
58
  },
61
- 'color' : [
59
+ 'color' : [
62
60
  'green',
63
61
  ],
64
62
  },
65
- 'instance' : {
66
- 'rich' : {
67
- 'style' : 'cyan',
63
+ 'instance' : {
64
+ 'rich' : {
65
+ 'style' : 'cyan',
68
66
  },
69
- 'color' : [
67
+ 'color' : [
70
68
  'cyan',
71
69
  ],
72
70
  },
73
- 'repo' : {
74
- 'rich': {
75
- 'style': 'magenta',
71
+ 'repo' : {
72
+ 'rich' : {
73
+ 'style' : 'magenta',
76
74
  },
77
- 'color': [
75
+ 'color' : [
78
76
  'magenta',
79
77
  ],
80
78
  },
81
- 'username' : {
82
- 'rich' : {
83
- 'style' : 'white',
79
+ 'username' : {
80
+ 'rich' : {
81
+ 'style' : 'white',
84
82
  },
85
- 'color' : [
83
+ 'color' : [
86
84
  'white',
87
85
  ],
88
86
  },
89
- 'connected' : {
90
- 'rich' : {
91
- 'style' : 'green',
87
+ 'connected' : {
88
+ 'rich' : {
89
+ 'style' : 'green',
92
90
  },
93
- 'color' : [
91
+ 'color' : [
94
92
  'green',
95
93
  ],
96
94
  },
97
- 'disconnected' : {
98
- 'rich' : {
99
- 'style' : 'red',
95
+ 'disconnected' : {
96
+ 'rich' : {
97
+ 'style' : 'red',
100
98
  },
101
- 'color' : [
99
+ 'color' : [
100
+ 'red',
101
+ ],
102
+ },
103
+ 'update_message' : {
104
+ 'rich' : {
105
+ 'style' : 'red',
106
+ },
107
+ 'color' : [
102
108
  'red',
103
109
  ],
104
110
  },
105
111
  },
106
- 'ascii' : {
107
- 'intro' : """ ___ ___ __ __ __
112
+ 'ascii' : {
113
+ 'intro' : r""" ___ ___ __ __ __
108
114
  |\/| |__ |__ |__) /__` / ` |__| /\ | | |\/|
109
115
  | | |___ |___ | \ .__/ \__, | | /~~\ \__/ | |\n""",
110
- 'prompt' : '\n [ {username}@{instance} ] > ',
111
- 'ruler' : '-',
112
- 'close_message': 'Thank you for using Meerschaum!',
113
- 'doc_header' : 'Meerschaum actions (`help <action>` for usage):',
114
- 'undoc_header' : 'Unimplemented actions:',
116
+ 'prompt' : '\n [ {username}@{instance} ] > ',
117
+ 'ruler' : '-',
118
+ 'close_message' : 'Thank you for using Meerschaum!',
119
+ 'doc_header' : 'Meerschaum actions (`help <action>` for usage):',
120
+ 'undoc_header' : 'Unimplemented actions:',
121
+ 'update_message' : "Update available!",
115
122
  },
116
- 'unicode' : {
117
- 'intro' : """
123
+ 'unicode' : {
124
+ 'intro' : """
118
125
  █▄ ▄█ ██▀ ██▀ █▀▄ ▄▀▀ ▄▀▀ █▄█ ▄▀▄ █ █ █▄ ▄█
119
126
  █ ▀ █ █▄▄ █▄▄ █▀▄ ▄██ ▀▄▄ █ █ █▀█ ▀▄█ █ ▀ █\n""",
120
- 'prompt' : '\n [ {username}@{instance} ] ➤ ',
121
- 'ruler' : '─',
122
- 'close_message': ' MRSM{formatting:emoji:hand} Thank you for using Meerschaum! ',
123
- 'doc_header' : 'Meerschaum actions (`help <action>` for usage):',
124
- 'undoc_header' : 'Unimplemented actions:',
127
+ 'prompt' : '\n [ {username}@{instance} ] ➤ ',
128
+ 'ruler' : '─',
129
+ 'close_message' : ' MRSM{formatting:emoji:hand} Thank you for using Meerschaum! ',
130
+ 'doc_header' : 'Meerschaum actions (`help <action>` for usage):',
131
+ 'undoc_header' : 'Unimplemented actions:',
132
+ 'update_message' : "MRSM{formatting:emoji:announcement} Update available!",
133
+ },
134
+ 'timeout' : 60,
135
+ 'max_history' : 1000,
136
+ 'clear_screen' : True,
137
+ 'bottom_toolbar' : {
138
+ 'enabled' : True,
125
139
  },
126
- 'timeout' : 60,
127
- 'max_history' : 1000,
128
- 'clear_screen' : True,
129
- 'bottom_toolbar' : {
130
- 'enabled' : True,
140
+ 'updates' : {
141
+ 'check_remote' : True,
142
+ 'refresh_minutes': 180,
131
143
  },
132
144
  }
@@ -2,4 +2,4 @@
2
2
  Specify the Meerschaum release version.
3
3
  """
4
4
 
5
- __version__ = "2.2.6"
5
+ __version__ = "2.2.7"
@@ -39,6 +39,7 @@ STATIC_CONFIG: Dict[str, Any] = {
39
39
  'token_expires_minutes': 720,
40
40
  },
41
41
  'webterm_job_name': '_webterm',
42
+ 'default_timeout': 600,
42
43
  },
43
44
  'sql': {
44
45
  'internal_schema': '_mrsm_internal',
@@ -17,7 +17,7 @@ def get_mrsm_version(self, **kw) -> Optional[str]:
17
17
  try:
18
18
  j = self.get(
19
19
  STATIC_CONFIG['api']['endpoints']['version'] + '/mrsm',
20
- use_token = True,
20
+ use_token=False,
21
21
  **kw
22
22
  ).json()
23
23
  except Exception as e:
@@ -11,7 +11,7 @@ import urllib.parse
11
11
  import pathlib
12
12
  from meerschaum.utils.typing import Any, Optional, Dict, Union
13
13
  from meerschaum.utils.debug import dprint
14
- from meerschaum.utils.formatting import pprint
14
+ from meerschaum.config.static import STATIC_CONFIG
15
15
 
16
16
  METHODS = {
17
17
  'GET',
@@ -23,15 +23,16 @@ METHODS = {
23
23
  'DELETE',
24
24
  }
25
25
 
26
+
26
27
  def make_request(
27
- self,
28
- method: str,
29
- r_url: str,
30
- headers: Optional[Dict[str, Any]] = None,
31
- use_token: bool = True,
32
- debug: bool = False,
33
- **kwargs: Any
34
- ) -> 'requests.Response':
28
+ self,
29
+ method: str,
30
+ r_url: str,
31
+ headers: Optional[Dict[str, Any]] = None,
32
+ use_token: bool = True,
33
+ debug: bool = False,
34
+ **kwargs: Any
35
+ ) -> 'requests.Response':
35
36
  """
36
37
  Make a request to this APIConnector's endpoint using the in-memory session.
37
38
 
@@ -84,6 +85,9 @@ def make_request(
84
85
  if use_token:
85
86
  headers.update({'Authorization': f'Bearer {self.token}'})
86
87
 
88
+ if 'timeout' not in kwargs:
89
+ kwargs['timeout'] = STATIC_CONFIG['api']['default_timeout']
90
+
87
91
  request_url = urllib.parse.urljoin(self.url, r_url)
88
92
  if debug:
89
93
  dprint(f"[{self}] Sending a '{method.upper()}' request to {request_url}")
@@ -194,6 +194,9 @@ def sync(
194
194
  if hasattr(df, 'MRSM_INFER_FETCH'):
195
195
  try:
196
196
  if p.connector is None:
197
+ if ':' not in p.connector_keys:
198
+ return True, f"{p} does not support fetching; nothing to do."
199
+
197
200
  msg = f"{p} does not have a valid connector."
198
201
  if p.connector_keys.startswith('plugin:'):
199
202
  msg += f"\n Perhaps {p.connector_keys} has a syntax error?"