cognite-toolkit 0.6.98__py3-none-any.whl → 0.6.99__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.
- cognite_toolkit/_cdf_tk/apps/_core_app.py +12 -1
- cognite_toolkit/_cdf_tk/commands/clean.py +52 -3
- cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml +1 -1
- cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml +1 -1
- cognite_toolkit/_resources/cdf.toml +1 -1
- cognite_toolkit/_version.py +1 -1
- {cognite_toolkit-0.6.98.dist-info → cognite_toolkit-0.6.99.dist-info}/METADATA +1 -1
- {cognite_toolkit-0.6.98.dist-info → cognite_toolkit-0.6.99.dist-info}/RECORD +11 -11
- {cognite_toolkit-0.6.98.dist-info → cognite_toolkit-0.6.99.dist-info}/WHEEL +0 -0
- {cognite_toolkit-0.6.98.dist-info → cognite_toolkit-0.6.99.dist-info}/entry_points.txt +0 -0
- {cognite_toolkit-0.6.98.dist-info → cognite_toolkit-0.6.99.dist-info}/licenses/LICENSE +0 -0
|
@@ -345,7 +345,16 @@ class CoreApp(typer.Typer):
|
|
|
345
345
|
list[str] | None,
|
|
346
346
|
typer.Option(
|
|
347
347
|
"--include",
|
|
348
|
-
help=f"Specify which resource types to
|
|
348
|
+
help=f"Specify which resource types to clean, supported types: {AVAILABLE_DATA_TYPES}",
|
|
349
|
+
),
|
|
350
|
+
] = None,
|
|
351
|
+
module: Annotated[
|
|
352
|
+
str | None,
|
|
353
|
+
typer.Option(
|
|
354
|
+
"--module",
|
|
355
|
+
"-m",
|
|
356
|
+
help="Specify name or path of the module to clean",
|
|
357
|
+
hidden=not Flags.v07.is_enabled(),
|
|
349
358
|
),
|
|
350
359
|
] = None,
|
|
351
360
|
verbose: Annotated[
|
|
@@ -368,6 +377,8 @@ class CoreApp(typer.Typer):
|
|
|
368
377
|
build_env_name,
|
|
369
378
|
dry_run,
|
|
370
379
|
include,
|
|
380
|
+
module,
|
|
371
381
|
verbose,
|
|
382
|
+
all_modules=True if not Flags.v07.is_enabled() else False,
|
|
372
383
|
)
|
|
373
384
|
)
|
|
@@ -2,6 +2,7 @@ import traceback
|
|
|
2
2
|
from graphlib import TopologicalSorter
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
|
|
5
|
+
import questionary
|
|
5
6
|
from cognite.client.exceptions import CogniteAPIError, CogniteNotFoundError
|
|
6
7
|
from cognite.client.utils.useful_types import SequenceNotStr
|
|
7
8
|
from rich import print
|
|
@@ -40,8 +41,10 @@ from cognite_toolkit._cdf_tk.data_classes import (
|
|
|
40
41
|
from cognite_toolkit._cdf_tk.data_classes._module_directories import ReadModule
|
|
41
42
|
from cognite_toolkit._cdf_tk.exceptions import (
|
|
42
43
|
ToolkitCleanResourceError,
|
|
44
|
+
ToolkitMissingModuleError,
|
|
43
45
|
ToolkitNotADirectoryError,
|
|
44
46
|
ToolkitValidationError,
|
|
47
|
+
ToolkitValueError,
|
|
45
48
|
)
|
|
46
49
|
from cognite_toolkit._cdf_tk.tk_warnings import (
|
|
47
50
|
LowSeverityWarning,
|
|
@@ -185,6 +188,23 @@ class CleanCommand(ToolkitCommand):
|
|
|
185
188
|
self._verbose_print_drop(resource_drop_count, resource_ids, loader, dry_run)
|
|
186
189
|
return nr_of_dropped
|
|
187
190
|
|
|
191
|
+
def _interactive_module_selection(self, built_modules: list[ReadModule] | None) -> list[ReadModule] | None:
|
|
192
|
+
if not built_modules:
|
|
193
|
+
return None
|
|
194
|
+
choices = [
|
|
195
|
+
questionary.Choice(title=built_module.dir.name, value=built_module) for built_module in built_modules
|
|
196
|
+
]
|
|
197
|
+
|
|
198
|
+
selected_modules = questionary.checkbox(
|
|
199
|
+
"Which modules would you like to clean?",
|
|
200
|
+
instruction="Use arrow up/down, press space to select item(s) and enter to save",
|
|
201
|
+
choices=choices,
|
|
202
|
+
).ask()
|
|
203
|
+
|
|
204
|
+
if not selected_modules:
|
|
205
|
+
return None
|
|
206
|
+
return selected_modules
|
|
207
|
+
|
|
188
208
|
def _verbose_print_drop(
|
|
189
209
|
self, drop_count: int, resource_ids: SequenceNotStr[T_ID], loader: ResourceContainerCRUD, dry_run: bool
|
|
190
210
|
) -> None:
|
|
@@ -204,6 +224,11 @@ class CleanCommand(ToolkitCommand):
|
|
|
204
224
|
# Count is not supported
|
|
205
225
|
print(f" {prefix} all {loader.item_name} from {loader.display_name}: {_print_ids_or_length(resource_ids)}.")
|
|
206
226
|
|
|
227
|
+
def _select_modules(self, clean_state: BuildEnvironment, module_str: str | None) -> list[ReadModule] | None:
|
|
228
|
+
if module_str:
|
|
229
|
+
return [module for module in clean_state.read_modules if module.dir.name == module_str]
|
|
230
|
+
return self._interactive_module_selection(clean_state.read_modules)
|
|
231
|
+
|
|
207
232
|
def execute(
|
|
208
233
|
self,
|
|
209
234
|
env_vars: EnvironmentVariables,
|
|
@@ -211,7 +236,9 @@ class CleanCommand(ToolkitCommand):
|
|
|
211
236
|
build_env_name: str | None,
|
|
212
237
|
dry_run: bool,
|
|
213
238
|
include: list[str] | None,
|
|
239
|
+
module_str: str | None,
|
|
214
240
|
verbose: bool,
|
|
241
|
+
all_modules: bool = False,
|
|
215
242
|
) -> None:
|
|
216
243
|
if not build_dir.exists():
|
|
217
244
|
raise ToolkitNotADirectoryError(
|
|
@@ -245,9 +272,31 @@ class CleanCommand(ToolkitCommand):
|
|
|
245
272
|
)
|
|
246
273
|
|
|
247
274
|
if not build_dir.is_dir():
|
|
248
|
-
raise ToolkitNotADirectoryError(f"'{build_dir}'. Did you forget to run `cdf
|
|
275
|
+
raise ToolkitNotADirectoryError(f"'{build_dir}'. Did you forget to run `cdf build` first?")
|
|
276
|
+
|
|
277
|
+
selected_modules: list[ReadModule]
|
|
278
|
+
if all_modules:
|
|
279
|
+
selected_modules = clean_state.read_modules or []
|
|
280
|
+
if not selected_modules:
|
|
281
|
+
raise ToolkitValueError("No modules available to clean.")
|
|
282
|
+
elif module_str:
|
|
283
|
+
selected_modules = [module for module in clean_state.read_modules if module.dir.name == module_str]
|
|
284
|
+
if not selected_modules:
|
|
285
|
+
available_module_names = {module.dir.name for module in clean_state.read_modules}
|
|
286
|
+
raise ToolkitMissingModuleError(
|
|
287
|
+
f"No modules matched the selection: {module_str}. Available modules: {sorted(available_module_names)}"
|
|
288
|
+
)
|
|
289
|
+
else:
|
|
290
|
+
selected_modules = self._interactive_module_selection(clean_state.read_modules) or []
|
|
291
|
+
if not selected_modules:
|
|
292
|
+
raise ToolkitValueError(
|
|
293
|
+
"No module specified with the --module option and no modules selected interactively."
|
|
294
|
+
)
|
|
249
295
|
|
|
250
|
-
|
|
296
|
+
selected_resource_folders = {
|
|
297
|
+
resource_folder for module in selected_modules for resource_folder in module.resource_directories
|
|
298
|
+
}
|
|
299
|
+
selected_loaders = self.get_selected_loaders(build_dir, selected_resource_folders, include)
|
|
251
300
|
|
|
252
301
|
results = DeployResults([], "clean", dry_run=dry_run)
|
|
253
302
|
|
|
@@ -274,7 +323,7 @@ class CleanCommand(ToolkitCommand):
|
|
|
274
323
|
result = self.clean_resources(
|
|
275
324
|
loader,
|
|
276
325
|
env_vars=env_vars,
|
|
277
|
-
read_modules=
|
|
326
|
+
read_modules=selected_modules,
|
|
278
327
|
drop=True,
|
|
279
328
|
dry_run=dry_run,
|
|
280
329
|
drop_data=True,
|
|
@@ -4,7 +4,7 @@ default_env = "<DEFAULT_ENV_PLACEHOLDER>"
|
|
|
4
4
|
[modules]
|
|
5
5
|
# This is the version of the modules. It should not be changed manually.
|
|
6
6
|
# It will be updated by the 'cdf modules upgrade' command.
|
|
7
|
-
version = "0.6.
|
|
7
|
+
version = "0.6.99"
|
|
8
8
|
|
|
9
9
|
[alpha_flags]
|
|
10
10
|
external-libraries = true
|
cognite_toolkit/_version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.6.
|
|
1
|
+
__version__ = "0.6.99"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cognite_toolkit
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.99
|
|
4
4
|
Summary: Official Cognite Data Fusion tool for project templates and configuration deployment
|
|
5
5
|
Project-URL: Homepage, https://docs.cognite.com/cdf/deploy/cdf_toolkit/
|
|
6
6
|
Project-URL: Changelog, https://github.com/cognitedata/toolkit/releases
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
cognite_toolkit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
cognite_toolkit/_cdf.py,sha256=0abeQr1Tfk4lkGaoXyrnFC28wDSlR_8UGrh10noGduQ,6085
|
|
3
|
-
cognite_toolkit/_version.py,sha256=
|
|
3
|
+
cognite_toolkit/_version.py,sha256=DGUWwS-X7ixNBRDUnfXC2eo0mUpmTRgxl2RYLstcKAM,23
|
|
4
4
|
cognite_toolkit/_cdf_tk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
cognite_toolkit/_cdf_tk/cdf_toml.py,sha256=IjmzNVLxsOV6tsMDgmJmXsy-LQru-8IEQdFzGW5DxVk,8117
|
|
6
6
|
cognite_toolkit/_cdf_tk/constants.py,sha256=t5TZdf0ltCLSDEs0eUVEV9LK5-nXPW00NF85L5EkngU,6485
|
|
@@ -13,7 +13,7 @@ cognite_toolkit/_cdf_tk/tracker.py,sha256=ybazaYDMgrtmAaCEb1nlKAQzjcN352-U-om4NB
|
|
|
13
13
|
cognite_toolkit/_cdf_tk/validation.py,sha256=KFdPgnNIbVM0yjFF0cqmpBB8MI8e-U-YbBYrP4IiClE,8441
|
|
14
14
|
cognite_toolkit/_cdf_tk/apps/__init__.py,sha256=KKmhbpvPKTwqQS2g_XqAC2yvtPsvdl8wV5TgJA3zqhs,702
|
|
15
15
|
cognite_toolkit/_cdf_tk/apps/_auth_app.py,sha256=ER7uYb3ViwsHMXiQEZpyhwU6TIjKaB9aEy32VI4MPpg,3397
|
|
16
|
-
cognite_toolkit/_cdf_tk/apps/_core_app.py,sha256=
|
|
16
|
+
cognite_toolkit/_cdf_tk/apps/_core_app.py,sha256=Xlhdv2MoCs2kBk0kgJixiy8ouCfixUWXuK3crEXAqB0,14032
|
|
17
17
|
cognite_toolkit/_cdf_tk/apps/_data_app.py,sha256=rFnTcUBAuoFcTQCjxwqZGG0HjUMGdYTFyBGXxWg5gXE,824
|
|
18
18
|
cognite_toolkit/_cdf_tk/apps/_dev_app.py,sha256=q8DBr4BAK33AwsHW3gAWZWSjSaQRuCisqPbsBjmYSxk,589
|
|
19
19
|
cognite_toolkit/_cdf_tk/apps/_download_app.py,sha256=faAuhFYn7eQ_uzP3BNmnXeaeeoyZR1JvRZx2ATKrsao,16691
|
|
@@ -112,7 +112,7 @@ cognite_toolkit/_cdf_tk/commands/_utils.py,sha256=UxMJW5QYKts4om5n6x2Tq2ihvfO9gW
|
|
|
112
112
|
cognite_toolkit/_cdf_tk/commands/_virtual_env.py,sha256=GFAid4hplixmj9_HkcXqU5yCLj-fTXm4cloGD6U2swY,2180
|
|
113
113
|
cognite_toolkit/_cdf_tk/commands/auth.py,sha256=N6JgtF0_Qoh-xM8VlBb_IK1n0Lo5I7bIkIHmXm1l7ug,31638
|
|
114
114
|
cognite_toolkit/_cdf_tk/commands/build_cmd.py,sha256=k2_BhmTJRXuB640-g4hFsN2tD58b-aujk6kFn400qsc,30516
|
|
115
|
-
cognite_toolkit/_cdf_tk/commands/clean.py,sha256=
|
|
115
|
+
cognite_toolkit/_cdf_tk/commands/clean.py,sha256=KDcUn1MEpvk_K7WqQPBiZcIlGV61JVG6D0DcYUXj7BM,16567
|
|
116
116
|
cognite_toolkit/_cdf_tk/commands/collect.py,sha256=zBMKhhvjOpuASMnwP0eeHRI02tANcvFEZgv0CQO1ECc,627
|
|
117
117
|
cognite_toolkit/_cdf_tk/commands/deploy.py,sha256=R185y7oFr3yhh10RSPE81dpYX346ghVYOrVEF-JKaaI,23020
|
|
118
118
|
cognite_toolkit/_cdf_tk/commands/dump_data.py,sha256=8l4M2kqV4DjiV5js5s7EbFVNxV0Np4ld8ogw19vaJp0,21804
|
|
@@ -298,13 +298,13 @@ cognite_toolkit/_repo_files/.gitignore,sha256=ip9kf9tcC5OguF4YF4JFEApnKYw0nG0vPi
|
|
|
298
298
|
cognite_toolkit/_repo_files/AzureDevOps/.devops/README.md,sha256=OLA0D7yCX2tACpzvkA0IfkgQ4_swSd-OlJ1tYcTBpsA,240
|
|
299
299
|
cognite_toolkit/_repo_files/AzureDevOps/.devops/deploy-pipeline.yml,sha256=brULcs8joAeBC_w_aoWjDDUHs3JheLMIR9ajPUK96nc,693
|
|
300
300
|
cognite_toolkit/_repo_files/AzureDevOps/.devops/dry-run-pipeline.yml,sha256=OBFDhFWK1mlT4Dc6mDUE2Es834l8sAlYG50-5RxRtHk,723
|
|
301
|
-
cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml,sha256=
|
|
302
|
-
cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=
|
|
303
|
-
cognite_toolkit/_resources/cdf.toml,sha256=
|
|
301
|
+
cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml,sha256=la3qBRtQQqa-FDTjMALDT2DXgVP6Bu9FYTby1X32WXg,667
|
|
302
|
+
cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=SUEUhsROq20e30svUJ9oPoQaKuc5QiY2rMvdgitQUDw,2430
|
|
303
|
+
cognite_toolkit/_resources/cdf.toml,sha256=cD1UBfSEeuaW5Sf1FCL3h1exyJNwOi87rLqU-NMqpZc,487
|
|
304
304
|
cognite_toolkit/demo/__init__.py,sha256=-m1JoUiwRhNCL18eJ6t7fZOL7RPfowhCuqhYFtLgrss,72
|
|
305
305
|
cognite_toolkit/demo/_base.py,sha256=6xKBUQpXZXGQ3fJ5f7nj7oT0s2n7OTAGIa17ZlKHZ5U,8052
|
|
306
|
-
cognite_toolkit-0.6.
|
|
307
|
-
cognite_toolkit-0.6.
|
|
308
|
-
cognite_toolkit-0.6.
|
|
309
|
-
cognite_toolkit-0.6.
|
|
310
|
-
cognite_toolkit-0.6.
|
|
306
|
+
cognite_toolkit-0.6.99.dist-info/METADATA,sha256=4Fui-pU97C-Chi5IpDPFuMTk5nuLZbySZ1GyKYVgiV0,4501
|
|
307
|
+
cognite_toolkit-0.6.99.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
308
|
+
cognite_toolkit-0.6.99.dist-info/entry_points.txt,sha256=JlR7MH1_UMogC3QOyN4-1l36VbrCX9xUdQoHGkuJ6-4,83
|
|
309
|
+
cognite_toolkit-0.6.99.dist-info/licenses/LICENSE,sha256=CW0DRcx5tL-pCxLEN7ts2S9g2sLRAsWgHVEX4SN9_Mc,752
|
|
310
|
+
cognite_toolkit-0.6.99.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|