development-framework-cli 1.8.0__py3-none-any.whl → 1.8.1__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.
- {development_framework_cli-1.8.0.dist-info → development_framework_cli-1.8.1.dist-info}/METADATA +2 -2
- {development_framework_cli-1.8.0.dist-info → development_framework_cli-1.8.1.dist-info}/RECORD +13 -13
- {development_framework_cli-1.8.0.dist-info → development_framework_cli-1.8.1.dist-info}/WHEEL +1 -1
- dm_cli/__init__.py +1 -1
- dm_cli/cli.py +3 -3
- dm_cli/command_group/entities.py +1 -1
- dm_cli/import_entity.py +4 -6
- dm_cli/import_package.py +10 -10
- dm_cli/package_tree_from_zip.py +9 -8
- dm_cli/utils/reference.py +5 -3
- dm_cli/utils/utils.py +7 -5
- {development_framework_cli-1.8.0.dist-info → development_framework_cli-1.8.1.dist-info}/entry_points.txt +0 -0
- {development_framework_cli-1.8.0.dist-info → development_framework_cli-1.8.1.dist-info}/licenses/LICENSE +0 -0
{development_framework_cli-1.8.0.dist-info → development_framework_cli-1.8.1.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: development-framework-cli
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.1
|
|
4
4
|
Summary: CLI tool for working with Data Modelling Storage Service
|
|
5
5
|
Project-URL: Homepage, https://github.com/equinor/dm-cli
|
|
6
6
|
Project-URL: Repository, https://github.com/equinor/dm-cli
|
{development_framework_cli-1.8.0.dist-info → development_framework_cli-1.8.1.dist-info}/RECORD
RENAMED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
dm_cli/__init__.py,sha256=
|
|
2
|
-
dm_cli/cli.py,sha256=
|
|
1
|
+
dm_cli/__init__.py,sha256=l_-YHE0jiBFqId_V1IWGEH47UPoJEHPzCoz9PWJCsoM,46
|
|
2
|
+
dm_cli/cli.py,sha256=aUb6lvlHsvcPYzKYPOsMbmpjqoZpsN9e2ARHY5bnpgU,7103
|
|
3
3
|
dm_cli/dmss.py,sha256=bA_jU9lIdY7HizK1DETZViufiWlcmYyFhBXLvFadyeE,5981
|
|
4
4
|
dm_cli/domain.py,sha256=BMBK-WOQwBvDBEr_AoywdXAUPXMHIKIZLnMHpkuzqPs,5650
|
|
5
5
|
dm_cli/enums.py,sha256=7PFPV1u5mexc-p6s8gG-wb7B5SmAORh5esmPQ-zxUtg,1236
|
|
6
|
-
dm_cli/import_entity.py,sha256=
|
|
7
|
-
dm_cli/import_package.py,sha256=
|
|
8
|
-
dm_cli/package_tree_from_zip.py,sha256=
|
|
6
|
+
dm_cli/import_entity.py,sha256=9qjqr3rqPDjSnzJL1YFB8bDy8nETRC9ni6ALtPeqYQQ,6934
|
|
7
|
+
dm_cli/import_package.py,sha256=051FRQuEt9zFx5HuDBg_sQRUUMgCHj9h439X0As03AM,11595
|
|
8
|
+
dm_cli/package_tree_from_zip.py,sha256=L8gJB-sjvmQKYLkW3pAcNUccKXn7GrtMmuq-8d8sMfo,4803
|
|
9
9
|
dm_cli/state.py,sha256=F2L_0bj0P840WDvCmqR0TCsko0AsVyjiOP8SVKocG7s,198
|
|
10
10
|
dm_cli/command_group/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
11
|
dm_cli/command_group/data_source.py,sha256=XnWMiJ-ScGfauFEeQ8IoftnasUg5lXYr-6D7jvdE6II,7671
|
|
12
|
-
dm_cli/command_group/entities.py,sha256=
|
|
12
|
+
dm_cli/command_group/entities.py,sha256=XOkQ-IJAd5lPmsAFI_bAigQrVI-fm94hkC6FYf2TE4k,6234
|
|
13
13
|
dm_cli/dmss_api/__init__.py,sha256=YPL3TK0SH515dzVPW7zobuzH-cTo1IiMTMRuf6N5Pig,4607
|
|
14
14
|
dm_cli/dmss_api/api_client.py,sha256=cm6nf1CFBbNxsYypjaEvN3SdPD5mlt6z4IQyUvnVAzY,28750
|
|
15
15
|
dm_cli/dmss_api/api_response.py,sha256=eMxw1mpmJcoGZ3gs9z6jM4oYoZ10Gjk333s9sKxGv7s,652
|
|
@@ -55,12 +55,12 @@ dm_cli/dmss_api/models/storage_data_types.py,sha256=CLRbZfQ1v-b5A7XCOp5XBUNDDB2x
|
|
|
55
55
|
dm_cli/dmss_api/models/storage_recipe.py,sha256=qlsiNuwM0VDt3yuImGNVZQ9cLzPZ3f6k-q18FFArZKo,3811
|
|
56
56
|
dm_cli/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
57
57
|
dm_cli/utils/file_structure.py,sha256=efIcl7kr7LGm9-2AKt6M6uXe0L8NHNBg0Icy1xO8rSM,1020
|
|
58
|
-
dm_cli/utils/reference.py,sha256=
|
|
58
|
+
dm_cli/utils/reference.py,sha256=y0Wp81fQ22hywgAQSLvzJftt4ki8BPdWFdf2rVgU_Bo,5835
|
|
59
59
|
dm_cli/utils/resolve_local_ids.py,sha256=I9kXVZTQgqr07eu4CghGQVU99MAEXCdn6hacVX0AYOY,5726
|
|
60
|
-
dm_cli/utils/utils.py,sha256=
|
|
60
|
+
dm_cli/utils/utils.py,sha256=wyCNKHXcpPk0Rd_8P1x__XTM_14XJKCjWelUw4gV8XA,7522
|
|
61
61
|
dm_cli/utils/zip.py,sha256=Zdq6Z978i_1iDAvbrqZwJNsw4QersVtK0HeqFiRagdA,2781
|
|
62
|
-
development_framework_cli-1.8.
|
|
63
|
-
development_framework_cli-1.8.
|
|
64
|
-
development_framework_cli-1.8.
|
|
65
|
-
development_framework_cli-1.8.
|
|
66
|
-
development_framework_cli-1.8.
|
|
62
|
+
development_framework_cli-1.8.1.dist-info/METADATA,sha256=uf-6LlcdTk_kNdI12zoQzQ7PJgNzVxPgC3MkpSkL-vI,8234
|
|
63
|
+
development_framework_cli-1.8.1.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
64
|
+
development_framework_cli-1.8.1.dist-info/entry_points.txt,sha256=PAOXUTc_jhfY9Hfs7BNFzh4TlbrOGYU7HgTM-P7h074,38
|
|
65
|
+
development_framework_cli-1.8.1.dist-info/licenses/LICENSE,sha256=zefthAHZDOYIcHUXefkN_Fvuy4s-nYfoLX_dsycVDxc,1064
|
|
66
|
+
development_framework_cli-1.8.1.dist-info/RECORD,,
|
dm_cli/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
VERSION = "1.8.
|
|
1
|
+
VERSION = "1.8.1" # x-release-please-version
|
dm_cli/cli.py
CHANGED
|
@@ -87,7 +87,7 @@ def import_plugin_blueprints(
|
|
|
87
87
|
def create_lookup(
|
|
88
88
|
name: Annotated[str, typer.Argument(help="Name of the lookup (application context) to create.")],
|
|
89
89
|
paths: Annotated[
|
|
90
|
-
List[
|
|
90
|
+
List[str],
|
|
91
91
|
typer.Argument(
|
|
92
92
|
help="one or more remote location for recursively looking for RecipeLinks. "
|
|
93
93
|
"A remote location is a path in DMSS on the format <dataSource>/<rootPackage>/<subPacakge>/..."
|
|
@@ -97,8 +97,8 @@ def create_lookup(
|
|
|
97
97
|
"""
|
|
98
98
|
Create a named Ui-/StorageRecipe-lookup-table from all RecipeLinks in a package existing in DMSS (requires admin privileges).
|
|
99
99
|
"""
|
|
100
|
-
#
|
|
101
|
-
paths_as_strings = [
|
|
100
|
+
# DMSS addresses, not local paths: a Path would turn '/' into '\' on Windows.
|
|
101
|
+
paths_as_strings = [path.rstrip("/") for path in paths]
|
|
102
102
|
print(f"Creating lookup table from paths: {paths_as_strings}")
|
|
103
103
|
dmss_exception_wrapper(dmss_api.create_lookup, recipe_package=paths_as_strings, application=name)
|
|
104
104
|
|
dm_cli/command_group/entities.py
CHANGED
|
@@ -42,7 +42,7 @@ def import_entity(
|
|
|
42
42
|
source_path = Path(source)
|
|
43
43
|
destination = destination.rstrip("/\\")
|
|
44
44
|
# Not replacing a package, but appending to. Can therefore not use "fast mode"
|
|
45
|
-
fast = destination_is_root(
|
|
45
|
+
fast = destination_is_root(destination)
|
|
46
46
|
|
|
47
47
|
def inner_import():
|
|
48
48
|
if source_path.is_dir():
|
dm_cli/import_entity.py
CHANGED
|
@@ -59,7 +59,7 @@ def import_document(source_path: Path, destination: str, document: dict):
|
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
def import_single_entity(source_path: Path, destination: str, validate: bool = False):
|
|
62
|
-
ensure_package_structure(
|
|
62
|
+
ensure_package_structure(destination)
|
|
63
63
|
print(f"Importing ENTITY '{source_path.name}' --> '{destination}'")
|
|
64
64
|
|
|
65
65
|
try: # Load the JSON document
|
|
@@ -96,8 +96,6 @@ def import_folder_entity(
|
|
|
96
96
|
raw_package_import: bool = False,
|
|
97
97
|
resolve_local_ids: bool = False,
|
|
98
98
|
) -> dict:
|
|
99
|
-
destination_path = Path(destination)
|
|
100
|
-
|
|
101
99
|
# Check if target already exists on remote. Then delete or raise exception
|
|
102
100
|
target = f"{destination}/{source_path.name}"
|
|
103
101
|
exists = dmss_api.document_check(target)
|
|
@@ -108,9 +106,9 @@ def import_folder_entity(
|
|
|
108
106
|
dmss_api.document_remove(target)
|
|
109
107
|
|
|
110
108
|
dependencies = {}
|
|
111
|
-
is_root = destination_is_root(
|
|
109
|
+
is_root = destination_is_root(destination)
|
|
112
110
|
if not is_root:
|
|
113
|
-
ensure_package_structure(
|
|
111
|
+
ensure_package_structure(destination)
|
|
114
112
|
dependencies = dependencies_of(dmss_api.export_meta(destination))
|
|
115
113
|
|
|
116
114
|
memory_file = io.BytesIO()
|
|
@@ -172,7 +170,7 @@ def import_folders_as_one_package(source_path: Path, destination: str, package_n
|
|
|
172
170
|
console.print(f"'{target}' already exists. Replacing it...", style="dark_orange")
|
|
173
171
|
dmss_api.document_remove(target)
|
|
174
172
|
|
|
175
|
-
ensure_package_structure(
|
|
173
|
+
ensure_package_structure(destination)
|
|
176
174
|
dependencies = dependencies_of(dmss_api.export_meta(destination))
|
|
177
175
|
|
|
178
176
|
entries = sorted(source_path.iterdir())
|
dm_cli/import_package.py
CHANGED
|
@@ -3,7 +3,7 @@ import json
|
|
|
3
3
|
import os
|
|
4
4
|
from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
5
5
|
from json import JSONDecodeError
|
|
6
|
-
from pathlib import Path
|
|
6
|
+
from pathlib import Path, PurePosixPath
|
|
7
7
|
from typing import Callable, Dict, List, Tuple
|
|
8
8
|
from uuid import uuid4
|
|
9
9
|
|
|
@@ -99,7 +99,7 @@ def _upload_documents(description: str, data_source: str, documents: List[dict])
|
|
|
99
99
|
run_with_progress(description, documents, lambda document: dmss_api.document_add_simple(data_source, document))
|
|
100
100
|
|
|
101
101
|
|
|
102
|
-
def add_object_to_package(path:
|
|
102
|
+
def add_object_to_package(path: PurePosixPath, package: Package, object: io.BytesIO) -> None:
|
|
103
103
|
if len(path.parts) == 1: # End of path means the actual document
|
|
104
104
|
file = File(
|
|
105
105
|
uid=str(uuid4()), # This UID will be the data source ID for this file
|
|
@@ -115,11 +115,11 @@ def add_object_to_package(path: Path, package: Package, object: io.BytesIO) -> N
|
|
|
115
115
|
sub_folder = Package(name=path.parts[0], parent=package)
|
|
116
116
|
package.content.append(sub_folder)
|
|
117
117
|
|
|
118
|
-
new_path =
|
|
119
|
-
return add_object_to_package(
|
|
118
|
+
new_path = PurePosixPath(*path.parts[1:]) # Remove first element in path before stepping down
|
|
119
|
+
return add_object_to_package(new_path, sub_folder, object)
|
|
120
120
|
|
|
121
121
|
|
|
122
|
-
def add_file_to_package(path:
|
|
122
|
+
def add_file_to_package(path: PurePosixPath, package: Package, document: dict) -> None:
|
|
123
123
|
if len(path.parts) == 1: # End of path means the actual document
|
|
124
124
|
if path.name.endswith("package.json"):
|
|
125
125
|
# if document is a package.json file, add meta info to package instead of adding it to content list.
|
|
@@ -134,11 +134,11 @@ def add_file_to_package(path: Path, package: Package, document: dict) -> None:
|
|
|
134
134
|
sub_folder = Package(name=path.parts[0], parent=package)
|
|
135
135
|
package.content.append(sub_folder)
|
|
136
136
|
|
|
137
|
-
new_path =
|
|
138
|
-
return add_file_to_package(
|
|
137
|
+
new_path = PurePosixPath(*path.parts[1:]) # Remove first element in path before stepping down
|
|
138
|
+
return add_file_to_package(new_path, sub_folder, document)
|
|
139
139
|
|
|
140
140
|
|
|
141
|
-
def add_package_to_package(path:
|
|
141
|
+
def add_package_to_package(path: PurePosixPath, package: Package) -> None:
|
|
142
142
|
if len(path.parts) == 1:
|
|
143
143
|
package.content.append(Package(name=path.parts[0], parent=package))
|
|
144
144
|
return
|
|
@@ -148,8 +148,8 @@ def add_package_to_package(path: Path, package: Package) -> None:
|
|
|
148
148
|
sub_folder = Package(name=path.parts[0], parent=package)
|
|
149
149
|
package.content.append(sub_folder)
|
|
150
150
|
|
|
151
|
-
new_path =
|
|
152
|
-
return add_package_to_package(
|
|
151
|
+
new_path = PurePosixPath(*path.parts[1:]) # Remove first element in path before stepping down
|
|
152
|
+
return add_package_to_package(new_path, sub_folder)
|
|
153
153
|
|
|
154
154
|
|
|
155
155
|
def import_package_tree(package: Package, destination: str, raw_package_import: bool, resolve_local_ids: bool) -> None:
|
dm_cli/package_tree_from_zip.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import io
|
|
2
2
|
import json
|
|
3
3
|
from json import JSONDecodeError
|
|
4
|
-
from pathlib import Path
|
|
4
|
+
from pathlib import Path, PurePosixPath
|
|
5
5
|
from typing import Dict, Union
|
|
6
6
|
from zipfile import ZipFile
|
|
7
7
|
|
|
@@ -58,26 +58,27 @@ def package_tree_from_zip(
|
|
|
58
58
|
is_root=is_root,
|
|
59
59
|
meta=package_entity.get("_meta_"),
|
|
60
60
|
)
|
|
61
|
-
# Construct a nested Package object of the package to import
|
|
61
|
+
# Construct a nested Package object of the package to import.
|
|
62
|
+
# Zip entry names and DMSS addresses always use '/', so they are handled as POSIX paths on every OS.
|
|
62
63
|
for file_info in zip_file.filelist:
|
|
63
64
|
filename = file_info.filename.split("/", 1)[1] # Remove RootPackage prefix
|
|
64
65
|
if file_info.is_dir():
|
|
65
66
|
if filename == "": # Skip rootPackage
|
|
66
67
|
continue
|
|
67
|
-
add_package_to_package(
|
|
68
|
+
add_package_to_package(PurePosixPath(filename), root_package)
|
|
68
69
|
continue
|
|
69
|
-
if
|
|
70
|
+
if PurePosixPath(filename).suffix != ".json":
|
|
70
71
|
file_like = io.BytesIO(zip_file.read(f"{folder_name}/{filename}"))
|
|
71
|
-
file_like.name =
|
|
72
|
-
file_like.destination =
|
|
73
|
-
add_object_to_package(
|
|
72
|
+
file_like.name = PurePosixPath(filename).name # stem
|
|
73
|
+
file_like.destination = PurePosixPath(f"/{destination}/{folder_name}/{filename}").parent
|
|
74
|
+
add_object_to_package(PurePosixPath(filename), root_package, file_like)
|
|
74
75
|
continue
|
|
75
76
|
try:
|
|
76
77
|
json_doc = json.loads(zip_file.read(f"{folder_name}/{filename}"))
|
|
77
78
|
except JSONDecodeError:
|
|
78
79
|
raise Exception(f"Failed to load the file '{filename}' as a JSON document")
|
|
79
80
|
|
|
80
|
-
add_file_to_package(
|
|
81
|
+
add_file_to_package(PurePosixPath(filename), root_package, json_doc)
|
|
81
82
|
|
|
82
83
|
# Add dependencies from entity to the global dependencies list
|
|
83
84
|
dependencies = concat_dependencies(
|
dm_cli/utils/reference.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import os
|
|
2
2
|
from pathlib import Path
|
|
3
|
+
from posixpath import normpath # references are DMSS addresses, always '/'-separated
|
|
3
4
|
from typing import Dict, List, Union
|
|
4
5
|
|
|
5
6
|
from ..dmss import ApplicationException
|
|
@@ -81,8 +82,9 @@ def replace_relative_references(
|
|
|
81
82
|
if value["referenceType"] == ReferenceTypes.LINK.value:
|
|
82
83
|
value["address"] = _resolve_reference(value["address"])
|
|
83
84
|
else:
|
|
84
|
-
# Handle storage references
|
|
85
|
-
|
|
85
|
+
# Handle storage references. source_path is a folder on disk: take its parent with
|
|
86
|
+
# the OS path rules, the address itself is appended as-is ('/' works on Windows too).
|
|
87
|
+
local_file_path = os.path.dirname(str(source_path)) if source_path else ""
|
|
86
88
|
if value["address"][0] == ".":
|
|
87
89
|
raise ApplicationException(
|
|
88
90
|
f"Relative references by . are not supported", data=value, debug=file_path
|
dm_cli/utils/utils.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import os
|
|
3
3
|
import pprint
|
|
4
|
-
from pathlib import Path
|
|
4
|
+
from pathlib import Path, PurePosixPath
|
|
5
5
|
from typing import Callable, Dict, List
|
|
6
6
|
|
|
7
7
|
import typer
|
|
@@ -68,7 +68,7 @@ def document_already_exists(api_exception: ApiException) -> bool:
|
|
|
68
68
|
return False
|
|
69
69
|
|
|
70
70
|
|
|
71
|
-
def add_package_to_path(name: str, path:
|
|
71
|
+
def add_package_to_path(name: str, path: PurePosixPath):
|
|
72
72
|
package = Package(name, is_root=len(path.parts) == 2)
|
|
73
73
|
dmss_api.document_add(
|
|
74
74
|
str(path.parent),
|
|
@@ -102,14 +102,16 @@ def replace_global_addresses(
|
|
|
102
102
|
return document
|
|
103
103
|
|
|
104
104
|
|
|
105
|
-
def destination_is_root(destination:
|
|
106
|
-
if len(destination.parts) > 1:
|
|
105
|
+
def destination_is_root(destination: str | PurePosixPath) -> bool:
|
|
106
|
+
if len(PurePosixPath(destination).parts) > 1:
|
|
107
107
|
return False
|
|
108
108
|
return True
|
|
109
109
|
|
|
110
110
|
|
|
111
|
-
def ensure_package_structure(path:
|
|
111
|
+
def ensure_package_structure(path: str | PurePosixPath):
|
|
112
112
|
"""Create any missing packages in the provided path (mkdir -R)"""
|
|
113
|
+
# A DMSS address, not a path on disk: keep it '/'-separated on every OS.
|
|
114
|
+
path = PurePosixPath(path)
|
|
113
115
|
try:
|
|
114
116
|
dmss_api.document_get(f"dmss://{path}/")
|
|
115
117
|
except NotFoundException as e:
|
|
File without changes
|
|
File without changes
|