pyegeria 5.3.3.9__py3-none-any.whl → 5.3.3.10__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 (97) hide show
  1. pyegeria/.DS_Store +0 -0
  2. pyegeria/__init__.py +4 -2
  3. pyegeria/_client.py +3 -1
  4. pyegeria/classification_manager_omvs.py +2 -0
  5. pyegeria/commands/.DS_Store +0 -0
  6. pyegeria/commands/__pycache__/__init__.cpython-312.pyc +0 -0
  7. pyegeria/commands/__pycache__/server_status_widget.cpython-312-pytest-7.4.4.pyc +0 -0
  8. pyegeria/commands/cat/__pycache__/__init__.cpython-312.pyc +0 -0
  9. pyegeria/commands/cat/__pycache__/get_asset_graph.cpython-312.pyc +0 -0
  10. pyegeria/commands/cat/__pycache__/get_collection.cpython-312.pyc +0 -0
  11. pyegeria/commands/cat/__pycache__/get_project_dependencies.cpython-312.pyc +0 -0
  12. pyegeria/commands/cat/__pycache__/get_project_structure.cpython-312.pyc +0 -0
  13. pyegeria/commands/cat/__pycache__/get_tech_type_elements.cpython-312.pyc +0 -0
  14. pyegeria/commands/cat/__pycache__/glossary_actions.cpython-312.pyc +0 -0
  15. pyegeria/commands/cat/__pycache__/list_assets.cpython-312.pyc +0 -0
  16. pyegeria/commands/cat/__pycache__/list_cert_types.cpython-312.pyc +0 -0
  17. pyegeria/commands/cat/__pycache__/list_collections.cpython-312.pyc +0 -0
  18. pyegeria/commands/cat/__pycache__/list_deployed_catalogs.cpython-312.pyc +0 -0
  19. pyegeria/commands/cat/__pycache__/list_deployed_database_schemas.cpython-312.pyc +0 -0
  20. pyegeria/commands/cat/__pycache__/list_deployed_databases.cpython-312.pyc +0 -0
  21. pyegeria/commands/cat/__pycache__/list_glossaries.cpython-312.pyc +0 -0
  22. pyegeria/commands/cat/__pycache__/list_projects.cpython-312.pyc +0 -0
  23. pyegeria/commands/cat/__pycache__/list_servers_deployed_imp.cpython-312.pyc +0 -0
  24. pyegeria/commands/cat/__pycache__/list_tech_type_elements.cpython-312.pyc +0 -0
  25. pyegeria/commands/cat/__pycache__/list_tech_types.cpython-312.pyc +0 -0
  26. pyegeria/commands/cat/__pycache__/list_terms.cpython-312.pyc +0 -0
  27. pyegeria/commands/cat/__pycache__/list_todos.cpython-312.pyc +0 -0
  28. pyegeria/commands/cat/__pycache__/list_user_ids.cpython-312.pyc +0 -0
  29. pyegeria/commands/cat/list_terms.py +9 -8
  30. pyegeria/commands/cli/__pycache__/__init__.cpython-312.pyc +0 -0
  31. pyegeria/commands/cli/__pycache__/egeria_login_tui.cpython-312.pyc +0 -0
  32. pyegeria/commands/cli/__pycache__/egeria_ops.cpython-312.pyc +0 -0
  33. pyegeria/commands/cli/__pycache__/ops_config.cpython-312.pyc +0 -0
  34. pyegeria/commands/doc/.DS_Store +0 -0
  35. pyegeria/commands/doc/Visual Command Reference/.DS_Store +0 -0
  36. pyegeria/commands/doc/Visual Command Reference/cat/.DS_Store +0 -0
  37. pyegeria/commands/doc/Visual Command Reference/cat/show/.DS_Store +0 -0
  38. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/.DS_Store +0 -0
  39. pyegeria/commands/doc/glossary/.DS_Store +0 -0
  40. pyegeria/commands/doc/glossary/images/.DS_Store +0 -0
  41. pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/.DS_Store +0 -0
  42. pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/.DS_Store +0 -0
  43. pyegeria/commands/my/__pycache__/__init__.cpython-312.pyc +0 -0
  44. pyegeria/commands/my/__pycache__/list_my_profile.cpython-312.pyc +0 -0
  45. pyegeria/commands/my/__pycache__/list_my_roles.cpython-312.pyc +0 -0
  46. pyegeria/commands/my/__pycache__/monitor_my_todos.cpython-312.pyc +0 -0
  47. pyegeria/commands/my/__pycache__/monitor_open_todos.cpython-312.pyc +0 -0
  48. pyegeria/commands/my/__pycache__/todo_actions.cpython-312.pyc +0 -0
  49. pyegeria/commands/my/monitor_my_todos.py +1 -1
  50. pyegeria/commands/my/monitor_open_todos.py +1 -1
  51. pyegeria/commands/ops/__pycache__/__init__.cpython-312.pyc +0 -0
  52. pyegeria/commands/ops/__pycache__/gov_server_actions.cpython-312.pyc +0 -0
  53. pyegeria/commands/ops/__pycache__/list_archives.cpython-312.pyc +0 -0
  54. pyegeria/commands/ops/__pycache__/list_catalog_targets.cpython-312.pyc +0 -0
  55. pyegeria/commands/ops/__pycache__/load_archive.cpython-312.pyc +0 -0
  56. pyegeria/commands/ops/__pycache__/monitor_engine_activity.cpython-312.pyc +0 -0
  57. pyegeria/commands/ops/__pycache__/monitor_engine_activity_c.cpython-312.pyc +0 -0
  58. pyegeria/commands/ops/__pycache__/monitor_gov_eng_status.cpython-312.pyc +0 -0
  59. pyegeria/commands/ops/__pycache__/monitor_integ_daemon_status.cpython-312.pyc +0 -0
  60. pyegeria/commands/ops/__pycache__/monitor_platform_status.cpython-312.pyc +0 -0
  61. pyegeria/commands/ops/__pycache__/monitor_server_startup.cpython-312.pyc +0 -0
  62. pyegeria/commands/ops/__pycache__/monitor_server_status.cpython-312.pyc +0 -0
  63. pyegeria/commands/ops/__pycache__/refresh_integration_daemon.cpython-312.pyc +0 -0
  64. pyegeria/commands/ops/__pycache__/restart_integration_daemon.cpython-312.pyc +0 -0
  65. pyegeria/commands/ops/__pycache__/table_integ_daemon_status.cpython-312.pyc +0 -0
  66. pyegeria/commands/ops/monitor_engine_activity.py +3 -2
  67. pyegeria/commands/ops/monitor_engine_activity_c.py +3 -3
  68. pyegeria/commands/ops/monitor_platform_status.py +1 -1
  69. pyegeria/commands/ops/monitor_server_status.py +6 -3
  70. pyegeria/commands/tech/__pycache__/__init__.cpython-312.pyc +0 -0
  71. pyegeria/commands/tech/__pycache__/get_element_info.cpython-312.pyc +0 -0
  72. pyegeria/commands/tech/__pycache__/get_guid_info.cpython-312.pyc +0 -0
  73. pyegeria/commands/tech/__pycache__/get_tech_details.cpython-312.pyc +0 -0
  74. pyegeria/commands/tech/__pycache__/get_tech_type_template.cpython-312.pyc +0 -0
  75. pyegeria/commands/tech/__pycache__/list_anchored_elements.cpython-312.pyc +0 -0
  76. pyegeria/commands/tech/__pycache__/list_asset_types.cpython-312.pyc +0 -0
  77. pyegeria/commands/tech/__pycache__/list_elements_by_property_value.cpython-312.pyc +0 -0
  78. pyegeria/commands/tech/__pycache__/list_elements_for_classification.cpython-312.pyc +0 -0
  79. pyegeria/commands/tech/__pycache__/list_gov_action_processes.cpython-312.pyc +0 -0
  80. pyegeria/commands/tech/__pycache__/list_registered_services.cpython-312.pyc +0 -0
  81. pyegeria/commands/tech/__pycache__/list_related_specification.cpython-312.pyc +0 -0
  82. pyegeria/commands/tech/__pycache__/list_relationship_types.cpython-312.pyc +0 -0
  83. pyegeria/commands/tech/__pycache__/list_relationships.cpython-312.pyc +0 -0
  84. pyegeria/commands/tech/__pycache__/list_tech_templates.cpython-312.pyc +0 -0
  85. pyegeria/commands/tech/__pycache__/list_valid_metadata_values.cpython-312.pyc +0 -0
  86. pyegeria/commands/tech/list_information_blueprints.py +166 -0
  87. pyegeria/commands/tech/list_information_supply_chains.py +145 -0
  88. pyegeria/egeria_client.py +5 -0
  89. pyegeria/egeria_tech_client.py +6 -2
  90. pyegeria/mermaid_utilities.py +51 -21
  91. pyegeria/metadata_explorer_omvs.py +0 -43
  92. pyegeria/solution_architect_omvs.py +642 -0
  93. {pyegeria-5.3.3.9.dist-info → pyegeria-5.3.3.10.dist-info}/METADATA +1 -1
  94. {pyegeria-5.3.3.9.dist-info → pyegeria-5.3.3.10.dist-info}/RECORD +97 -19
  95. {pyegeria-5.3.3.9.dist-info → pyegeria-5.3.3.10.dist-info}/entry_points.txt +1 -0
  96. {pyegeria-5.3.3.9.dist-info → pyegeria-5.3.3.10.dist-info}/LICENSE +0 -0
  97. {pyegeria-5.3.3.9.dist-info → pyegeria-5.3.3.10.dist-info}/WHEEL +0 -0
