pyegeria 5.2.0.42.5__py3-none-any.whl → 5.2.0.42.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.
@@ -48,6 +48,7 @@ EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
48
48
  EGERIA_WIDTH = os.environ.get("EGERIA_WIDTH", 200)
49
49
  EGERIA_JUPYTER = os.environ.get("EGERIA_JUPYTER", False)
50
50
  EGERIA_HOME_GLOSSARY_GUID = os.environ.get("EGERIA_HOME_GLOSSARY_GUID", None)
51
+ EGERIA_GLOSSARY_PATH = os.environ.get("EGERIA_GLOSSARY_PATH", None)
51
52
 
52
53
 
53
54
  @click.command("create-glossary")
@@ -265,8 +266,11 @@ def delete_term(server, url, userid, password, timeout, term_guid):
265
266
 
266
267
 
267
268
  @click.command("import-terms")
268
- @click.option("--glossary-name", help="Name of Glossary", required=True)
269
- @click.option("--file-name", help="Path of CSV file", required=True)
269
+ @click.option("--glossary_name", help="Name of Glossary", required=True)
270
+ @click.option("--file_name", help="Path of CSV file", required=True)
271
+ @click.option(
272
+ "--file_path", help="Path of CSV file", default=EGERIA_GLOSSARY_PATH, required=False
273
+ )
270
274
  @click.option(
271
275
  "--verbose",
272
276
  is_flag=True,
@@ -288,6 +292,7 @@ def delete_term(server, url, userid, password, timeout, term_guid):
288
292
  @click.option("--timeout", default=60, help="Number of seconds to wait")
289
293
  def import_terms(
290
294
  glossary_name: str,
295
+ file_path: str,
291
296
  file_name: str,
292
297
  verbose: bool,
293
298
  upsert: bool,
@@ -302,7 +307,11 @@ def import_terms(
302
307
  token = m_client.create_egeria_bearer_token()
303
308
  try:
304
309
  result = m_client.load_terms_from_file(
305
- glossary_name, file_name, upsert=upsert, verbose=verbose
310
+ glossary_name,
311
+ file_name,
312
+ file_path=file_path,
313
+ upsert=upsert,
314
+ verbose=verbose,
306
315
  )
307
316
 
308
317
  click.echo(
@@ -319,12 +328,15 @@ def import_terms(
319
328
 
320
329
  @click.command("export-terms")
321
330
  @click.option(
322
- "--glossary-guid",
331
+ "--glossary_guid",
323
332
  default=EGERIA_HOME_GLOSSARY_GUID,
324
333
  help="GUID of Glossary to export",
325
334
  required=True,
326
335
  )
327
- @click.option("--file-name", help="Path of CSV file", required=True)
336
+ @click.option("--file_name", help="Path of CSV file", required=True)
337
+ @click.option(
338
+ "--file_path", help="Path of CSV file", default=EGERIA_GLOSSARY_PATH, required=False
339
+ )
328
340
  @click.option("--server", default=EGERIA_VIEW_SERVER, help="Egeria view server to use")
329
341
  @click.option(
330
342
  "--url", default=EGERIA_VIEW_SERVER_URL, help="URL of Egeria platform to connect to"
@@ -332,12 +344,14 @@ def import_terms(
332
344
  @click.option("--userid", default=EGERIA_USER, help="Egeria user")
333
345
  @click.option("--password", default=EGERIA_USER_PASSWORD, help="Egeria user password")
334
346
  @click.option("--timeout", default=60, help="Number of seconds to wait")
335
- def export_terms(glossary_guid: str, file_name, server, url, userid, password, timeout):
347
+ def export_terms(
348
+ glossary_guid: str, file_name, file_path, server, url, userid, password, timeout
349
+ ):
336
350
  """Export the glossary specified"""
337
351
  m_client = EgeriaTech(server, url, user_id=userid, user_pwd=password)
338
352
  token = m_client.create_egeria_bearer_token()
339
353
  try:
340
- result = m_client.export_glossary_to_csv(glossary_guid, file_name)
354
+ result = m_client.export_glossary_to_csv(glossary_guid, file_name, file_path)
341
355
 
342
356
  click.echo(
343
357
  f"Exported {result} terms from glossary: {glossary_guid} into {file_name}"
@@ -129,7 +129,8 @@ from pyegeria.commands.tech.list_asset_types import display_asset_types
129
129
  )
130
130
  @click.option(
131
131
  "--width",
132
- default=os.environ.get("EGERIA_WIDTH", "200"),
132
+ default=os.environ.get("EGERIA_WIDTH", 200),
133
+ type=int,
133
134
  help="Screen width, in characters, to use",
134
135
  )
135
136
  @click.option(
@@ -1535,6 +1535,7 @@ class GlossaryManager(GlossaryBrowser):
1535
1535
  self,
1536
1536
  glossary_name: str,
1537
1537
  filename: str,
1538
+ file_path: str = os.environ.get("EGERIA_GLOSSARY_PATH", None),
1538
1539
  upsert: bool = True,
1539
1540
  verbose: bool = True,
1540
1541
  ) -> List[dict] | None:
@@ -1544,6 +1545,9 @@ class GlossaryManager(GlossaryBrowser):
1544
1545
  ----------
1545
1546
  glossary_name : str
1546
1547
  Name of the glossary to import terms into.
1548
+ file_path: str, default is EGERIA_GLOSSARY_PATH if specified or None
1549
+ If EGERIA_GLOSSARY_PATH environment variable is set, then it will be used in forming the
1550
+ prepended to the filename parameter to form the full path to the file.
1547
1551
  filename: str
1548
1552
  Path to the file to import terms from. File is assumed to be in CSV format. The path
1549
1553
  is relative to where the python method is being called from.
@@ -1609,8 +1613,18 @@ class GlossaryManager(GlossaryBrowser):
1609
1613
  "Version Identifier",
1610
1614
  "Status",
1611
1615
  }
1616
+
1617
+ if file_path:
1618
+ full_file_path = os.path.join(file_path, filename)
1619
+ else:
1620
+ full_file_path = filename
1621
+
1622
+ if not os.path.isfile(full_file_path):
1623
+ raise FileNotFoundError(
1624
+ f"Did not find file with path {file_path} and name {filename}"
1625
+ )
1612
1626
  # process file
1613
- with open(filename, mode="r") as file:
1627
+ with open(full_file_path, mode="r") as file:
1614
1628
  # Create a CSV reader object
1615
1629
  csv_reader = csv.DictReader(file)
1616
1630
  headers = csv_reader.fieldnames
@@ -1618,7 +1632,6 @@ class GlossaryManager(GlossaryBrowser):
1618
1632
  # check that the column headers are known
1619
1633
  if all(header in term_properties for header in headers) is False:
1620
1634
  raise InvalidParameterException("Invalid headers in CSV File")
1621
- sys.exit(1)
1622
1635
 
1623
1636
  # process each row and validate values
1624
1637
  for row in csv_reader:
@@ -1759,7 +1772,10 @@ class GlossaryManager(GlossaryBrowser):
1759
1772
  return
1760
1773
 
1761
1774
  async def _async_export_glossary_to_csv(
1762
- self, glossary_guid: str, target_file: str
1775
+ self,
1776
+ glossary_guid: str,
1777
+ target_file: str,
1778
+ file_path: str = os.environ.get("EGERIA_GLOSSARY_PATH", None),
1763
1779
  ) -> int:
1764
1780
  """Export all the terms in a glossary to a CSV file. Async version
1765
1781
 
@@ -1769,6 +1785,9 @@ class GlossaryManager(GlossaryBrowser):
1769
1785
  Identity of the glossary to export.
1770
1786
  target_file: str
1771
1787
  Complete file name with path and extension to export to.
1788
+ file_path: str, default is EGERIA_GLOSSARY_PATH if specified or None
1789
+ If EGERIA_GLOSSARY_PATH environment variable is set, then it will be used in forming the
1790
+ prepended to the filename parameter to form the full path to the file.
1772
1791
 
1773
1792
  Returns:
1774
1793
  int: Number of rows exported.
@@ -1787,8 +1806,12 @@ class GlossaryManager(GlossaryBrowser):
1787
1806
  "Version Identifier",
1788
1807
  "Status",
1789
1808
  ]
1809
+ if file_path:
1810
+ full_file_path = os.path.join(file_path, target_file)
1811
+ else:
1812
+ full_file_path = target_file
1790
1813
 
1791
- with open(target_file, mode="w") as file:
1814
+ with open(full_file_path, mode="w") as file:
1792
1815
  csv_writer = csv.DictWriter(file, fieldnames=header)
1793
1816
  csv_writer.writeheader()
1794
1817
  count = 0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyegeria
3
- Version: 5.2.0.42.5
3
+ Version: 5.2.0.42.7
4
4
  Summary: A python client for Egeria
5
5
  Home-page: https://github.com/odpi/egeria-python
6
6
  License: Apache 2.0
@@ -19,7 +19,7 @@ pyegeria/commands/cat/get_collection.py,sha256=dzgRIlMkQo0su-ZBdWaZ2txkC_J-bvass
19
19
  pyegeria/commands/cat/get_project_dependencies.py,sha256=B0JaMSUi0hzVgos1sTY2uUPGy1DzKEJMIbbYfMUWvQA,5981
20
20
  pyegeria/commands/cat/get_project_structure.py,sha256=n2GbNd07w1DTo7jTR8b2ewXRyNcat_2BcCBRyDMldwk,5969
21
21
  pyegeria/commands/cat/get_tech_type_elements.py,sha256=fD45AEQZUpUkw30Rt7CjovRjtWDxsACBG9KD1Ok3Yx0,6178
22
- pyegeria/commands/cat/glossary_actions.py,sha256=r7vMpo_w6RRFvJmq2IgasXnQMEMrOtTk2UmgIywAYtQ,12347
22
+ pyegeria/commands/cat/glossary_actions.py,sha256=ijNciRjrhQbCrPBma3OrEQfvrzxm9z4Wj6fYRJQczhA,12745
23
23
  pyegeria/commands/cat/list_assets.py,sha256=VyMp33T7oGpnIer9g6YaxraYJXtpmbZwn--MIrjRVT4,6270
24
24
  pyegeria/commands/cat/list_cert_types.py,sha256=x3R7ydIgXQmQyObE2Ffvr3187acFlsN1fXD1vuznJrc,7123
25
25
  pyegeria/commands/cat/list_collections.py,sha256=I-0h_zFfbAUzmbnr8T0fGZEzsw9FQsrgozdn3s_hr4Y,5982
@@ -36,7 +36,7 @@ pyegeria/commands/cat/list_todos.py,sha256=iPxHRyW3X5tiREio4TUOwRPvNPjU0gxm3pVnU
36
36
  pyegeria/commands/cat/list_user_ids.py,sha256=7JinL7rknPbGusIb8ikXKEaV1vvbuvx_WWtbmlfS_DY,5093
37
37
  pyegeria/commands/cli/__init__.py,sha256=hpTVSMP2gnPRhcAZPdeUEsQ-eaDySlXlk239dNWYmng,292
38
38
  pyegeria/commands/cli/egeria.py,sha256=HdYIpNW4NOzcln-8d8EZUlTe-rTeJmWGfxhdHJqhS7k,45605
39
- pyegeria/commands/cli/egeria_cat.py,sha256=s0izjyu-jgdeVLhuZ6XUIsKTpjj75iTWsPFaeeDMxfo,16441
39
+ pyegeria/commands/cli/egeria_cat.py,sha256=pmOYxiu3wU-SS_ueRwW9AbssfgI-VwQKGSKtYjofzEw,16453
40
40
  pyegeria/commands/cli/egeria_login_tui.py,sha256=m7gUiiPdeu2vxjiyxy-6OhAekSa5kVQnOUur2qyvbUA,9480
41
41
  pyegeria/commands/cli/egeria_my.py,sha256=XLd5ARwrVHZM7SGUKadJznb5KUULCmx2WIid3TKKmhY,6116
42
42
  pyegeria/commands/cli/egeria_ops.py,sha256=gVdLv5CgIyccZAAGS-RjwaW3cFrQOJJYhgWuMWQcl60,12580
@@ -212,7 +212,7 @@ pyegeria/egeria_tech_client.py,sha256=KMxo7Er6DNjXWPG_CVpWbNTOSJYhUSG4Vu_2GaFgG0
212
212
  pyegeria/feedback_manager_omvs.py,sha256=B66e3ZCaC_dirb0mcb2Nz3PYh2ZKsoMAYNOb3euNiro,152931
213
213
  pyegeria/full_omag_server_config.py,sha256=k3fUfopAFAE3OKkFR7zZPiki_FYj6j2xQ4oD2SVaefQ,47350
214
214
  pyegeria/glossary_browser_omvs.py,sha256=NcitYaZJqwVODBO5zBtWpXPNUJJ3DKzEbRaOFSAyUlg,93554
215
- pyegeria/glossary_manager_omvs.py,sha256=0IrLk7Dg2XL0ZCqmZj5lYOhZxMgXhuprUInRbg-stHI,130921
215
+ pyegeria/glossary_manager_omvs.py,sha256=_oAY8AmEOGY8L-xIRv6WolLwsQ2Zu3hjZIJl0h6irho,132062
216
216
  pyegeria/mermaid_utilities.py,sha256=GXiS-subb5nJcDqlThZWX2T8WspU1neFfhf4TxRoMh4,8344
217
217
  pyegeria/metadata_explorer_omvs.py,sha256=WwkFvAnDzJTw8dPos7j3wCG6gpQ0BjcMmYXl-ckjn28,88723
218
218
  pyegeria/my_profile_omvs.py,sha256=DyECbUFEcgokrIbzdMMNljC3bqfqKGXAF2wZEpzvRYs,34666
@@ -225,8 +225,8 @@ pyegeria/template_manager_omvs.py,sha256=Sw5xsQAhy7a48xFCg59mg9_nqyhawoS9v4WyF-P
225
225
  pyegeria/utils.py,sha256=1h6bwveadd6GpbnGLTmqPBmBk68QvxdjGTI9RfbrgKY,5415
226
226
  pyegeria/valid_metadata_omvs.py,sha256=kmcyXBsu99L25r16w9xVXqU_KwADsGuft4yPDZzyUds,65032
227
227
  pyegeria/x_action_author_omvs.py,sha256=xu1IQ0YbhIKi17C5a7Aq9u1Az2czwahNPpX9czmyVxE,6454
228
- pyegeria-5.2.0.42.5.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
229
- pyegeria-5.2.0.42.5.dist-info/METADATA,sha256=1CSX90n_vXDhc9J3TJ7SNf35jpAK7INHfVXzuaAOdZ4,2882
230
- pyegeria-5.2.0.42.5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
231
- pyegeria-5.2.0.42.5.dist-info/entry_points.txt,sha256=JK212otpaYZogRHHwMrHy3fQUpAsg_DC3LkRUl59V2s,5373
232
- pyegeria-5.2.0.42.5.dist-info/RECORD,,
228
+ pyegeria-5.2.0.42.7.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
229
+ pyegeria-5.2.0.42.7.dist-info/METADATA,sha256=m4OVHsf4slKGFivxjlyzIGKcrVXzjLMMa__v28uUmmY,2882
230
+ pyegeria-5.2.0.42.7.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
231
+ pyegeria-5.2.0.42.7.dist-info/entry_points.txt,sha256=JK212otpaYZogRHHwMrHy3fQUpAsg_DC3LkRUl59V2s,5373
232
+ pyegeria-5.2.0.42.7.dist-info/RECORD,,