pyegeria 5.4.0.3__py3-none-any.whl → 5.4.0.5__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.
commands/cli/egeria.py CHANGED
@@ -14,7 +14,11 @@ import sys
14
14
 
15
15
  import click
16
16
  from trogon import tui
17
+ from loguru import logger
17
18
 
19
+ from pyegeria import config_logging, get_app_config
20
+
21
+ from commands.cat.list_format_set import execute_format_set_action
18
22
  from commands.cat.get_asset_graph import asset_viewer
19
23
  from commands.cat.get_collection import collection_viewer
20
24
  from commands.cat.get_project_dependencies import project_dependency_viewer
@@ -131,68 +135,66 @@ from commands.tech.list_tech_templates import display_templates_spec
131
135
  from commands.tech.list_valid_metadata_values import display_metadata_values
132
136
  from commands.tech.generic_actions import delete_element
133
137
 
138
+ EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
139
+ EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
140
+ app_settings = get_app_config()
141
+ app_config = app_settings["Environment"]
142
+ # config_logging()
143
+
144
+
134
145
  @tui()
135
146
  # @tui('menu', 'menu', 'A textual object_action line interface')
136
- @click.version_option("0.5.2 ", prog_name="hey_egeria")
147
+ @click.version_option("5.4 ", prog_name="hey_egeria")
137
148
  @click.group()
138
149
  @click.option(
139
150
  "--server",
140
- default=os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store"),
151
+ default=app_config['Egeria Metadata Store'],
141
152
  help="Egeria metadata store to work with",
142
153
  )
143
154
  @click.option(
144
155
  "--url",
145
- default=os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443"),
156
+ default=app_config["Egeria Platform URL"],
146
157
  help="URL of Egeria metadata store platform to connect to",
147
158
  )
148
159
  @click.option(
149
160
  "--integration_daemon",
150
- default=os.environ.get("EGERIA_INTEGRATION_DAEMON", "qs-integration-daemon"),
161
+ default=app_config["Egeria Integration Daemon"],
151
162
  help="Egeria integration daemon to work with",
152
163
  )
153
164
  @click.option(
154
165
  "--integration_daemon_url",
155
- default=os.environ.get("EGERIA_INTEGRATION_DAEMON_URL", "https://localhost:9443"),
166
+ default=app_config['Egeria Integration Daemon URL'],
156
167
  help="URL of Egeria integration daemon platform to connect to",
157
168
  )
158
169
  @click.option(
159
170
  "--view_server",
160
- default=os.environ.get("EGERIA_VIEW_SERVER", "qs-view-server"),
171
+ default=app_config['Egeria View Server'],
161
172
  help="Egeria view server to work with",
162
173
  )
163
174
  @click.option(
164
175
  "--view_server_url",
165
- default=os.environ.get("EGERIA_VIEW_SERVER_URL", "https://localhost:9443"),
176
+ default=app_config['Egeria View Server URL'],
166
177
  help="URL of Egeria view server platform to connect to",
167
178
  )
168
179
  @click.option(
169
180
  "--engine_host",
170
- default=os.environ.get("EGERIA_ENGINE_HOST", "qs-engine-host"),
181
+ default=app_config['Egeria Engine Host'],
171
182
  help="Egeria engine host to work with",
172
183
  )
173
184
  @click.option(
174
185
  "--engine_host_url",
175
- default=os.environ.get("EGERIA_ENGINE_HOST_URL", "https://localhost:9443"),
186
+ default=app_config['Egeria Engine Host URL'],
176
187
  help="URL of Egeria engine host platform to connect to",
177
188
  )
178
- @click.option(
179
- "--admin_user",
180
- default=os.environ.get("EGERIA_ADMIN_USER", "garygeeke"),
181
- help="Egeria admin user",
182
- )
183
- @click.option(
184
- "--admin_user_password",
185
- default=os.environ.get("EGERIA_ADMIN_PASSWORD", "secret"),
186
- help="Egeria admin password",
187
- )
189
+
188
190
  @click.option(
189
191
  "--userid",
190
- default=os.environ.get("EGERIA_USER", "erinoverview"),
192
+ default=EGERIA_USER,
191
193
  help="Egeria user",
192
194
  )