@@ -0,0 +1,145 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ SPDX-License-Identifier: Apache-2.0
4
+ Copyright Contributors to the ODPi Egeria project.
5
+
6
+ A simple viewer for Information Supply Chains
7
+
8
+ """
9
+
10
+ import argparse
11
+ import os
12
+ import time
13
+
14
+ from rich import print, box
15
+ from rich.console import Console
16
+ from rich.markdown import Markdown
17
+ from rich.panel import Panel
18
+ from rich.prompt import Prompt
19
+ from rich.table import Table
20
+ from rich.text import Text
21
+ from rich.tree import Tree
22
+ from pyegeria.solution_architect_omvs import SolutionArchitect
23
+ from pyegeria import (
24
+ ProjectManager,
25
+ UserNotAuthorizedException,
26
+ PropertyServerException,
27
+ InvalidParameterException,
28
+ )
29
+
30
+ from pyegeria._exceptions import (
31
+ print_exception_response,
32
+ )
33
+
34
+ disable_ssl_warnings = True
35
+ EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
36
+ EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
37
+ EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
38
+ EGERIA_VIEW_SERVER = os.environ.get("EGERIA_VIEW_SERVER", "qs-view-server")
39
+ EGERIA_VIEW_SERVER_URL = os.environ.get(
40
+ "EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
41
+ )
42
+ EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
43
+ EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
44
+ EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
45
+ EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
46
+ EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
47
+ EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
48
+ EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "150"))
49
+
50
+
51
+ def supply_chain_viewer(
52
+ search_string: str,
53
+ server_name: str,
54
+ platform_url: str,
55
+ user: str,
56
+ user_password: str,
57
+ jupyter: bool = EGERIA_JUPYTER,
58
+ width: int = EGERIA_WIDTH,
59
+ timeout: int = 30,
60
+ ):
61
+ """A Supply Chain viewer"""
62
+ client = SolutionArchitect(server_name, platform_url, user, user_password)
63
+ token = client.create_egeria_bearer_token()
64
+
65
+ def generate_table() -> Table | str:
66
+ table = Table(
67
+ title=f"Supply Chains matching {search_string} @ {time.asctime()}",
68
+ style="bright_white on black",
69
+ header_style="bright_white on dark_blue",
70
+ title_style="bold white on black",
71
+ caption_style="white on black",
72
+ show_lines=True,
73
+ box=box.ROUNDED,
74
+ caption=f"View Server '{server_name}' @ Platform - {platform_url}",
75
+ expand=True,
76
+ )
77
+ table.add_column("Supply Chain Name")
78
+ table.add_column("Qualified Name \n/\n GUID", width=38, no_wrap=False)
79
+ table.add_column("Purpose")
80
+ table.add_column("Scope\n/\n Mermaid Link")
81
+ table.add_column("Description")
82
+
83
+ supply_chains = client.find_information_supply_chains(search_string)
84
+ if isinstance(supply_chains, list) is False:
85
+ return "No Supply Chains found"
86
+
87
+ for sc in supply_chains:
88
+ sc_name = sc["properties"].get("displayName", '---')
89
+ sc_qname = sc["properties"].get("qualifiedName", '---')
90
+ sc_guid = sc["elementHeader"]["guid"]
91
+ sc_purpose = sc["properties"].get("purposes",'---')
92
+ if isinstance(sc_purpose, list):
93
+ sc_purpose_str = "\n* ".join(sc_purpose)
94
+ else:
95
+ sc_purpose_str = sc_purpose
96
+ sc_scope = sc["properties"].get("scope",'---')
97
+ sc_desc = sc["properties"].get("description",'---')
98
+ sc_unique_name = f"{sc_qname}\n\n\t\t/\n\n{sc_guid}"
99
+ sc_mermaid = sc.get("mermaid",'---')
100
+
101
+ table.add_row(sc_name, sc_unique_name, sc_purpose_str, sc_scope, sc_desc)
102
+
103
+ return table
104
+
105
+
106
+
107
+
108
+ try:
109
+ console = Console(width=width, force_terminal=not jupyter)
110
+ with console.pager():
111
+ console.print(generate_table())
112
+
113
+ except (
114
+ InvalidParameterException,
115
+ PropertyServerException,
116
+ UserNotAuthorizedException,
117
+ ) as e:
118
+ print_exception_response(e)
119
+
120
+
121
+ def main():
122
+ parser = argparse.ArgumentParser()
123
+
124
+ parser.add_argument("--server", help="Name of the server to display status for")
125
+ parser.add_argument("--url", help="URL Platform to connect to")
126
+ parser.add_argument("--userid", help="User Id")
127
+ parser.add_argument("--password", help="User Password")
128
+ args = parser.parse_args()
129
+
130
+ server = args.server if args.server is not None else EGERIA_VIEW_SERVER
131
+ url = args.url if args.url is not None else EGERIA_PLATFORM_URL
132
+ userid = args.userid if args.userid is not None else EGERIA_USER
133
+ user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
134
+
135
+ try:
136
+ search_string = Prompt.ask(
137
+ "Enter a search string:", default="*"
138
+ )
139
+ supply_chain_viewer(search_string, server, url, userid, user_pass)
140
+ except KeyboardInterrupt:
141
+ pass
142
+
143
+
144
+ if __name__ == "__main__":
145
+ main()
pyegeria/egeria_client.py CHANGED
@@ -29,6 +29,7 @@ from pyegeria import (
29
29
  FullServerConfig,
30
30
  EgeriaConfig,
31
31
  MetadataExplorer,
32
+ SolutionArchitect
32
33
  )
33
34
 
34
35
 
@@ -50,6 +51,7 @@ class Egeria(
50
51
  # TemplateManager,
51
52
  ValidMetadataManager,
52
53
  MetadataExplorer,
54
+ SolutionArchitect,
53
55
  ):
54
56
  """
