pyegeria 5.3.7.2__py3-none-any.whl → 5.3.7.8__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.
- pyegeria/__init__.py +2 -1
- pyegeria/_client.py +4 -1
- pyegeria/commands/cat/dr_egeria_md.py +23 -16
- pyegeria/commands/cat/get_project_dependencies.py +1 -1
- pyegeria/commands/cat/get_project_structure.py +1 -1
- pyegeria/commands/cat/glossary_actions.py +11 -18
- pyegeria/dr.egeria spec.md +9 -0
- pyegeria/glossary_browser_omvs.py +1 -1
- pyegeria/glossary_manager_omvs.py +1 -1
- pyegeria/md_processing_helpers.py +58 -0
- pyegeria/md_processing_utils.py +533 -64
- pyegeria/md_processing_utils_orig.py +1103 -0
- pyegeria/project_manager_omvs.py +79 -3
- pyegeria/shared_state.py +35 -0
- {pyegeria-5.3.7.2.dist-info → pyegeria-5.3.7.8.dist-info}/METADATA +2 -2
- {pyegeria-5.3.7.2.dist-info → pyegeria-5.3.7.8.dist-info}/RECORD +19 -15
- {pyegeria-5.3.7.2.dist-info → pyegeria-5.3.7.8.dist-info}/LICENSE +0 -0
- {pyegeria-5.3.7.2.dist-info → pyegeria-5.3.7.8.dist-info}/WHEEL +0 -0
- {pyegeria-5.3.7.2.dist-info → pyegeria-5.3.7.8.dist-info}/entry_points.txt +0 -0
pyegeria/__init__.py
CHANGED
@@ -93,7 +93,8 @@ from .x_action_author_omvs import ActionAuthor
|
|
93
93
|
from .md_processing_utils import (extract_command, process_glossary_upsert_command, process_term_upsert_command,
|
94
94
|
process_categories_upsert_command,
|
95
95
|
get_current_datetime_string, process_per_proj_upsert_command, command_list,
|
96
|
-
render_markdown, process_provenance_command
|
96
|
+
render_markdown, process_provenance_command, process_blueprint_upsert_command,
|
97
|
+
process_solution_component_upsert_command)
|
97
98
|
|
98
99
|
#
|
99
100
|
# The following assignments were generated by the `create_tech_guid_lists.py` utility that uses the pyegeria functions
|
pyegeria/_client.py
CHANGED
@@ -770,7 +770,8 @@ class Client:
|
|
770
770
|
)
|
771
771
|
return result
|
772
772
|
|
773
|
-
def __create_qualified_name__(self, type: str, display_name: str, local_qualifier: str = None
|
773
|
+
def __create_qualified_name__(self, type: str, display_name: str, local_qualifier: str = None,
|
774
|
+
version_identifier: str = None) -> str:
|
774
775
|
"""Helper function to create a qualified name for a given type and display name.
|
775
776
|
If present, the local qualifier will be prepended to the qualified name."""
|
776
777
|
EGERIA_LOCAL_QUALIFIER = os.environ.get("EGERIA_LOCAL_QUALIFIER", local_qualifier)
|
@@ -778,6 +779,8 @@ class Client:
|
|
778
779
|
q_name = f"{type}:{display_name}"
|
779
780
|
if EGERIA_LOCAL_QUALIFIER:
|
780
781
|
q_name = f"{EGERIA_LOCAL_QUALIFIER}:{q_name}"
|
782
|
+
if version_identifier:
|
783
|
+
q_name = f"{q_name}:{version_identifier}"
|
781
784
|
return q_name
|
782
785
|
|
783
786
|
if __name__ == "__main__":
|
@@ -13,6 +13,8 @@ import click
|
|
13
13
|
from pyegeria import (extract_command, process_glossary_upsert_command, process_term_upsert_command,
|
14
14
|
process_categories_upsert_command, process_provenance_command,
|
15
15
|
get_current_datetime_string, process_per_proj_upsert_command, command_list,EgeriaTech,
|
16
|
+
process_blueprint_upsert_command, process_solution_component_upsert_command,
|
17
|
+
shared_state
|
16
18
|
)
|
17
19
|
from datetime import datetime
|
18
20
|
|
@@ -39,10 +41,6 @@ EGERIA_ROOT_PATH = os.environ.get("EGERIA_ROOT_PATH", "/Users/dwolfson/localGit/
|
|
39
41
|
EGERIA_INBOX_PATH = os.environ.get("EGERIA_INBOX_PATH", "pyegeria/commands/cat/dr_egeria_inbox")
|
40
42
|
EGERIA_OUTBOX_PATH = os.environ.get("EGERIA_OUTBOX_PATH", "pyegeria/commands/cat/dr_egeria_outbox")
|
41
43
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
44
|
@click.command("process_markdown_file", help="Process a markdown file and return the output as a string.")
|
47
45
|
@click.option("--file-path", help="File path to markdown file",
|
48
46
|
default="glossary_exp.md", required=True, prompt=False)
|
@@ -52,6 +50,7 @@ EGERIA_OUTBOX_PATH = os.environ.get("EGERIA_OUTBOX_PATH", "pyegeria/commands/cat
|
|
52
50
|
@click.option(
|
53
51
|
"--url", default=EGERIA_VIEW_SERVER_URL, help="URL of Egeria platform to connect to"
|
54
52
|
)
|
53
|
+
|
55
54
|
@click.option("--userid", default=EGERIA_USER, help="Egeria user")
|
56
55
|
@click.option("--user_pass", default=EGERIA_USER_PASSWORD, help="Egeria user password")
|
57
56
|
def process_markdown_file(
|
@@ -65,7 +64,7 @@ def process_markdown_file(
|
|
65
64
|
"""
|
66
65
|
Process a markdown file by parsing and executing Dr. Egeria commands. Write output to a new file.
|
67
66
|
"""
|
68
|
-
|
67
|
+
cmd_list = command_list
|
69
68
|
console = Console(width=int(EGERIA_WIDTH))
|
70
69
|
client = EgeriaTech(server, url, user_id=userid)
|
71
70
|
token = client.create_egeria_bearer_token(userid, user_pass)
|
@@ -87,41 +86,47 @@ def process_markdown_file(
|
|
87
86
|
h1_blocks = []
|
88
87
|
current_block = ""
|
89
88
|
in_h1_block = False
|
90
|
-
|
89
|
+
|
91
90
|
|
92
91
|
# Helper function to process the current block
|
93
92
|
def process_current_block(current_block):
|
94
|
-
nonlocal updated, final_output, prov_found, prov_output, h1_blocks, in_h1_block
|
93
|
+
nonlocal updated, final_output, prov_found, prov_output, h1_blocks, in_h1_block
|
95
94
|
|
96
95
|
if not current_block:
|
97
96
|
return # No block to process
|
98
97
|
|
99
98
|
potential_command = extract_command(current_block) # Extract command
|
100
|
-
if potential_command in
|
99
|
+
if potential_command in cmd_list:
|
101
100
|
# Process the block based on the command
|
102
101
|
if potential_command == "Provenance":
|
103
102
|
result = process_provenance_command(file_path, current_block)
|
104
103
|
prov_found = True
|
105
104
|
|
106
105
|
elif potential_command in ["Create Glossary", "Update Glossary"]:
|
107
|
-
result = process_glossary_upsert_command(client,
|
106
|
+
result = process_glossary_upsert_command(client, shared_state.get_element_dictionary(), current_block, directive)
|
108
107
|
elif potential_command in ["Create Category", "Update Category"]:
|
109
|
-
result = process_categories_upsert_command(client,
|
108
|
+
result = process_categories_upsert_command(client, shared_state.get_element_dictionary(), current_block, directive)
|
110
109
|
elif potential_command in ["Create Term", "Update Term"]:
|
111
|
-
result = process_term_upsert_command(client,
|
110
|
+
result = process_term_upsert_command(client, shared_state.get_element_dictionary(), current_block, directive)
|
112
111
|
elif potential_command in ["Create Personal Project", "Update Personal Project"]:
|
113
|
-
result = process_per_proj_upsert_command(client,
|
112
|
+
result = process_per_proj_upsert_command(client, shared_state.get_element_dictionary(), current_block, directive)
|
113
|
+
elif potential_command in ["Create Blueprint", "Update Blueprint", "Create Solution Blueprint", "Update Solution Blueprint"]:
|
114
|
+
result = process_blueprint_upsert_command(client, shared_state.get_element_dictionary(), current_block, directive)
|
115
|
+
elif potential_command in ["Create Solution Component", "Update Solution Component"]:
|
116
|
+
result = process_solution_component_upsert_command(client, shared_state.get_element_dictionary(), current_block, directive)
|
117
|
+
|
118
|
+
|
114
119
|
else:
|
115
120
|
# If command is not recognized, keep the block as-is
|
116
121
|
result = None
|
117
|
-
|
122
|
+
print(json.dumps(shared_state.get_element_dictionary(), indent=4))
|
118
123
|
if result:
|
119
124
|
if directive == "process":
|
120
125
|
updated = True
|
121
126
|
final_output.append(result)
|
122
|
-
|
127
|
+
print(json.dumps(shared_state.get_element_dictionary(), indent=4))
|
123
128
|
elif directive == "validate":
|
124
|
-
print(json.dumps(
|
129
|
+
print(json.dumps(shared_state.get_element_dictionary(), indent=4))
|
125
130
|
elif directive == "process":
|
126
131
|
# Handle errors (skip this block but notify the user)
|
127
132
|
print(f"\n==>\tErrors found while processing command: \'{potential_command}\'\n"
|
@@ -181,7 +186,7 @@ def process_markdown_file(
|
|
181
186
|
f2.write(final_output)
|
182
187
|
if not prov_found:
|
183
188
|
f2.write(prov_output)
|
184
|
-
click.echo(f"\n==>
|
189
|
+
click.echo(f"\n==> Output written to {new_file_path}")
|
185
190
|
else:
|
186
191
|
click.echo("\nNo updates detected. New File not created.")
|
187
192
|
|
@@ -215,3 +220,5 @@ def process_markdown_file(
|
|
215
220
|
#
|
216
221
|
# if __name__ == "__main__":
|
217
222
|
# main()
|
223
|
+
if __name__ == "__main__":
|
224
|
+
process_markdown_file()
|
@@ -109,7 +109,7 @@ def project_dependency_viewer(
|
|
109
109
|
child_md = ""
|
110
110
|
child_guid = proj["elementHeader"]["guid"]
|
111
111
|
child_name = proj["properties"]["name"]
|
112
|
-
relationship = proj["
|
112
|
+
relationship = proj["startingElement"]["relationshipHeader"]["type"][
|
113
113
|
"typeName"
|
114
114
|
]
|
115
115
|
if relationship != "ProjectDependency":
|
@@ -109,7 +109,7 @@ def project_structure_viewer(
|
|
109
109
|
child_md = ""
|
110
110
|
child_guid = proj["elementHeader"]["guid"]
|
111
111
|
child_name = proj["properties"]["name"]
|
112
|
-
relationship = proj["
|
112
|
+
relationship = proj["startingElement"]["relationshipHeader"]["type"][
|
113
113
|
"typeName"
|
114
114
|
]
|
115
115
|
if relationship != "ProjectHierarchy":
|
@@ -141,6 +141,7 @@ def delete_glossary(server, url, userid, password, timeout, glossary_guid):
|
|
141
141
|
@click.command("create-term")
|
142
142
|
@click.option("--glossary-name", help="Name of Glossary", required=True)
|
143
143
|
@click.option("--term-name", help="Name of Term", required=True)
|
144
|
+
@click.option("--qualified-name", help="Qualified name of Term", default=None)
|
144
145
|
@click.option(
|
145
146
|
"--summary",
|
146
147
|
help="Summary definition",
|
@@ -170,31 +171,23 @@ def delete_glossary(server, url, userid, password, timeout, glossary_guid):
|
|
170
171
|
@click.option("--userid", default=EGERIA_USER, help="Egeria user")
|
171
172
|
@click.option("--password", default=EGERIA_USER_PASSWORD, help="Egeria user password")
|
172
173
|
@click.option("--timeout", default=60, help="Number of seconds to wait")
|
173
|
-
def create_term(
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
summary,
|
181
|
-
description,
|
182
|
-
abbrev,
|
183
|
-
examples,
|
184
|
-
usage,
|
185
|
-
version,
|
186
|
-
status,
|
187
|
-
timeout: int = 120,
|
188
|
-
) -> str:
|
189
|
-
"""Create a new term"""
|
174
|
+
def create_term(server, url, userid, password, glossary_name, term_name, summary, description, abbrev, examples, usage,
|
175
|
+
version, status, timeout: int = 120, qualified_name=None) -> str:
|
176
|
+
"""Create a new term
|
177
|
+
|
178
|
+
Args:
|
179
|
+
qualified_name:
|
180
|
+
"""
|
190
181
|
m_client = EgeriaTech(server, url, user_id=userid, user_pwd=password)
|
191
182
|
token = m_client.create_egeria_bearer_token()
|
183
|
+
if qualified_name is None:
|
184
|
+
qualified_name = m_client.__create_qualified_name__('Term', term_name)
|
192
185
|
try:
|
193
186
|
body = {
|
194
187
|
"class": "ReferenceableRequestBody",
|
195
188
|
"elementProperties": {
|
196
189
|
"class": "GlossaryTermProperties",
|
197
|
-
"qualifiedName":
|
190
|
+
"qualifiedName": qualified_name,
|
198
191
|
"displayName": term_name,
|
199
192
|
"summary": summary,
|
200
193
|
"description": description,
|
@@ -0,0 +1,9 @@
|
|
1
|
+
|
2
|
+
| Attribute Name | Input Required? | Generated/Default? | Unique? | Notes | Type
|
3
|
+
|:----------------| :- | :- | :- | :-|:-------------------------|
|
4
|
+
| Term Name | Yes | No | No | A display name (informal name). | string |
|
5
|
+
| Owning Glossary | Yes | No | Yes | This is the qualified name of the glossary that owns this term. | Qualified name reference |
|
6
|
+
| Categories | No | No | Yes | This is the qualified (unique) name of the category. Multiple categories can be assigned, separated by a `,` or line. | qualified name reference
|
7
|
+
| Description | No | No | No | A textual description of this term | string |
|
8
|
+
| Qualified Name | No | Yes | Yes | The qualified name can either be provided by the user or generated. If generated, a pattern is followed. | mfg or supplied q_name |
|
9
|
+
| GUID | No | Yes | Yes | GUIDs are always generated by Egeria. They are meant for automation, not people. | Generated
|
@@ -149,7 +149,7 @@ class GlossaryBrowser(Client):
|
|
149
149
|
description = element_properties.get("description", None)
|
150
150
|
examples = element_properties.get("examples", None)
|
151
151
|
usage = element_properties.get("usage", None)
|
152
|
-
pub_version = element_properties.get("
|
152
|
+
pub_version = element_properties.get("publishfinVersionIdentifier", None)
|
153
153
|
qualified_name = element_properties.get("qualifiedName", None)
|
154
154
|
status = element['elementHeader'].get('status', None)
|
155
155
|
|
@@ -936,7 +936,7 @@ class GlossaryManager(GlossaryBrowser):
|
|
936
936
|
continue
|
937
937
|
|
938
938
|
# Add the term
|
939
|
-
term_qualified_name = self.
|
939
|
+
term_qualified_name = self.__create_qualified_name__("Term", term_name)
|
940
940
|
|
941
941
|
body = {
|
942
942
|
"class": "ReferenceableRequestBody",
|
@@ -0,0 +1,58 @@
|
|
1
|
+
#
|
2
|
+
# from typing import List, Optional
|
3
|
+
#
|
4
|
+
# import os
|
5
|
+
# import re
|
6
|
+
#
|
7
|
+
# from rich import box, print
|
8
|
+
# from rich.console import Console
|
9
|
+
# from rich.markdown import Markdown
|
10
|
+
#
|
11
|
+
# from pyegeria import body_slimmer
|
12
|
+
# from pyegeria._globals import NO_TERMS_FOUND, NO_GLOSSARIES_FOUND, NO_TERMS_FOUND, NO_ELEMENTS_FOUND, NO_PROJECTS_FOUND, NO_CATEGORIES_FOUND
|
13
|
+
# from pyegeria.egeria_tech_client import EgeriaTech
|
14
|
+
# from pyegeria.md_processing_utils import extract_attribute, get_element_by_name, process_element_identifiers
|
15
|
+
# from pyegeria.project_manager_omvs import ProjectManager
|
16
|
+
# from pyegeria.glossary_manager_omvs import GlossaryManager
|
17
|
+
# ERROR = "ERROR-> "
|
18
|
+
# INFO = "INFO- "
|
19
|
+
# WARNING = "WARNING-> "
|
20
|
+
# pre_command = "\n---\n==> Processing command:"
|
21
|
+
#
|
22
|
+
#
|
23
|
+
#
|
24
|
+
# def process_q_name_list(egeria_client: EgeriaTech, element_type:str, txt:str )-> tuple[str | None,list | None,str | None,bool,bool]:
|
25
|
+
# msg = ""
|
26
|
+
# known_guid = None
|
27
|
+
# valid = True
|
28
|
+
# exists = False
|
29
|
+
# elements = ""
|
30
|
+
# new_element_list = []
|
31
|
+
#
|
32
|
+
# elements_txt = extract_attribute(txt, [element_type])
|
33
|
+
#
|
34
|
+
# if elements_txt is None:
|
35
|
+
# msg += f"* {INFO}No {element_type}s found\n"
|
36
|
+
#
|
37
|
+
# else:
|
38
|
+
# element_list = re.split(r'[,\n]+', elements_txt)
|
39
|
+
#
|
40
|
+
# for element in element_list:
|
41
|
+
# element_el = element.strip()
|
42
|
+
#
|
43
|
+
# # Get the element using the generalized function
|
44
|
+
# known_q_name, known_guid, status_msg, el_valid, el_exists = get_element_by_name(
|
45
|
+
# egeria_client, element_type,txt)
|
46
|
+
# msg += status_msg
|
47
|
+
# if exists and valid:
|
48
|
+
# elements = f"{element_el}, {elements}" # list of the input names
|
49
|
+
# new_element_list.append(known_q_name) # list of qualified names
|
50
|
+
# valid = valid and el_valid
|
51
|
+
# exists = exists and el_exists
|
52
|
+
#
|
53
|
+
# if elements:
|
54
|
+
# elements += "\n"
|
55
|
+
# msg += f"* {INFO}Found {element_type}s: {elements}"
|
56
|
+
# else:
|
57
|
+
# msg += f"* {INFO}List contains one or more invalid elements.\n"
|
58
|
+
# return elements,new_element_list, msg, valid, exists
|