193
195
  @click.option(
194
196
  "--password",
195
- default=os.environ.get("EGERIA_USER_PASSWORD", "secret"),
197
+ default=EGERIA_USER_PASSWORD,
196
198
  help="Egeria user password",
197
199
  )
198
200
  @click.option("--timeout", default=60, help="Number of seconds to wait")
@@ -200,40 +202,40 @@ from commands.tech.generic_actions import delete_element
200
202
  "--jupyter",
201
203
  is_flag=True,
202
204
  type=bool,
203
- default=os.environ.get("EGERIA_JUPYTER", False),
205
+ default=app_config['Egeria Jupyter'],
204
206
  help="Enable for rendering in a Jupyter terminal",
205
207
  )
206
208
  @click.option(
207
209
  "--width",
208
- default=os.environ.get("EGERIA_WIDTH", 200),
210
+ default=app_config['Console Width'],
209
211
  type=int,
210
212
  help="Screen width, in characters, to use",
211
213
  )
212
214
  @click.option(
213
215
  "--home_glossary_guid",
214
- default=os.environ.get("EGERIA_HOME_GLOSSARY_GUID", None),
215
- help="Glossary guid to use as the home glossary",
216
+ default=app_settings['User Profile']['Egeria Home Glossary Name'],
217
+ help="Glossary name to use as the home glossary",
216
218
  )
217
219
  @click.option(
218
220
  "--glossary_path",
219
- default=os.environ.get("EGERIA_GLOSSARY_PATH", "/home/jovyan/loading-bay/glossary"),
221
+ default=app_config['Egeria Glossary Path'],
220
222
  help="Path to glossary import/export files",
221
223
  )
222
224
 
223
225
  @click.option(
224
226
  "--root_path",
225
- default=os.environ.get("EGERIA_ROOT_PATH", "/home/jovyan"),
227
+ default=app_config['Pyegeria Root'],
226
228
  help="Root path to use for file operations",
227
229
  )
228
230
 
229
231
  @click.option(
230
232
  "--inbox_path",
231
- default=os.environ.get("EGERIA_INBOX_PATH", "loading-bay/dr_egeria_inbox"),
232
- help="Path to outbox files",
233
+ default=app_config['Dr.Egeria Inbox'],
234
+ help="Path to inbox files",
233
235
  )
234
236
  @click.option(
235
237
  "--outbox_path",
236
- default=os.environ.get("EGERIA_OUTBOX_PATH", "distribution-hub/dr_egeria_outbox"),
238
+ default=app_config['Dr.Egeria Outbox'],
237
239
  help="Path to outbox files",
238
240
  )
239
241
 
