cognite-toolkit 0.6.97__py3-none-any.whl → 0.7.39__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.py +21 -23
- cognite_toolkit/_cdf_tk/apps/__init__.py +4 -0
- cognite_toolkit/_cdf_tk/apps/_core_app.py +19 -5
- cognite_toolkit/_cdf_tk/apps/_data_app.py +1 -1
- cognite_toolkit/_cdf_tk/apps/_dev_app.py +86 -0
- cognite_toolkit/_cdf_tk/apps/_download_app.py +693 -25
- cognite_toolkit/_cdf_tk/apps/_dump_app.py +44 -102
- cognite_toolkit/_cdf_tk/apps/_import_app.py +41 -0
- cognite_toolkit/_cdf_tk/apps/_landing_app.py +18 -4
- cognite_toolkit/_cdf_tk/apps/_migrate_app.py +424 -9
- cognite_toolkit/_cdf_tk/apps/_modules_app.py +0 -3
- cognite_toolkit/_cdf_tk/apps/_purge.py +15 -43
- cognite_toolkit/_cdf_tk/apps/_run.py +11 -0
- cognite_toolkit/_cdf_tk/apps/_upload_app.py +45 -6
- cognite_toolkit/_cdf_tk/builders/__init__.py +2 -2
- cognite_toolkit/_cdf_tk/builders/_base.py +28 -42
- cognite_toolkit/_cdf_tk/builders/_raw.py +1 -1
- cognite_toolkit/_cdf_tk/cdf_toml.py +20 -1
- cognite_toolkit/_cdf_tk/client/_toolkit_client.py +32 -12
- cognite_toolkit/_cdf_tk/client/api/infield.py +114 -17
- cognite_toolkit/_cdf_tk/client/api/{canvas.py → legacy/canvas.py} +15 -7
- cognite_toolkit/_cdf_tk/client/api/{charts.py → legacy/charts.py} +1 -1
- cognite_toolkit/_cdf_tk/client/api/{extended_data_modeling.py → legacy/extended_data_modeling.py} +1 -1
- cognite_toolkit/_cdf_tk/client/api/{extended_files.py → legacy/extended_files.py} +2 -2
- cognite_toolkit/_cdf_tk/client/api/{extended_functions.py → legacy/extended_functions.py} +15 -18
- cognite_toolkit/_cdf_tk/client/api/{extended_raw.py → legacy/extended_raw.py} +1 -1
- cognite_toolkit/_cdf_tk/client/api/{extended_timeseries.py → legacy/extended_timeseries.py} +5 -2
- cognite_toolkit/_cdf_tk/client/api/{location_filters.py → legacy/location_filters.py} +1 -1
- cognite_toolkit/_cdf_tk/client/api/legacy/robotics/__init__.py +8 -0
- cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/capabilities.py +1 -1
- cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/data_postprocessing.py +1 -1
- cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/frames.py +1 -1
- cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/locations.py +1 -1
- cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/maps.py +1 -1
- cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/robots.py +2 -2
- cognite_toolkit/_cdf_tk/client/api/{search_config.py → legacy/search_config.py} +5 -1
- cognite_toolkit/_cdf_tk/client/api/migration.py +177 -4
- cognite_toolkit/_cdf_tk/client/api/project.py +9 -8
- cognite_toolkit/_cdf_tk/client/api/search.py +2 -2
- cognite_toolkit/_cdf_tk/client/api/streams.py +88 -0
- cognite_toolkit/_cdf_tk/client/api/three_d.py +384 -0
- cognite_toolkit/_cdf_tk/client/data_classes/api_classes.py +13 -0
- cognite_toolkit/_cdf_tk/client/data_classes/base.py +37 -33
- cognite_toolkit/_cdf_tk/client/data_classes/charts_data.py +95 -213
- cognite_toolkit/_cdf_tk/client/data_classes/infield.py +32 -18
- cognite_toolkit/_cdf_tk/client/data_classes/instance_api.py +18 -13
- cognite_toolkit/_cdf_tk/client/data_classes/legacy/__init__.py +0 -0
- cognite_toolkit/_cdf_tk/client/data_classes/{canvas.py → legacy/canvas.py} +47 -4
- cognite_toolkit/_cdf_tk/client/data_classes/{charts.py → legacy/charts.py} +3 -3
- cognite_toolkit/_cdf_tk/client/data_classes/{migration.py → legacy/migration.py} +10 -2
- cognite_toolkit/_cdf_tk/client/data_classes/streams.py +90 -0
- cognite_toolkit/_cdf_tk/client/data_classes/three_d.py +112 -0
- cognite_toolkit/_cdf_tk/client/testing.py +42 -18
- cognite_toolkit/_cdf_tk/commands/__init__.py +7 -6
- cognite_toolkit/_cdf_tk/commands/_changes.py +3 -42
- cognite_toolkit/_cdf_tk/commands/_download.py +21 -11
- cognite_toolkit/_cdf_tk/commands/_migrate/__init__.py +0 -2
- cognite_toolkit/_cdf_tk/commands/_migrate/command.py +22 -20
- cognite_toolkit/_cdf_tk/commands/_migrate/conversion.py +140 -92
- cognite_toolkit/_cdf_tk/commands/_migrate/creators.py +1 -1
- cognite_toolkit/_cdf_tk/commands/_migrate/data_classes.py +108 -26
- cognite_toolkit/_cdf_tk/commands/_migrate/data_mapper.py +448 -45
- cognite_toolkit/_cdf_tk/commands/_migrate/data_model.py +1 -0
- cognite_toolkit/_cdf_tk/commands/_migrate/default_mappings.py +6 -6
- cognite_toolkit/_cdf_tk/commands/_migrate/issues.py +52 -1
- cognite_toolkit/_cdf_tk/commands/_migrate/migration_io.py +377 -11
- cognite_toolkit/_cdf_tk/commands/_migrate/selectors.py +9 -4
- cognite_toolkit/_cdf_tk/commands/_profile.py +1 -1
- cognite_toolkit/_cdf_tk/commands/_purge.py +36 -39
- cognite_toolkit/_cdf_tk/commands/_questionary_style.py +16 -0
- cognite_toolkit/_cdf_tk/commands/_upload.py +109 -86
- cognite_toolkit/_cdf_tk/commands/about.py +221 -0
- cognite_toolkit/_cdf_tk/commands/auth.py +19 -12
- cognite_toolkit/_cdf_tk/commands/build_cmd.py +16 -62
- cognite_toolkit/_cdf_tk/commands/build_v2/__init__.py +0 -0
- cognite_toolkit/_cdf_tk/commands/build_v2/build_cmd.py +241 -0
- cognite_toolkit/_cdf_tk/commands/build_v2/build_input.py +85 -0
- cognite_toolkit/_cdf_tk/commands/build_v2/build_issues.py +27 -0
- cognite_toolkit/_cdf_tk/commands/clean.py +63 -16
- cognite_toolkit/_cdf_tk/commands/deploy.py +20 -17
- cognite_toolkit/_cdf_tk/commands/dump_resource.py +10 -8
- cognite_toolkit/_cdf_tk/commands/init.py +225 -3
- cognite_toolkit/_cdf_tk/commands/modules.py +20 -44
- cognite_toolkit/_cdf_tk/commands/pull.py +6 -19
- cognite_toolkit/_cdf_tk/commands/resources.py +179 -0
- cognite_toolkit/_cdf_tk/commands/run.py +1 -1
- cognite_toolkit/_cdf_tk/constants.py +20 -1
- cognite_toolkit/_cdf_tk/cruds/__init__.py +19 -5
- cognite_toolkit/_cdf_tk/cruds/_base_cruds.py +14 -70
- cognite_toolkit/_cdf_tk/cruds/_data_cruds.py +10 -19
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/__init__.py +4 -1
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/agent.py +11 -9
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/auth.py +5 -15
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/classic.py +45 -44
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/configuration.py +5 -12
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/data_organization.py +4 -13
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/datamodel.py +206 -67
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/extraction_pipeline.py +6 -18
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/fieldops.py +126 -35
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/file.py +7 -28
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/function.py +23 -30
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/hosted_extractors.py +12 -30
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/industrial_tool.py +4 -8
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/location.py +4 -16
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/migration.py +5 -13
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/raw.py +5 -11
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/relationship.py +3 -8
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/robotics.py +16 -45
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/streams.py +94 -0
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/three_d_model.py +3 -7
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/timeseries.py +5 -15
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/transformation.py +75 -32
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/workflow.py +20 -40
- cognite_toolkit/_cdf_tk/cruds/_worker.py +24 -36
- cognite_toolkit/_cdf_tk/data_classes/_module_toml.py +1 -0
- cognite_toolkit/_cdf_tk/feature_flags.py +16 -36
- cognite_toolkit/_cdf_tk/plugins.py +2 -1
- cognite_toolkit/_cdf_tk/resource_classes/__init__.py +4 -0
- cognite_toolkit/_cdf_tk/resource_classes/capabilities.py +12 -0
- cognite_toolkit/_cdf_tk/resource_classes/functions.py +3 -1
- cognite_toolkit/_cdf_tk/resource_classes/infield_cdm_location_config.py +109 -0
- cognite_toolkit/_cdf_tk/resource_classes/migration.py +8 -17
- cognite_toolkit/_cdf_tk/resource_classes/search_config.py +1 -1
- cognite_toolkit/_cdf_tk/resource_classes/streams.py +29 -0
- cognite_toolkit/_cdf_tk/resource_classes/workflow_version.py +164 -5
- cognite_toolkit/_cdf_tk/storageio/__init__.py +9 -21
- cognite_toolkit/_cdf_tk/storageio/_annotations.py +19 -16
- cognite_toolkit/_cdf_tk/storageio/_applications.py +340 -28
- cognite_toolkit/_cdf_tk/storageio/_asset_centric.py +67 -104
- cognite_toolkit/_cdf_tk/storageio/_base.py +61 -29
- cognite_toolkit/_cdf_tk/storageio/_datapoints.py +276 -20
- cognite_toolkit/_cdf_tk/storageio/_file_content.py +435 -0
- cognite_toolkit/_cdf_tk/storageio/_instances.py +35 -3
- cognite_toolkit/_cdf_tk/storageio/_raw.py +26 -0
- cognite_toolkit/_cdf_tk/storageio/selectors/__init__.py +71 -4
- cognite_toolkit/_cdf_tk/storageio/selectors/_base.py +14 -2
- cognite_toolkit/_cdf_tk/storageio/selectors/_canvas.py +14 -0
- cognite_toolkit/_cdf_tk/storageio/selectors/_charts.py +14 -0
- cognite_toolkit/_cdf_tk/storageio/selectors/_datapoints.py +23 -3
- cognite_toolkit/_cdf_tk/storageio/selectors/_file_content.py +164 -0
- cognite_toolkit/_cdf_tk/storageio/selectors/_three_d.py +34 -0
- cognite_toolkit/_cdf_tk/tk_warnings/other.py +4 -0
- cognite_toolkit/_cdf_tk/tracker.py +2 -2
- cognite_toolkit/_cdf_tk/utils/cdf.py +1 -1
- cognite_toolkit/_cdf_tk/utils/dtype_conversion.py +9 -3
- cognite_toolkit/_cdf_tk/utils/fileio/__init__.py +2 -0
- cognite_toolkit/_cdf_tk/utils/fileio/_base.py +5 -1
- cognite_toolkit/_cdf_tk/utils/fileio/_readers.py +112 -20
- cognite_toolkit/_cdf_tk/utils/fileio/_writers.py +15 -15
- cognite_toolkit/_cdf_tk/utils/http_client/__init__.py +28 -0
- cognite_toolkit/_cdf_tk/utils/http_client/_client.py +285 -18
- cognite_toolkit/_cdf_tk/utils/http_client/_data_classes.py +56 -4
- cognite_toolkit/_cdf_tk/utils/http_client/_data_classes2.py +247 -0
- cognite_toolkit/_cdf_tk/utils/http_client/_tracker.py +5 -2
- cognite_toolkit/_cdf_tk/utils/interactive_select.py +60 -18
- cognite_toolkit/_cdf_tk/utils/sql_parser.py +2 -3
- cognite_toolkit/_cdf_tk/utils/useful_types.py +6 -2
- cognite_toolkit/_cdf_tk/validation.py +83 -1
- 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 +5 -4
- cognite_toolkit/_version.py +1 -1
- cognite_toolkit/config.dev.yaml +13 -0
- {cognite_toolkit-0.6.97.dist-info → cognite_toolkit-0.7.39.dist-info}/METADATA +24 -24
- cognite_toolkit-0.7.39.dist-info/RECORD +322 -0
- cognite_toolkit-0.7.39.dist-info/WHEEL +4 -0
- {cognite_toolkit-0.6.97.dist-info → cognite_toolkit-0.7.39.dist-info}/entry_points.txt +1 -0
- cognite_toolkit/_cdf_tk/client/api/robotics/__init__.py +0 -3
- cognite_toolkit/_cdf_tk/commands/_migrate/canvas.py +0 -201
- cognite_toolkit/_cdf_tk/commands/dump_data.py +0 -489
- cognite_toolkit/_cdf_tk/commands/featureflag.py +0 -27
- cognite_toolkit/_cdf_tk/prototypes/import_app.py +0 -41
- cognite_toolkit/_cdf_tk/utils/table_writers.py +0 -434
- cognite_toolkit-0.6.97.dist-info/RECORD +0 -306
- cognite_toolkit-0.6.97.dist-info/WHEEL +0 -4
- cognite_toolkit-0.6.97.dist-info/licenses/LICENSE +0 -18
- /cognite_toolkit/_cdf_tk/{prototypes/commands → client/api/legacy}/__init__.py +0 -0
- /cognite_toolkit/_cdf_tk/client/api/{dml.py → legacy/dml.py} +0 -0
- /cognite_toolkit/_cdf_tk/client/api/{fixed_transformations.py → legacy/fixed_transformations.py} +0 -0
- /cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/api.py +0 -0
- /cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/utlis.py +0 -0
- /cognite_toolkit/_cdf_tk/client/data_classes/{apm_config_v1.py → legacy/apm_config_v1.py} +0 -0
- /cognite_toolkit/_cdf_tk/client/data_classes/{extendable_cognite_file.py → legacy/extendable_cognite_file.py} +0 -0
- /cognite_toolkit/_cdf_tk/client/data_classes/{extended_filemetadata.py → legacy/extended_filemetadata.py} +0 -0
- /cognite_toolkit/_cdf_tk/client/data_classes/{extended_filemetdata.py → legacy/extended_filemetdata.py} +0 -0
- /cognite_toolkit/_cdf_tk/client/data_classes/{extended_timeseries.py → legacy/extended_timeseries.py} +0 -0
- /cognite_toolkit/_cdf_tk/client/data_classes/{functions.py → legacy/functions.py} +0 -0
- /cognite_toolkit/_cdf_tk/client/data_classes/{graphql_data_models.py → legacy/graphql_data_models.py} +0 -0
- /cognite_toolkit/_cdf_tk/client/data_classes/{instances.py → legacy/instances.py} +0 -0
- /cognite_toolkit/_cdf_tk/client/data_classes/{location_filters.py → legacy/location_filters.py} +0 -0
- /cognite_toolkit/_cdf_tk/client/data_classes/{pending_instances_ids.py → legacy/pending_instances_ids.py} +0 -0
- /cognite_toolkit/_cdf_tk/client/data_classes/{project.py → legacy/project.py} +0 -0
- /cognite_toolkit/_cdf_tk/client/data_classes/{raw.py → legacy/raw.py} +0 -0
- /cognite_toolkit/_cdf_tk/client/data_classes/{robotics.py → legacy/robotics.py} +0 -0
- /cognite_toolkit/_cdf_tk/client/data_classes/{search_config.py → legacy/search_config.py} +0 -0
- /cognite_toolkit/_cdf_tk/client/data_classes/{sequences.py → legacy/sequences.py} +0 -0
- /cognite_toolkit/_cdf_tk/client/data_classes/{streamlit_.py → legacy/streamlit_.py} +0 -0
- /cognite_toolkit/_cdf_tk/{prototypes/commands/import_.py → commands/_import_cmd.py} +0 -0
cognite_toolkit/_cdf.py
CHANGED
|
@@ -25,24 +25,25 @@ from cognite_toolkit._cdf_tk.apps import (
|
|
|
25
25
|
AuthApp,
|
|
26
26
|
CoreApp,
|
|
27
27
|
DataApp,
|
|
28
|
+
DevApp,
|
|
28
29
|
DumpApp,
|
|
30
|
+
ImportApp,
|
|
29
31
|
LandingApp,
|
|
30
32
|
MigrateApp,
|
|
31
33
|
ModulesApp,
|
|
32
34
|
ProfileApp,
|
|
33
|
-
PurgeApp,
|
|
34
35
|
RepoApp,
|
|
35
36
|
RunApp,
|
|
36
37
|
)
|
|
37
38
|
from cognite_toolkit._cdf_tk.cdf_toml import CDFToml
|
|
38
39
|
from cognite_toolkit._cdf_tk.commands import (
|
|
39
|
-
|
|
40
|
+
AboutCommand,
|
|
40
41
|
)
|
|
41
42
|
from cognite_toolkit._cdf_tk.constants import HINT_LEAD_TEXT, URL, USE_SENTRY
|
|
42
43
|
from cognite_toolkit._cdf_tk.exceptions import (
|
|
43
44
|
ToolkitError,
|
|
44
45
|
)
|
|
45
|
-
from cognite_toolkit._cdf_tk.feature_flags import
|
|
46
|
+
from cognite_toolkit._cdf_tk.feature_flags import Flags
|
|
46
47
|
from cognite_toolkit._cdf_tk.plugins import Plugins
|
|
47
48
|
from cognite_toolkit._cdf_tk.tracker import Tracker
|
|
48
49
|
from cognite_toolkit._cdf_tk.utils import (
|
|
@@ -89,15 +90,18 @@ user_app = typer.Typer(**default_typer_kws, hidden=True) # type: ignore [arg-ty
|
|
|
89
90
|
landing_app = LandingApp(**default_typer_kws)
|
|
90
91
|
|
|
91
92
|
_app.add_typer(AuthApp(**default_typer_kws), name="auth")
|
|
93
|
+
_app.add_typer(RepoApp(**default_typer_kws), name="repo")
|
|
94
|
+
|
|
95
|
+
|
|
92
96
|
if Plugins.run.value.is_enabled():
|
|
93
97
|
_app.add_typer(RunApp(**default_typer_kws), name="run")
|
|
94
|
-
_app.add_typer(RepoApp(**default_typer_kws), name="repo")
|
|
95
98
|
|
|
96
99
|
if Plugins.dump.value.is_enabled():
|
|
97
100
|
_app.add_typer(DumpApp(**default_typer_kws), name="dump")
|
|
98
101
|
|
|
99
|
-
|
|
100
|
-
|
|
102
|
+
|
|
103
|
+
if Plugins.dev.value.is_enabled():
|
|
104
|
+
_app.add_typer(DevApp(**default_typer_kws), name="dev")
|
|
101
105
|
|
|
102
106
|
if Flags.PROFILE.is_enabled():
|
|
103
107
|
_app.add_typer(ProfileApp(**default_typer_kws), name="profile")
|
|
@@ -105,22 +109,27 @@ if Flags.PROFILE.is_enabled():
|
|
|
105
109
|
if Flags.MIGRATE.is_enabled():
|
|
106
110
|
_app.add_typer(MigrateApp(**default_typer_kws), name="migrate")
|
|
107
111
|
|
|
108
|
-
if Flags.
|
|
112
|
+
if Flags.IMPORT_CMD.is_enabled():
|
|
113
|
+
_app.add_typer(ImportApp(**default_typer_kws), name="import")
|
|
114
|
+
|
|
115
|
+
if Plugins.data.value.is_enabled():
|
|
109
116
|
_app.add_typer(DataApp(**default_typer_kws), name="data")
|
|
110
117
|
|
|
111
118
|
_app.add_typer(ModulesApp(**default_typer_kws), name="modules")
|
|
112
119
|
_app.command("init")(landing_app.main_init)
|
|
113
120
|
|
|
114
121
|
|
|
122
|
+
@_app.command("about")
|
|
123
|
+
def about() -> None:
|
|
124
|
+
"""Display information about the Toolkit installation and configuration."""
|
|
125
|
+
cmd = AboutCommand()
|
|
126
|
+
cmd.run(lambda: cmd.execute(Path.cwd()))
|
|
127
|
+
|
|
128
|
+
|
|
115
129
|
def app() -> NoReturn:
|
|
116
130
|
# --- Main entry point ---
|
|
117
131
|
# Users run 'app()' directly, but that doesn't allow us to control excepton handling:
|
|
118
132
|
try:
|
|
119
|
-
if FeatureFlag.is_enabled(Flags.IMPORT_CMD):
|
|
120
|
-
from cognite_toolkit._cdf_tk.prototypes.import_app import import_app
|
|
121
|
-
|
|
122
|
-
_app.add_typer(import_app, name="import")
|
|
123
|
-
|
|
124
133
|
_app()
|
|
125
134
|
except ToolkitError as err:
|
|
126
135
|
if "--verbose" in sys.argv:
|
|
@@ -144,17 +153,6 @@ def app() -> NoReturn:
|
|
|
144
153
|
raise SystemExit(0)
|
|
145
154
|
|
|
146
155
|
|
|
147
|
-
@_app.command("collect", hidden=True)
|
|
148
|
-
def collect(
|
|
149
|
-
action: str = typer.Argument(
|
|
150
|
-
help="Whether to explicitly opt-in or opt-out of usage data collection. [opt-in, opt-out]"
|
|
151
|
-
),
|
|
152
|
-
) -> None:
|
|
153
|
-
"""Collect usage information for the toolkit."""
|
|
154
|
-
cmd = CollectCommand()
|
|
155
|
-
cmd.run(lambda: cmd.execute(action)) # type: ignore [arg-type]
|
|
156
|
-
|
|
157
|
-
|
|
158
156
|
@user_app.callback(invoke_without_command=True)
|
|
159
157
|
def user_main(ctx: typer.Context) -> None:
|
|
160
158
|
"""Commands to give information about the toolkit."""
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
from ._auth_app import AuthApp
|
|
2
2
|
from ._core_app import CoreApp
|
|
3
3
|
from ._data_app import DataApp
|
|
4
|
+
from ._dev_app import DevApp
|
|
4
5
|
from ._download_app import DownloadApp
|
|
5
6
|
from ._dump_app import DumpApp
|
|
7
|
+
from ._import_app import ImportApp
|
|
6
8
|
from ._landing_app import LandingApp
|
|
7
9
|
from ._migrate_app import MigrateApp
|
|
8
10
|
from ._modules_app import ModulesApp
|
|
@@ -16,8 +18,10 @@ __all__ = [
|
|
|
16
18
|
"AuthApp",
|
|
17
19
|
"CoreApp",
|
|
18
20
|
"DataApp",
|
|
21
|
+
"DevApp",
|
|
19
22
|
"DownloadApp",
|
|
20
23
|
"DumpApp",
|
|
24
|
+
"ImportApp",
|
|
21
25
|
"LandingApp",
|
|
22
26
|
"MigrateApp",
|
|
23
27
|
"ModulesApp",
|
|
@@ -13,6 +13,7 @@ from rich.panel import Panel
|
|
|
13
13
|
from cognite_toolkit._cdf_tk.cdf_toml import CDFToml
|
|
14
14
|
from cognite_toolkit._cdf_tk.client import ToolkitClient
|
|
15
15
|
from cognite_toolkit._cdf_tk.commands import BuildCommand, CleanCommand, DeployCommand
|
|
16
|
+
from cognite_toolkit._cdf_tk.commands.build_v2.build_cmd import BuildCommand as BuildCommandV2
|
|
16
17
|
from cognite_toolkit._cdf_tk.commands.clean import AVAILABLE_DATA_TYPES
|
|
17
18
|
from cognite_toolkit._cdf_tk.exceptions import ToolkitFileNotFoundError
|
|
18
19
|
from cognite_toolkit._cdf_tk.feature_flags import Flags
|
|
@@ -193,7 +194,6 @@ class CoreApp(typer.Typer):
|
|
|
193
194
|
"--exit-non-zero-on-warning",
|
|
194
195
|
"-w",
|
|
195
196
|
help="Exit with non-zero code on warning.",
|
|
196
|
-
hidden=not Flags.EXIT_ON_WARNING.is_enabled(),
|
|
197
197
|
),
|
|
198
198
|
] = False,
|
|
199
199
|
) -> None:
|
|
@@ -206,10 +206,14 @@ class CoreApp(typer.Typer):
|
|
|
206
206
|
client = EnvironmentVariables.create_from_environment().get_client()
|
|
207
207
|
|
|
208
208
|
print_warning = True
|
|
209
|
-
if
|
|
209
|
+
if exit_on_warning:
|
|
210
210
|
print_warning = False
|
|
211
211
|
|
|
212
|
-
cmd =
|
|
212
|
+
cmd = (
|
|
213
|
+
BuildCommandV2(print_warning=print_warning)
|
|
214
|
+
if Flags.v08.is_enabled()
|
|
215
|
+
else BuildCommand(print_warning=print_warning)
|
|
216
|
+
)
|
|
213
217
|
cmd.run(
|
|
214
218
|
lambda: cmd.execute(
|
|
215
219
|
verbose,
|
|
@@ -223,7 +227,7 @@ class CoreApp(typer.Typer):
|
|
|
223
227
|
)
|
|
224
228
|
)
|
|
225
229
|
|
|
226
|
-
if
|
|
230
|
+
if exit_on_warning and cmd.warning_list:
|
|
227
231
|
print("\n[bold red]Warnings raised during the build process:[/]\n")
|
|
228
232
|
|
|
229
233
|
for warning in cmd.warning_list:
|
|
@@ -345,7 +349,15 @@ class CoreApp(typer.Typer):
|
|
|
345
349
|
list[str] | None,
|
|
346
350
|
typer.Option(
|
|
347
351
|
"--include",
|
|
348
|
-
help=f"Specify which resource types to
|
|
352
|
+
help=f"Specify which resource types to clean, supported types: {AVAILABLE_DATA_TYPES}",
|
|
353
|
+
),
|
|
354
|
+
] = None,
|
|
355
|
+
module: Annotated[
|
|
356
|
+
str | None,
|
|
357
|
+
typer.Option(
|
|
358
|
+
"--module",
|
|
359
|
+
"-m",
|
|
360
|
+
help="Specify name or path of the module to clean",
|
|
349
361
|
),
|
|
350
362
|
] = None,
|
|
351
363
|
verbose: Annotated[
|
|
@@ -368,6 +380,8 @@ class CoreApp(typer.Typer):
|
|
|
368
380
|
build_env_name,
|
|
369
381
|
dry_run,
|
|
370
382
|
include,
|
|
383
|
+
module,
|
|
371
384
|
verbose,
|
|
385
|
+
all_modules=False,
|
|
372
386
|
)
|
|
373
387
|
)
|
|
@@ -18,7 +18,7 @@ class DataApp(typer.Typer):
|
|
|
18
18
|
|
|
19
19
|
@staticmethod
|
|
20
20
|
def main(ctx: typer.Context) -> None:
|
|
21
|
-
"""
|
|
21
|
+
"""Plugin to work with data in CDF"""
|
|
22
22
|
if ctx.invoked_subcommand is None:
|
|
23
23
|
print("Use [bold yellow]cdf data --help[/] for more information.")
|
|
24
24
|
return None
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
from typing import Annotated, Any
|
|
3
|
+
|
|
4
|
+
import typer
|
|
5
|
+
from rich import print
|
|
6
|
+
|
|
7
|
+
from cognite_toolkit._cdf_tk.cdf_toml import CDFToml
|
|
8
|
+
from cognite_toolkit._cdf_tk.commands import ResourcesCommand
|
|
9
|
+
from cognite_toolkit._cdf_tk.feature_flags import FeatureFlag, Flags
|
|
10
|
+
|
|
11
|
+
from ._run import RunApp
|
|
12
|
+
|
|
13
|
+
CDF_TOML = CDFToml.load(Path.cwd())
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class DevApp(typer.Typer):
|
|
17
|
+
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
|
18
|
+
super().__init__(*args, **kwargs)
|
|
19
|
+
self.callback(invoke_without_command=True)(self.main)
|
|
20
|
+
self.add_typer(RunApp(*args, **kwargs), name="run")
|
|
21
|
+
if FeatureFlag.is_enabled(Flags.CREATE):
|
|
22
|
+
self.command("create")(self.create)
|
|
23
|
+
|
|
24
|
+
@staticmethod
|
|
25
|
+
def main(ctx: typer.Context) -> None:
|
|
26
|
+
"""Commands to work with development."""
|
|
27
|
+
if ctx.invoked_subcommand is None:
|
|
28
|
+
print("Use [bold yellow]cdf dev --help[/] for more information.")
|
|
29
|
+
return None
|
|
30
|
+
|
|
31
|
+
def create(
|
|
32
|
+
self,
|
|
33
|
+
kind: Annotated[
|
|
34
|
+
list[str] | None,
|
|
35
|
+
typer.Argument(
|
|
36
|
+
help="The kind of resource to create. eg. container, space, view, datamodel, etc.",
|
|
37
|
+
callback=lambda ctx, param, value: [
|
|
38
|
+
s.strip() for item in value or [] for s in item.split(",") if s.strip()
|
|
39
|
+
],
|
|
40
|
+
),
|
|
41
|
+
] = None,
|
|
42
|
+
module: Annotated[
|
|
43
|
+
str | None,
|
|
44
|
+
typer.Option(
|
|
45
|
+
"--module",
|
|
46
|
+
"-m",
|
|
47
|
+
help="Name of an existing module or a new module to create the resource in.",
|
|
48
|
+
),
|
|
49
|
+
] = None,
|
|
50
|
+
prefix: Annotated[
|
|
51
|
+
str | None,
|
|
52
|
+
typer.Option(
|
|
53
|
+
"--prefix",
|
|
54
|
+
"-p",
|
|
55
|
+
help="The prefix of the resource file to create without suffixes and extensions. "
|
|
56
|
+
"eg. --prefix=my_space. If not provided, a default prefix like 'my_<kind>' will be used.",
|
|
57
|
+
),
|
|
58
|
+
] = None,
|
|
59
|
+
verbose: Annotated[
|
|
60
|
+
bool,
|
|
61
|
+
typer.Option(
|
|
62
|
+
"--verbose",
|
|
63
|
+
"-v",
|
|
64
|
+
help="Turn on to get more verbose output when running the command",
|
|
65
|
+
),
|
|
66
|
+
] = False,
|
|
67
|
+
organization_dir: Annotated[
|
|
68
|
+
Path,
|
|
69
|
+
typer.Option(
|
|
70
|
+
"--organization-dir",
|
|
71
|
+
"-o",
|
|
72
|
+
help="Path to the organization directory",
|
|
73
|
+
),
|
|
74
|
+
] = CDF_TOML.cdf.default_organization_dir,
|
|
75
|
+
) -> None:
|
|
76
|
+
"""create resource YAMLs."""
|
|
77
|
+
cmd = ResourcesCommand()
|
|
78
|
+
cmd.run(
|
|
79
|
+
lambda: cmd.create(
|
|
80
|
+
organization_dir=organization_dir,
|
|
81
|
+
module_name=module,
|
|
82
|
+
kind=kind,
|
|
83
|
+
prefix=prefix,
|
|
84
|
+
verbose=verbose,
|
|
85
|
+
)
|
|
86
|
+
)
|