55
57
  Client to issue Runtime status requests.
@@ -115,3 +117,6 @@ class Egeria(
115
117
  ValidMetadataManager.__init__(
116
118
  self, view_server, platform_url, user_id, user_pwd, token
117
119
  )
120
+ SolutionArchitect.__init__(
121
+ self, view_server, platform_url, user_id, user_pwd, token
122
+ )
@@ -24,7 +24,8 @@ from pyegeria import (
24
24
  TEMPLATE_GUIDS,
25
25
  INTEGRATION_GUIDS,
26
26
  MetadataExplorer,
27
- )
27
+ SolutionArchitect,
28
+ )
28
29
 
29
30
 
30
31
  class EgeriaTech(
@@ -36,6 +37,7 @@ class EgeriaTech(
36
37
  RuntimeManager,
37
38
  ValidMetadataManager,
38
39
  MetadataExplorer,
40
+ SolutionArchitect,
39
41
  ):
40
42
  """
41
43
  Client for technical Egeria users.
@@ -87,7 +89,9 @@ class EgeriaTech(
87
89
  MetadataExplorer.__init__(
88
90
  self, view_server, platform_url, user_id, user_pwd, token
89
91
  )
90
-
92
+ SolutionArchitect.__init__(
93
+ self, view_server, platform_url, user_id, user_pwd, token
94
+ )
91
95
 
92
96
  if __name__ == "__main__":
93
97
  print("Main-Tech Client")
@@ -40,26 +40,26 @@ EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
40
40
  EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
41
41
  EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
42
42
  EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
43
-
43
+ EGERIA_MERMAID_FOLDER = os.environ.get("EGERIA_MERMAID_FOLDER", "./work/mermaid_graphs")
44
44
 
45
45
  # Check Mermaid.js version
46
- def check_mermaid_version():
47
- """Check the version of Mermaid.js loaded in Jupyter Notebook"""
48
- display(HTML("""
49
- <script>
50
- function checkMermaid() {
51
- if (window.mermaid && typeof window.mermaid.version !== "undefined") {
52
- console.log("Mermaid.js version:", mermaid.version);
53
- alert("Mermaid.js version: " + mermaid.version);
54
- } else {
55
- console.warn("Mermaid.js is not loaded yet. Please ensure it's properly injected.");
56
- alert("Mermaid.js is not loaded yet. Please ensure it's properly injected.");
57
- }
58
- }
59
- // Delay execution to ensure Mermaid.js has had time to load
60
- setTimeout(checkMermaid, 1000);
61
- </script>
62
- """))
46
+ # def check_mermaid_version():
47
+ # """Check the version of Mermaid.js loaded in Jupyter Notebook"""
48
+ # display(HTML("""
49
+ # <script>
50
+ # function checkMermaid() {
51
+ # if (window.mermaid && typeof window.mermaid.version !== "undefined") {
52
+ # console.log("Mermaid.js version:", mermaid.version);
53
+ # alert("Mermaid.js version: " + mermaid.version);
54
+ # } else {
55
+ # console.warn("Mermaid.js is not loaded yet. Please ensure it's properly injected.");
56
+ # alert("Mermaid.js is not loaded yet. Please ensure it's properly injected.");
57
+ # }
58
+ # }
59
+ # // Delay execution to ensure Mermaid.js has had time to load
60
+ # setTimeout(checkMermaid, 1000);
61
+ # </script>
62
+ # """))
63
63
 
64
64
  # another site to get mermaid from is "https://cdnjs.cloudflare.com/ajax/libs/mermaid/11.4.1/mermaid.min.js";
65
65
  # below was:
@@ -77,9 +77,9 @@ def load_mermaid():
77
77
  mermaid_js = """
78
78
  <script src="https://unpkg.com/mermaid@11.4.1/dist/mermaid.min.js"></script>
79
79
  <script>
80
- document.addEventListener('DOMContentLoaded', function() {{
81
- mermaid.initialize({{"startOnLoad": true}});
82
- }});
80
+ document.addEventListener('DOMContentLoaded', function() {
81
+ mermaid.initialize({startOnLoad: true});
82
+ });
83
83
  </script>
84
84
 
85
85
  """
@@ -110,6 +110,36 @@ def render_mermaid(mermaid_code):
110
110
  """
111
111
  display(HTML(mermaid_html))
112
112
 
113
+ def save_mermaid_graph(title, mermaid_code, folder:str = EGERIA_MERMAID_FOLDER):
114
+ """Save a Mermaid diagram to a file"""
115
+ if not os.path.exists(folder):
116
+ os.makedirs(folder)
117
+ mermaid_file = os.path.join(folder, title + ".mmd")
118
+ mermaid_code = f"""
119
+ <!DOCTYPE html>
120
+ <html>
121
+ <head>
122
+ <script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
123
+ </head>
124
+ <body>
125
+ <div class="mermaid">
126
+ {mermaid_code}
127
+ </div>
128
+ """ \
129
+ + \
130
+ """
131
+ <script>
132
+ mermaid.initialize({startOnLoad:true});
133
+ </script>
134
+ </body>
135
+ </html>
136
+ """
137
+
138
+ with open(mermaid_file, "w") as f:
139
+ f.write(mermaid_code)
140
+ return mermaid_file
141
+
142
+
113
143
 
114
144
  def generate_process_graph(
115
145
  process_guid: str,
@@ -489,49 +489,6 @@ class MetadataExplorer(Client):
489
489
  )
490
490
  return response
491
491
 
492
- # def get_metadata_element_mermaid_graph(
493
- # self,
494
- # guid: str,
495
- # effective_time: str = None,
496
- # as_of_time: str = None,
497
- # for_lineage: bool = None,
498
- # for_duplicate_processing: bool = None,
499
- # ) -> dict | str:
500
- # """
501
- # Retrieve the metadata element using its unique identifier.
502
- #
503
- # Parameters
504
- # ----------
505
- # guid : str
506
- # - unique identifier of the element to retrieve
507
- # effective_time: str, default = None
508
- # - Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
509
- # as_of_time: str, default = None
510
- # - Query the element as of this time. If None, then use current time.
511
- # for_lineage: bool, default is set by server
512
- # - determines if elements classified as Memento should be returned - normally false
513
- # for_duplicate_processing: bool, default is set by server
514
- # - Normally false. Set true when the caller is part of a deduplication function
515
- #
516
- # Returns
517
- # -------
518
- # dict | str
519
- # If the element is found, a dict of the element details is returned. Otherwise the string "No element found".
520
- #
521
- # Raises
522
- # ------
523
- # InvalidParameterException
524
- # one of the parameters is null or invalid or
525
- # PropertyServerException
526
- # There is a problem adding the element properties to the metadata repository or
527
- # UserNotAuthorizedException
528
- # the requesting user is not authorized to issue this request.
529
- # """
530
- #
531
- # response = self.get_metadata_element_graph(
532
- # guid, effective_time, as_of_time, for_lineage, for_duplicate_processing
533
- # )
534
- # return response.get("mermaidGraph", NO_ELEMENTS_FOUND)
535
492
 
536
493
  async def _async_get_metadata_element_by_unique_name(
537
494
  self,