@@ -248,8 +250,6 @@ def cli(
248
250
  integration_daemon_url,
249
251
  engine_host,
250
252
  engine_host_url,
251
- admin_user,
252
- admin_user_password,
253
253
  userid,
254
254
  password,
255
255
  timeout,
@@ -271,8 +271,6 @@ def cli(
271
271
  integration_daemon_url,
272
272
  engine_host,
273
273
  engine_host_url,
274
- admin_user,
275
- admin_user_password,
276
274
  userid,
277
275
  password,
278
276
  timeout,
@@ -1043,6 +1041,20 @@ def show_cat_info(ctx):
1043
1041
  """Group of md_commands to show information about various Egeria objects"""
1044
1042
  pass
1045
1043
 
1044
+ @show_cat_info.command("list-output-set")
1045
+ @click.option("--format-set", help="Format set to output")
1046
+ @click.option("--output-format", default = "TABLE", help="Output format type")
1047
+ @click.option('--search-string', default="*", help="Search string")
1048
+ @click.pass_context
1049
+ def show_format_set(ctx, format_set, output_format, search_string):
1050
+ """Dynamically generate output based on a format set"""
1051
+ c = ctx.obj
1052
+
1053
+ execute_format_set_action(
1054
+ format_set, c.view_server, c.view_server_url,
1055
+ c.userid, c.password, output_format, search_string = search_string
1056
+ )
1057
+
1046
1058
 
1047
1059
  @show_cat_info.command("tech-types")
1048
1060
  @click.option("--tech_type", default="*", help="Tech type to search for")
@@ -13,7 +13,9 @@ import os
13
13
 
14
14
  import click
15
15
  from trogon import tui
16
+ from pyegeria import config_logging, get_app_config
16
17
 
18
+ from commands.cat.list_format_set import execute_format_set_action
17
19
  from commands.cat.dr_egeria_md import process_markdown_file
18
20
  from commands.cat.get_asset_graph import asset_viewer
19
21
  from commands.cat.get_collection import collection_viewer
@@ -58,110 +60,109 @@ from commands.my.todo_actions import (
58
60
  )
59
61
  from commands.tech.list_asset_types import display_asset_types
60
62
 
63
+ EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
64
+ EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
65
+ app_settings = get_app_config()
66
+ app_config = app_settings["Environment"]
67
+ # config_logging()
68
+
61
69
 
62
70
  # @tui
63
71
  # @tui('menu','menu','A textual object_action line interface')
64
72
  @tui()
65
- @click.version_option("0.0.1", prog_name="egeria_ops")
73
+ # @tui('menu', 'menu', 'A textual object_action line interface')
74
+ @click.version_option("5.4 ", prog_name="hey_egeria")
66
75
  @click.group()
67
76
  @click.option(
68
77
  "--server",
69
- default=os.environ.get("EGERIA_METADATA_STORE", "qs-metadata-store"),
78
+ default=app_config['Egeria Metadata Store'],
70
79
  help="Egeria metadata store to work with",
71
80
  )
72
81
  @click.option(
73
82
  "--url",
74
- default=os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443"),
83
+ default=app_config["Egeria Platform URL"],
75
84
  help="URL of Egeria metadata store platform to connect to",
76
85
  )
77
86
  @click.option(
78
87
  "--integration_daemon",
79
- default=os.environ.get("EGERIA_INTEGRATION_DAEMON", "qs-integration-daemon"),
88
+ default=app_config["Egeria Integration Daemon"],
80
89
  help="Egeria integration daemon to work with",
81
90
  )
82
91
  @click.option(
83
92
  "--integration_daemon_url",
84
- default=os.environ.get("EGERIA_INTEGRATION_DAEMON_URL", "https://localhost:9443"),
93
+ default=app_config['Egeria Integration Daemon URL'],
85
94
  help="URL of Egeria integration daemon platform to connect to",
86
95
  )
87
96
  @click.option(
88
97
  "--view_server",
89
- default=os.environ.get("EGERIA_VIEW_SERVER", "qs-view-server"),
98
+ default=app_config['Egeria View Server'],
90
99
  help="Egeria view server to work with",
91
100
  )
92
101
  @click.option(
93
102
  "--view_server_url",
94
- default=os.environ.get("EGERIA_VIEW_SERVER_URL", "https://localhost:9443"),
103
+ default=app_config['Egeria View Server URL'],
95
104
  help="URL of Egeria view server platform to connect to",
96
105
  )
97
106
  @click.option(
98
107
  "--engine_host",
99
- default=os.environ.get("EGERIA_ENGINE_HOST", "qs-engine-host"),
108
+ default=app_config['Egeria Engine Host'],
100
109
  help="Egeria engine host to work with",
101
110
  )
102
111
  @click.option(
103
112
  "--engine_host_url",
104
- default=os.environ.get("EGERIA_ENGINE_HOST_URL", "https://localhost:9443"),
113
+ default=app_config['Egeria Engine Host URL'],
105
114
  help="URL of Egeria engine host platform to connect to",
106
115
  )
107
- @click.option(
108
- "--admin_user",
109
- default=os.environ.get("EGERIA_ADMIN_USER", "garygeeke"),
110
- help="Egeria admin user",
111
- )
112
- @click.option(
113
- "--admin_user_password",
114
- default=os.environ.get("EGERIA_ADMIN_PASSWORD", "secret"),
115
- help="Egeria admin password",
116
- )
116
+
117
117
  @click.option(
118
118
  "--userid",
119
- default=os.environ.get("EGERIA_USER", "peterprofile"),
119
+ default=EGERIA_USER,
120
120
  help="Egeria user",
121
121
  )
122
122
  @click.option(
123
123
  "--password",
124
- default=os.environ.get("EGERIA_USER_PASSWORD", "secret"),
124
+ default=EGERIA_USER_PASSWORD,
125
125
  help="Egeria user password",
126
126
  )
127
127
  @click.option("--timeout", default=60, help="Number of seconds to wait")
128
128
  @click.option(
129
129
  "--jupyter",
130
130
  is_flag=True,
131
- default=os.environ.get("EGERIA_JUPYTER", "False"),
131
+ type=bool,
132
+ default=app_config['Egeria Jupyter'],
132
133
  help="Enable for rendering in a Jupyter terminal",
133
134
  )
134
135
  @click.option(
135
136
  "--width",
136
- default=os.environ.get("EGERIA_WIDTH", 200),
137
+ default=app_config['Console Width'],
137
138
  type=int,
138
139
  help="Screen width, in characters, to use",
139
140
  )
140
141
  @click.option(
141
142
  "--home_glossary_guid",
142
- default=os.environ.get("EGERIA_HOME_GLOSSARY_GUID", None),
143
- help="Glossary guid to use as the home glossary",
143
+ default=app_settings['User Profile']['Egeria Home Glossary Name'],
144
+ help="Glossary name to use as the home glossary",
144
145
  )
145
146
  @click.option(
146
147
  "--glossary_path",
147
- default=os.environ.get("EGERIA_GLOSSARY_PATH", "/home/jovyan/loading-bay/glossary"),
148
+ default=app_config['Egeria Glossary Path'],
148
149
  help="Path to glossary import/export files",
149
150
  )
150
151
 
151
152
  @click.option(
152
153
  "--root_path",
153
- default=os.environ.get("EGERIA_ROOT_PATH", "/home/jovyan"),
154
+ default=app_config['Pyegeria Root'],
154
155
  help="Root path to use for file operations",
155
156
  )
156
157
 
157
158
  @click.option(
158
159
  "--inbox_path",
159
- default=os.environ.get("EGERIA_INBOX_PATH", "loading-bay/dr_egeria_inbox"),
160
+ default=app_config['Dr.Egeria Inbox'],
160
161
  help="Path to inbox files",
161
162
  )
162
163
  @click.option(
163
164
  "--outbox_path",
164
- default=os.environ.get("EGERIA_OUTBOX_PATH", "distribution-hub/dr_egeria_outbox"),
165
+ default=app_config['Dr.Egeria Outbox'],
165
166
  help="Path to outbox files",
166
167
  )
167
168
 
@@ -176,8 +177,6 @@ def cli(
176
177
  integration_daemon_url,
177
178
  engine_host,
178
179
  engine_host_url,
179
- admin_user,
180
- admin_user_password,
181
180
  userid,
182
181
  password,
183
182
  timeout,
@@ -199,8 +198,6 @@ def cli(
199
198
  integration_daemon_url,
200
199
  engine_host,
201
200
  engine_host_url,
202
- admin_user,
203
- admin_user_password,
204
201
  userid,
205
202
  password,
206
203
  timeout,
@@ -229,6 +226,22 @@ def info(ctx):
229
226
  pass
230
227
 
231
228
 
229
+ @info.command("list-output-set")
230
+ @click.option("--format-set", help="Format set to output")
231
+ @click.option("--output-format", default = "TABLE", help="Output format type")
232
+ @click.option('--search-string', default="*", help="Search string")
233
+ @click.pass_context
234
+ def show_format_set(ctx, format_set, output_format, search_string):
235
+ """Dynamically generate output based on a format set"""
236
+ c = ctx.obj
237
+
238
+ execute_format_set_action(
239
+ format_set, c.view_server, c.view_server_url,
240
+ c.userid, c.password, output_format, search_string = search_string
241
+ )
242
+
243
+
244
+
232
245
  @info.command("tech-types")
233
246
  @click.option("--tech_type", default="*", help="Tech type to search for")
234
247
  @click.pass_context
@@ -12,8 +12,6 @@ class Config(object):
12
12
  integration_daemon_url: str,
13
13
  engine_host: str,
14
14
  engine_host_url: str,
15
- admin_user: str,
16
- admin_user_password: str,
17
15
  userid: str,
18
16
  password: str,
19
17
  timeout: int,
@@ -33,8 +31,7 @@ class Config(object):
33
31
  self.integration_daemon_url = integration_daemon_url
34
32
  self.engine_host = engine_host
35
33
  self.engine_host_url = engine_host_url
36
- self.admin_user = admin_user
37
- self.admin_user_password = admin_user_password
34
+
38
35
  self.userid = userid
39
36
  self.password = password
40
37
  self.timeout = timeout
@@ -0,0 +1,8 @@
1
+ [
2
+ {
3
+ "Display Name": "",
4
+ "Qualified Name": " [DataStruct::TBDF-Incoming Weekly Measurement Data](#3e4bc9a1-2661-4d24-a753-b26060c61e34) ",
5
+ "Category": "",
6
+ "Description": "This describes the weekly measurement data for each patient for the Teddy Bear drop foot clinical trial."
7
+ }
8
+ ]
@@ -0,0 +1,19 @@
1
+ # Puddy Approves
2
+ This is a tutorial on how to use a data struct description
3
+
4
+ # Data Structure Report - created at 2025-07-29 15:54
5
+ Data Structure found from the search string: `All`
6
+
7
+ <a id="3e4bc9a1-2661-4d24-a753-b26060c61e34"></a>
8
+ # Data Structure Name:
9
+
10
+ ## Qualified Name
11
+ [DataStruct::TBDF-Incoming Weekly Measurement Data](#3e4bc9a1-2661-4d24-a753-b26060c61e34)
12
+
13
+ ## Description
14
+ This describes the weekly measurement data for each patient for the Teddy Bear drop foot clinical trial.
15
+
16
+ ## GUID
17
+ 3e4bc9a1-2661-4d24-a753-b26060c61e34
18
+
19
+ [[Data Structure]]
pyegeria/__init__.py CHANGED
@@ -11,7 +11,7 @@ the server platform and servers.
11
11
 
12
12
  """
13
13
  from .load_config import load_app_config, get_app_config
14
- from .logging_configuration import config_logging
14
+ from .logging_configuration import config_logging, init_logging
15
15
  from ._globals import (INTEGRATION_GUIDS, TEMPLATE_GUIDS, default_time_out, disable_ssl_warnings, enable_ssl_check,
16
16
  is_debug, max_paging_size, NO_ELEMENTS_FOUND, NO_ASSETS_FOUND, NO_SERVERS_FOUND,
17
17
  NO_CATALOGS_FOUND, NO_GLOSSARIES_FOUND, NO_TERMS_FOUND, NO_CATEGORIES_FOUND, NO_ELEMENT_FOUND,
@@ -360,3 +360,32 @@ def print_exception_table(e: PyegeriaException):
360
360
  console.print(table)
361
361
  else:
362
362
  print(f"\n\n\t Not an Pyegeria exception {e}")
363
+
364
+ def print_basic_exception(e: PyegeriaException):
365
+ """Prints the exception response"""
366
+ related_code = e.related_http_code if hasattr(e, "related_http_code") else ""
367
+ related_response = e.response.json()
368
+ table = Table(title=f"Exception: {e.__class__.__name__}", show_lines=True, header_style="bold", box=box.HEAVY_HEAD)
369
+ table.caption = e.pyegeria_code
370
+ table.add_column("Facet", justify="center")
371
+ table.add_column("Item", justify="left", width=80)
372
+
373
+ if isinstance(e, PyegeriaException):
374
+ table.add_row("HTTP Code", str(e.response_code))
375
+ table.add_row("Egeria Code", str(related_code))
376
+ table.add_row("Caller Method", e.context.get("caller method", "---"))
377
+ table.add_row("Request URL", str(e.response_url))
378
+ table.add_row("Egeria Message",
379
+ format_dict_to_string(related_response.get('exceptionErrorMessage',"")))
380
+ table.add_row("Egeria User Action",
381
+ format_dict_to_string(related_response.get('exceptionUserAction',"")))
382
+
383
+ exception_msg_id = related_response.get("exceptionErrorMessageId", None)
384
+ table.add_row("Pyegeria Exception", exception_msg_id)
385
+ table.add_row("Pyegeria Message",
386
+ f"\n\t{e.error_details['message_template'].format(exception_msg_id)}\n")
387
+
388
+
389
+ console.print(table)
390
+ else:
391
+ print(f"\n\n\t Not an Pyegeria exception {e}")