cmem-cmemc 24.1.0rc1__tar.gz → 24.1.1__tar.gz
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.
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/PKG-INFO +2 -2
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/__init__.py +2 -1
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/commands/__init__.py +1 -0
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/commands/admin.py +1 -0
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/commands/config.py +1 -0
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/commands/dataset.py +16 -1
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/commands/graph.py +6 -0
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/commands/project.py +2 -0
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/commands/python.py +19 -9
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/commands/query.py +2 -0
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/commands/resource.py +1 -0
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/commands/scheduler.py +1 -0
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/commands/store.py +1 -0
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/commands/user.py +1 -0
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/commands/validation.py +2 -1
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/commands/variable.py +1 -0
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/commands/vocabulary.py +10 -8
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/commands/workflow.py +5 -2
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/commands/workspace.py +1 -0
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/completion.py +7 -0
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/constants.py +1 -0
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/context.py +17 -9
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/manual_helper/graph.py +1 -0
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/manual_helper/multi_page.py +1 -0
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/object_list.py +1 -0
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/utils.py +7 -0
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/pyproject.toml +4 -3
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/LICENSE +0 -0
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/README-public.md +0 -0
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/_cmemc.zsh +0 -0
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/commands/acl.py +0 -0
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/commands/client.py +0 -0
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/commands/metrics.py +0 -0
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/exceptions.py +0 -0
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/manual_helper/__init__.py +0 -0
- {cmem_cmemc-24.1.0rc1 → cmem_cmemc-24.1.1}/cmem_cmemc/manual_helper/single_page.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cmem-cmemc
|
|
3
|
-
Version: 24.1.
|
|
3
|
+
Version: 24.1.1
|
|
4
4
|
Summary: Command line client for eccenca Corporate Memory
|
|
5
5
|
Home-page: https://eccenca.com/go/cmemc
|
|
6
6
|
License: Apache 2.0
|
|
@@ -26,7 +26,7 @@ Requires-Dist: certifi (>=2023.5.7)
|
|
|
26
26
|
Requires-Dist: click (>=8.1.7,<9.0.0)
|
|
27
27
|
Requires-Dist: click-didyoumean (>=0.3.0,<0.4.0)
|
|
28
28
|
Requires-Dist: click-help-colors (>=0.9.1,<0.10.0)
|
|
29
|
-
Requires-Dist: cmem-cmempy (==24.1.
|
|
29
|
+
Requires-Dist: cmem-cmempy (==24.1.1)
|
|
30
30
|
Requires-Dist: configparser (>=5.3.0,<6.0.0)
|
|
31
31
|
Requires-Dist: jinja2 (>=3.1.2,<4.0.0)
|
|
32
32
|
Requires-Dist: natsort (>=8.3.1,<9.0.0)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""The main command line interface."""
|
|
2
|
+
|
|
2
3
|
import contextlib
|
|
3
4
|
import os
|
|
4
5
|
import sys
|
|
@@ -100,7 +101,7 @@ def cli(
|
|
|
100
101
|
|
|
101
102
|
https://eccenca.com/go/cmemc
|
|
102
103
|
|
|
103
|
-
cmemc is ©
|
|
104
|
+
cmemc is © 2024 eccenca GmbH, licensed under the Apache License 2.0.
|
|
104
105
|
"""
|
|
105
106
|
ctx.obj = CONTEXT
|
|
106
107
|
# hidden feature: 'CMEMC_MANUAL=true cmemc -q config list' will output
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""dataset commands for cmem command line interface."""
|
|
2
|
+
|
|
2
3
|
import json
|
|
3
4
|
import re
|
|
4
5
|
from pathlib import Path
|
|
@@ -64,6 +65,7 @@ def _get_datasets_filtered(
|
|
|
64
65
|
Raises:
|
|
65
66
|
------
|
|
66
67
|
ValueError
|
|
68
|
+
|
|
67
69
|
"""
|
|
68
70
|
if filter_name not in DATASET_FILTER_TYPES:
|
|
69
71
|
raise ValueError(
|
|
@@ -95,6 +97,7 @@ def _validate_and_split_dataset_id(dataset_id: str) -> tuple[str, str]:
|
|
|
95
97
|
Raises:
|
|
96
98
|
------
|
|
97
99
|
ValueError: in case the dataset ID is not splittable
|
|
100
|
+
|
|
98
101
|
"""
|
|
99
102
|
try:
|
|
100
103
|
project_part = dataset_id.split(":")[0]
|
|
@@ -125,6 +128,7 @@ def _post_file_resource(
|
|
|
125
128
|
Raises:
|
|
126
129
|
------
|
|
127
130
|
ValueError: if resource exists and no replace
|
|
131
|
+
|
|
128
132
|
"""
|
|
129
133
|
app.echo_info(
|
|
130
134
|
f"Upload {local_file_name} as a file resource of dataset "
|
|
@@ -159,6 +163,7 @@ def _upload_file_resource(
|
|
|
159
163
|
Raises:
|
|
160
164
|
------
|
|
161
165
|
ValueError: if resource exists and no replace
|
|
166
|
+
|
|
162
167
|
"""
|
|
163
168
|
exist = resource_exist(project_name=project_id, resource_name=remote_file_name)
|
|
164
169
|
if exist and not replace:
|
|
@@ -199,6 +204,7 @@ def _get_metadata_out_of_parameter(parameter_dict: dict) -> dict:
|
|
|
199
204
|
Returns:
|
|
200
205
|
-------
|
|
201
206
|
The dictionary of only the known metadata fields.
|
|
207
|
+
|
|
202
208
|
"""
|
|
203
209
|
metadata_dict = {}
|
|
204
210
|
if "label" in parameter_dict:
|
|
@@ -218,6 +224,7 @@ def _get_read_only_out_of_parameter(parameter_dict: dict) -> bool:
|
|
|
218
224
|
Returns:
|
|
219
225
|
-------
|
|
220
226
|
The value of read only field.
|
|
227
|
+
|
|
221
228
|
"""
|
|
222
229
|
read_only = parameter_dict.get("readOnly", False)
|
|
223
230
|
if read_only in ("true", True, "True"):
|
|
@@ -245,6 +252,7 @@ def _extend_parameter_with_metadata(
|
|
|
245
252
|
Returns:
|
|
246
253
|
-------
|
|
247
254
|
An extended parameter dictionary (label + file)
|
|
255
|
+
|
|
248
256
|
"""
|
|
249
257
|
if "label" not in parameter_dict:
|
|
250
258
|
label = f"Unnamed {dataset_type} dataset"
|
|
@@ -274,17 +282,21 @@ def _check_or_set_dataset_type(
|
|
|
274
282
|
Returns:
|
|
275
283
|
-------
|
|
276
284
|
A dataset type based the given file names.
|
|
285
|
+
|
|
277
286
|
"""
|
|
278
287
|
source = Path(dataset_file).name if dataset_file else ""
|
|
279
|
-
target = parameter_dict
|
|
288
|
+
target = parameter_dict.get("file", "")
|
|
280
289
|
suggestions = (
|
|
281
290
|
(".ttl", "file"),
|
|
282
291
|
(".csv", "csv"),
|
|
283
292
|
(".xlsx", "excel"),
|
|
284
293
|
(".xml", "xml"),
|
|
285
294
|
(".json", "json"),
|
|
295
|
+
(".jsonl", "json"),
|
|
286
296
|
(".orc", "orc"),
|
|
287
297
|
(".zip", "multiCsv"),
|
|
298
|
+
(".yaml", "text"),
|
|
299
|
+
(".yml", "text"),
|
|
288
300
|
)
|
|
289
301
|
if not dataset_type:
|
|
290
302
|
for check, type_ in suggestions:
|
|
@@ -306,6 +318,7 @@ def _show_parameter_list(app: ApplicationContext, dataset_type: str) -> None:
|
|
|
306
318
|
----
|
|
307
319
|
app: the click cli app context.
|
|
308
320
|
dataset_type: The type from which the parameters are listed.
|
|
321
|
+
|
|
309
322
|
"""
|
|
310
323
|
plugin = get_task_plugin_description(dataset_type)
|
|
311
324
|
properties = plugin["properties"]
|
|
@@ -338,6 +351,7 @@ def _show_type_list(app: ApplicationContext) -> None:
|
|
|
338
351
|
Args:
|
|
339
352
|
----
|
|
340
353
|
app: the click cli app context.
|
|
354
|
+
|
|
341
355
|
"""
|
|
342
356
|
plugins = get_task_plugins()
|
|
343
357
|
table = []
|
|
@@ -370,6 +384,7 @@ def _check_or_select_dataset_type(app: ApplicationContext, dataset_type: str) ->
|
|
|
370
384
|
Returns:
|
|
371
385
|
-------
|
|
372
386
|
A tuple of dataset_type and corresponding plugin description (dict)
|
|
387
|
+
|
|
373
388
|
"""
|
|
374
389
|
try:
|
|
375
390
|
app.echo_debug(f"check type {dataset_type}")
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""graph commands for cmem command line interface."""
|
|
2
|
+
|
|
2
3
|
import hashlib
|
|
3
4
|
import json
|
|
4
5
|
import os
|
|
@@ -111,6 +112,7 @@ def _get_export_names(app: ApplicationContext, iris: list[str], template: str) -
|
|
|
111
112
|
------
|
|
112
113
|
ValueError in case the template string produces a naming clash,
|
|
113
114
|
means two IRIs result in the same filename
|
|
115
|
+
|
|
114
116
|
"""
|
|
115
117
|
template_data = app.get_template_data()
|
|
116
118
|
_names = {}
|
|
@@ -152,6 +154,7 @@ def _add_tree_nodes_recursive(tree: Tree, structure: dict, iri: str, graphs: dic
|
|
|
152
154
|
Returns:
|
|
153
155
|
-------
|
|
154
156
|
the new treelib.Tree object with the additional nodes
|
|
157
|
+
|
|
155
158
|
"""
|
|
156
159
|
if not tree.contains(iri):
|
|
157
160
|
tree.create_node(tag=_create_node_label(iri, graphs), identifier=iri)
|
|
@@ -176,6 +179,7 @@ def _add_ignored_nodes(tree: Tree, structure: dict) -> Tree:
|
|
|
176
179
|
Returns:
|
|
177
180
|
-------
|
|
178
181
|
the new treelib.Tree object with the additional nodes
|
|
182
|
+
|
|
179
183
|
"""
|
|
180
184
|
if len(structure.keys()) > 0:
|
|
181
185
|
for parent in structure:
|
|
@@ -227,6 +231,7 @@ def _add_imported_graphs(iris: list[str], all_graphs: dict) -> list[str]:
|
|
|
227
231
|
Returns:
|
|
228
232
|
-------
|
|
229
233
|
list of graph IRIs
|
|
234
|
+
|
|
230
235
|
"""
|
|
231
236
|
extended_list = iris
|
|
232
237
|
for iri in set(iris):
|
|
@@ -256,6 +261,7 @@ def _check_and_extend_exported_graphs(
|
|
|
256
261
|
Raises:
|
|
257
262
|
------
|
|
258
263
|
ValueError
|
|
264
|
+
|
|
259
265
|
"""
|
|
260
266
|
# transform given IRI-tuple to a distinct IRI-list
|
|
261
267
|
iris = list(set(iris))
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""DataIntegration project commands for the cmem command line interface."""
|
|
2
|
+
|
|
2
3
|
import os
|
|
3
4
|
import shutil
|
|
4
5
|
import tempfile
|
|
@@ -67,6 +68,7 @@ def _show_type_list(app: ApplicationContext) -> None:
|
|
|
67
68
|
Args:
|
|
68
69
|
----
|
|
69
70
|
app (ApplicationContext): the click cli app context.
|
|
71
|
+
|
|
70
72
|
"""
|
|
71
73
|
types = get_marshalling_plugins()
|
|
72
74
|
table = []
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""DataIntegration python management commands."""
|
|
2
|
+
|
|
2
3
|
import sys
|
|
3
4
|
from dataclasses import asdict
|
|
4
5
|
from re import match
|
|
@@ -49,6 +50,10 @@ def install_command(app: ApplicationContext, package: str) -> None:
|
|
|
49
50
|
.tar.gz file, by uploading a build distribution .whl file, or by
|
|
50
51
|
specifying a package name, i.e., a pip requirement specifier with a
|
|
51
52
|
package name available on pypi.org (e.g. `requests==2.27.1`).
|
|
53
|
+
|
|
54
|
+
Note: The tab-completion of this command lists only public packages from
|
|
55
|
+
pypi.org and not from additional or changed python package repositories you
|
|
56
|
+
may have configured on the server.
|
|
52
57
|
"""
|
|
53
58
|
app.echo_info(f"Install package {package} ... ", nl=False)
|
|
54
59
|
try:
|
|
@@ -60,18 +65,21 @@ def install_command(app: ApplicationContext, package: str) -> None:
|
|
|
60
65
|
"string, and a file with this name also does not exists."
|
|
61
66
|
) from error
|
|
62
67
|
response = install_package_by_name(package_name=package)
|
|
63
|
-
|
|
68
|
+
|
|
69
|
+
# DI >= 24.1 has a combine 'output' key, before 24.1 'standardOutput' and 'errorOutput' existed
|
|
70
|
+
output: list[str] = []
|
|
71
|
+
output.extend(response.get("output", "").splitlines())
|
|
72
|
+
output.extend(response.get("standardOutput", "").splitlines())
|
|
73
|
+
output.extend(response.get("errorOutput", "").splitlines())
|
|
74
|
+
for output_line in output:
|
|
64
75
|
app.echo_debug(output_line)
|
|
65
76
|
|
|
66
77
|
if response["success"]:
|
|
67
78
|
app.echo_success("done")
|
|
68
|
-
if len(response["errorOutput"].strip()) > 0:
|
|
69
|
-
app.echo_warning(response["errorOutput"])
|
|
70
79
|
else:
|
|
71
80
|
app.echo_error("error")
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
app.echo_error(response["errorOutput"])
|
|
81
|
+
for output_line in output:
|
|
82
|
+
app.echo_error(output_line)
|
|
75
83
|
app.echo_debug("Updated Plugins: " + str(update_plugins()))
|
|
76
84
|
|
|
77
85
|
|
|
@@ -113,12 +121,14 @@ def uninstall_command(app: ApplicationContext, package_name: str, all_: bool) ->
|
|
|
113
121
|
app.echo_debug("Updated Plugins: " + str(update_plugins()))
|
|
114
122
|
sys.exit(1)
|
|
115
123
|
response = uninstall_package(package_name=_)
|
|
116
|
-
|
|
124
|
+
output: list[str] = []
|
|
125
|
+
output.extend(response.get("output", "").splitlines())
|
|
126
|
+
output.extend(response.get("standardOutput", "").splitlines())
|
|
127
|
+
output.extend(response.get("errorOutput", "").splitlines())
|
|
128
|
+
for output_line in output:
|
|
117
129
|
app.echo_debug(output_line)
|
|
118
130
|
if response["success"]:
|
|
119
131
|
app.echo_success("done")
|
|
120
|
-
if len(response["errorOutput"].strip()) > 0:
|
|
121
|
-
app.echo_warning(response["errorOutput"])
|
|
122
132
|
else:
|
|
123
133
|
app.echo_error("error")
|
|
124
134
|
app.echo_debug(response.content.decode())
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""query commands for cmem command line interface."""
|
|
2
|
+
|
|
2
3
|
import json
|
|
3
4
|
import sys
|
|
4
5
|
from hashlib import sha1
|
|
@@ -305,6 +306,7 @@ def _output_query_status_details(app: ApplicationContext, status_dict: dict) ->
|
|
|
305
306
|
----
|
|
306
307
|
app: application context
|
|
307
308
|
status_dict: The dict from the query status list.
|
|
309
|
+
|
|
308
310
|
"""
|
|
309
311
|
table = []
|
|
310
312
|
for key in status_dict:
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""graph validation command group"""
|
|
2
|
+
|
|
2
3
|
import time
|
|
3
4
|
from datetime import UTC, datetime
|
|
4
5
|
|
|
@@ -295,7 +296,7 @@ def _get_resource_count(batch_validation: dict) -> str:
|
|
|
295
296
|
|
|
296
297
|
def _get_violation_count(process_data: dict) -> str:
|
|
297
298
|
"""Get violation count from validation report"""
|
|
298
|
-
if process_data.get("executionStarted"
|
|
299
|
+
if process_data.get("executionStarted") is None:
|
|
299
300
|
return "-"
|
|
300
301
|
resources = str(process_data.get("resourcesWithViolationsCount", "0"))
|
|
301
302
|
violations = str(process_data.get("violationsCount", "0"))
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""vocabularies commands for cmem command line interface."""
|
|
2
|
+
|
|
2
3
|
import io
|
|
3
4
|
from datetime import UTC, datetime
|
|
4
5
|
from re import match
|
|
@@ -129,6 +130,7 @@ def _insert_catalog_entry(iri: str, prefix: str, namespace: str, label: str, lan
|
|
|
129
130
|
Returns:
|
|
130
131
|
-------
|
|
131
132
|
None
|
|
133
|
+
|
|
132
134
|
"""
|
|
133
135
|
language = "@" + str(language).strip() if "@" + str(language).strip() != "@" else ""
|
|
134
136
|
|
|
@@ -149,7 +151,7 @@ def _insert_catalog_entry(iri: str, prefix: str, namespace: str, label: str, lan
|
|
|
149
151
|
|
|
150
152
|
|
|
151
153
|
def _get_vocabulary_metadata_from_file(
|
|
152
|
-
file: io.
|
|
154
|
+
file: io.BytesIO, namespace_given: bool = False
|
|
153
155
|
) -> dict[str, str]:
|
|
154
156
|
"""Get potential graph iri and prefix/namespace from a turtle file."""
|
|
155
157
|
metadata = {"iri": "", "prefix": "", "namespace": ""}
|
|
@@ -344,19 +346,19 @@ def import_command(
|
|
|
344
346
|
description which correctly uses the `vann:preferredNamespacePrefix` and
|
|
345
347
|
`vann:preferredNamespaceUri` properties.
|
|
346
348
|
"""
|
|
347
|
-
|
|
349
|
+
_buffer = io.BytesIO()
|
|
348
350
|
with click.open_file(file, "rb") as file_handle:
|
|
349
|
-
|
|
350
|
-
|
|
351
|
+
_buffer.write(file_handle.read())
|
|
352
|
+
_buffer.seek(0)
|
|
351
353
|
|
|
352
354
|
# fetch metadata
|
|
353
355
|
if namespace != (None, None):
|
|
354
356
|
_validate_namespace(app, namespace)
|
|
355
|
-
meta_data = _get_vocabulary_metadata_from_file(
|
|
357
|
+
meta_data = _get_vocabulary_metadata_from_file(_buffer, True)
|
|
356
358
|
meta_data["prefix"] = namespace[0] # type: ignore[assignment]
|
|
357
359
|
meta_data["namespace"] = namespace[1] # type: ignore[assignment]
|
|
358
360
|
else:
|
|
359
|
-
meta_data = _get_vocabulary_metadata_from_file(
|
|
361
|
+
meta_data = _get_vocabulary_metadata_from_file(_buffer, False)
|
|
360
362
|
iri = meta_data["iri"]
|
|
361
363
|
|
|
362
364
|
success_message = "done"
|
|
@@ -367,8 +369,8 @@ def import_command(
|
|
|
367
369
|
raise ValueError(f"Proposed graph {iri} does already exist.")
|
|
368
370
|
app.echo_info(f"Import {file} as vocabulary to {iri} ... ", nl=False)
|
|
369
371
|
# upload graph
|
|
370
|
-
|
|
371
|
-
graph_api.post_streamed(iri,
|
|
372
|
+
_buffer.seek(0)
|
|
373
|
+
graph_api.post_streamed(iri, _buffer, replace=True)
|
|
372
374
|
|
|
373
375
|
# resolve label
|
|
374
376
|
resolved_label_object: dict = resolve([iri], graph=iri)[iri]
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""workflow commands for cmem command line interface."""
|
|
2
|
+
|
|
2
3
|
import re
|
|
3
4
|
import sys
|
|
4
5
|
import time
|
|
@@ -96,6 +97,7 @@ def _get_workflows_filtered_by_io_feature(workflows: list[dict], feature: str) -
|
|
|
96
97
|
Raises:
|
|
97
98
|
------
|
|
98
99
|
ValueError
|
|
100
|
+
|
|
99
101
|
"""
|
|
100
102
|
possible_io_filter_values = ("input-only", "output-only", "input-output", "any")
|
|
101
103
|
if feature not in possible_io_filter_values:
|
|
@@ -137,6 +139,7 @@ def _get_workflows_filtered(workflows: list, filter_name: str, filter_value: str
|
|
|
137
139
|
Raises:
|
|
138
140
|
------
|
|
139
141
|
ValueError
|
|
142
|
+
|
|
140
143
|
"""
|
|
141
144
|
if filter_name not in WORKFLOW_FILTER_TYPES:
|
|
142
145
|
raise ValueError(
|
|
@@ -336,9 +339,9 @@ def _workflow_echo_status(app: ApplicationContext, status: dict) -> None:
|
|
|
336
339
|
f"statusName is {status_name}, expecting one of: " "Running, Canceling or Waiting."
|
|
337
340
|
)
|
|
338
341
|
# not running can be Idle or Finished
|
|
339
|
-
if
|
|
342
|
+
if status.get("failed"):
|
|
340
343
|
app.echo_error(message, nl=True, err=False)
|
|
341
|
-
elif
|
|
344
|
+
elif status.get("cancelled"):
|
|
342
345
|
app.echo_warning(message)
|
|
343
346
|
elif status["statusName"] == "Idle":
|
|
344
347
|
app.echo_info(message)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""Utility functions for CLI auto-completion functionality."""
|
|
2
|
+
|
|
2
3
|
# ruff: noqa: ARG001
|
|
3
4
|
import os
|
|
4
5
|
from contextlib import suppress
|
|
@@ -78,6 +79,7 @@ def _finalize_completion(
|
|
|
78
79
|
Raises:
|
|
79
80
|
------
|
|
80
81
|
ValueError in case of wrong sort_by parameter
|
|
82
|
+
|
|
81
83
|
"""
|
|
82
84
|
if sort_by not in (SORT_BY_KEY, SORT_BY_DESC):
|
|
83
85
|
raise ValueError("sort_by should be 0 or 1.")
|
|
@@ -548,9 +550,14 @@ def dataset_files(ctx: Context, param: Argument, incomplete: str) -> list[Comple
|
|
|
548
550
|
+ file_list(incomplete=incomplete, suffix=".xlsx", description="Excel Dataset resource")
|
|
549
551
|
+ file_list(incomplete=incomplete, suffix=".xml", description="XML Dataset resource")
|
|
550
552
|
+ file_list(incomplete=incomplete, suffix=".json", description="JSON Dataset resource")
|
|
553
|
+
+ file_list(
|
|
554
|
+
incomplete=incomplete, suffix=".jsonl", description="JSON Lines Dataset resource"
|
|
555
|
+
)
|
|
551
556
|
+ file_list(incomplete=incomplete, suffix=".ttl", description="RDF file Dataset resource")
|
|
552
557
|
+ file_list(incomplete=incomplete, suffix=".zip", description="multiCsv Dataset resource")
|
|
553
558
|
+ file_list(incomplete=incomplete, suffix=".orc", description="Apache ORC Dataset resource")
|
|
559
|
+
+ file_list(incomplete=incomplete, suffix=".yaml", description="YAML Document")
|
|
560
|
+
+ file_list(incomplete=incomplete, suffix=".yml", description="YAML Document")
|
|
554
561
|
)
|
|
555
562
|
|
|
556
563
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""The main command line interface."""
|
|
2
|
+
|
|
2
3
|
import ast
|
|
3
4
|
import configparser
|
|
4
5
|
import json
|
|
@@ -21,12 +22,13 @@ from pygments.lexers import get_lexer_by_name
|
|
|
21
22
|
from rich import box
|
|
22
23
|
from rich.console import Console
|
|
23
24
|
from rich.table import Table
|
|
25
|
+
from urllib3.exceptions import InsecureRequestWarning
|
|
24
26
|
|
|
25
27
|
from cmem_cmemc.exceptions import InvalidConfigurationError
|
|
26
28
|
|
|
27
|
-
DI_TARGET_VERSION = "
|
|
29
|
+
DI_TARGET_VERSION = "v24.1.0"
|
|
28
30
|
|
|
29
|
-
DP_TARGET_VERSION = "
|
|
31
|
+
DP_TARGET_VERSION = "v24.1.0"
|
|
30
32
|
|
|
31
33
|
KNOWN_CONFIG_KEYS = {
|
|
32
34
|
"CMEM_BASE_URI": cmempy_config.get_cmem_base_uri,
|
|
@@ -47,6 +49,8 @@ KNOWN_CONFIG_KEYS = {
|
|
|
47
49
|
|
|
48
50
|
KNOWN_SECRET_KEYS = ("OAUTH_PASSWORD", "OAUTH_CLIENT_SECRET", "OAUTH_ACCESS_TOKEN")
|
|
49
51
|
|
|
52
|
+
SSL_VERIFY_WARNING = "SSL verification is disabled (SSL_VERIFY=False)."
|
|
53
|
+
|
|
50
54
|
|
|
51
55
|
class ApplicationContext:
|
|
52
56
|
"""Context of the command line interface."""
|
|
@@ -142,12 +146,6 @@ class ApplicationContext:
|
|
|
142
146
|
self.set_credential_from_process(_, _ + "_PROCESS", config)
|
|
143
147
|
|
|
144
148
|
self.echo_debug(f"CA bundle loaded from {cmempy_config.get_requests_ca_bundle()}")
|
|
145
|
-
# If cert validation is disabled, output a warning
|
|
146
|
-
# Also disable library warnings:
|
|
147
|
-
# https://urllib3.readthedocs.io/en/latest/advanced-usage.html
|
|
148
|
-
if not cmempy_config.get_ssl_verify():
|
|
149
|
-
self.echo_warning("SSL verification is disabled (SSL_VERIFY=False).")
|
|
150
|
-
urllib3.disable_warnings()
|
|
151
149
|
return
|
|
152
150
|
|
|
153
151
|
def set_connection_from_params(self, params: dict) -> None:
|
|
@@ -192,7 +190,7 @@ class ApplicationContext:
|
|
|
192
190
|
self.config = self.get_config()
|
|
193
191
|
self.connection = None
|
|
194
192
|
if section_string is None or section_string == "":
|
|
195
|
-
self.echo_debug("No config given, use API
|
|
193
|
+
self.echo_debug("No config given, use API defaults or environment connection.")
|
|
196
194
|
elif section_string not in self.config:
|
|
197
195
|
raise InvalidConfigurationError(
|
|
198
196
|
f"There is no connection '{section_string}' configured in "
|
|
@@ -202,6 +200,14 @@ class ApplicationContext:
|
|
|
202
200
|
self.echo_debug(f"Use connection config: {section_string}")
|
|
203
201
|
self.connection = self.config[section_string]
|
|
204
202
|
self.configure_cmempy(self.connection)
|
|
203
|
+
|
|
204
|
+
# If cert validation is disabled, output a warning
|
|
205
|
+
# Also disable library warnings:
|
|
206
|
+
# https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings
|
|
207
|
+
if not cmempy_config.get_ssl_verify():
|
|
208
|
+
self.echo_warning(SSL_VERIFY_WARNING)
|
|
209
|
+
urllib3.disable_warnings(category=InsecureRequestWarning)
|
|
210
|
+
|
|
205
211
|
return self.connection
|
|
206
212
|
|
|
207
213
|
def get_config_file(self) -> Path:
|
|
@@ -339,6 +345,7 @@ class ApplicationContext:
|
|
|
339
345
|
name: Name of the backend
|
|
340
346
|
version: Version of the backend
|
|
341
347
|
target_version: Target version of cmemc for this backend
|
|
348
|
+
|
|
342
349
|
"""
|
|
343
350
|
# backend version
|
|
344
351
|
if not (match := re.match(r"^v([0-9]+)\.([0-9]+)(.*)?$", version)):
|
|
@@ -385,6 +392,7 @@ class ApplicationContext:
|
|
|
385
392
|
pw_key (str): the env variable which is created/set
|
|
386
393
|
command_key (str): the env variable which holds the command
|
|
387
394
|
config: the config object
|
|
395
|
+
|
|
388
396
|
"""
|
|
389
397
|
if command_key not in config:
|
|
390
398
|
return
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""Utility functions for CLI interface."""
|
|
2
|
+
|
|
2
3
|
import json
|
|
3
4
|
import os
|
|
4
5
|
import re
|
|
@@ -52,6 +53,7 @@ def iri_to_qname(iri: str) -> str:
|
|
|
52
53
|
iri: the IRI to transform
|
|
53
54
|
|
|
54
55
|
Returns: string
|
|
56
|
+
|
|
55
57
|
"""
|
|
56
58
|
for prefix, namespace in NAMESPACES.items():
|
|
57
59
|
iri = iri.replace(namespace, prefix + ":")
|
|
@@ -148,6 +150,7 @@ def struct_to_table(
|
|
|
148
150
|
Returns:
|
|
149
151
|
-------
|
|
150
152
|
The input table extended with rows from the input source.
|
|
153
|
+
|
|
151
154
|
"""
|
|
152
155
|
if table is None:
|
|
153
156
|
table = []
|
|
@@ -177,6 +180,7 @@ def split_task_id(task_id: str) -> tuple[str, str]:
|
|
|
177
180
|
Raises:
|
|
178
181
|
------
|
|
179
182
|
ValueError: in case the task ID is not splittable
|
|
183
|
+
|
|
180
184
|
"""
|
|
181
185
|
try:
|
|
182
186
|
project_part = task_id.split(":")[0]
|
|
@@ -245,6 +249,7 @@ def check_or_select_project(app: ApplicationContext, project_id: str | None = No
|
|
|
245
249
|
Returns:
|
|
246
250
|
-------
|
|
247
251
|
Maybe project_id if there was no project_id before.
|
|
252
|
+
|
|
248
253
|
"""
|
|
249
254
|
if project_id is not None:
|
|
250
255
|
return project_id
|
|
@@ -291,6 +296,8 @@ def get_published_packages() -> list[PublishedPackage]:
|
|
|
291
296
|
name = _.findChildren(class_="package-snippet__name")[0].getText()
|
|
292
297
|
if name == "cmem-plugin-base":
|
|
293
298
|
continue
|
|
299
|
+
if not name.startswith("cmem-plugin-"):
|
|
300
|
+
continue
|
|
294
301
|
description = _.findChildren(class_="package-snippet__description")[0].getText()
|
|
295
302
|
package_version = _.findChildren(class_="package-snippet__version")[0].getText()
|
|
296
303
|
published = _.findChildren(name="time")[0].attrs["datetime"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "cmem-cmemc"
|
|
3
|
-
version = "24.1.
|
|
3
|
+
version = "24.1.1"
|
|
4
4
|
description = "Command line client for eccenca Corporate Memory"
|
|
5
5
|
license = "Apache 2.0"
|
|
6
6
|
classifiers = ["Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "Intended Audience :: System Administrators", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3.9", "Topic :: Software Development :: Testing", "Topic :: Database", "Topic :: Utilities"]
|
|
@@ -15,7 +15,7 @@ certifi = ">=2023.5.7"
|
|
|
15
15
|
click = "^8.1.7"
|
|
16
16
|
click-didyoumean = "^0.3.0"
|
|
17
17
|
click-help-colors = "^0.9.1"
|
|
18
|
-
cmem-cmempy = "==24.1.
|
|
18
|
+
cmem-cmempy = "==24.1.1"
|
|
19
19
|
# cmem-cmempy = { path = "cmempy", develop = true }
|
|
20
20
|
configparser = "^5.3.0"
|
|
21
21
|
jinja2 = "^3.1.2"
|
|
@@ -42,11 +42,12 @@ pytest = "^7.3.1"
|
|
|
42
42
|
pytest-cov = "^4.1.0"
|
|
43
43
|
pytest-dotenv = "^0.5.2"
|
|
44
44
|
pytest-memray = { version = "^1.5.0", markers = "platform_system != 'Windows'" }
|
|
45
|
-
ruff = "^0.
|
|
45
|
+
ruff = "^0.3.4"
|
|
46
46
|
safety = "^1.10.3"
|
|
47
47
|
types-requests = "^2.31.0.10"
|
|
48
48
|
types-six = "^1.16.21.9"
|
|
49
49
|
types-python-dateutil = "^2.8.19.20240106"
|
|
50
|
+
pytest-html = "^4.1.1"
|
|
50
51
|
|
|
51
52
|
[build-system]
|
|
52
53
|
requires = ["poetry-core>=1.2.0", "poetry-dynamic-versioning"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|