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.
Files changed (198) hide show
  1. cognite_toolkit/_cdf.py +21 -23
  2. cognite_toolkit/_cdf_tk/apps/__init__.py +4 -0
  3. cognite_toolkit/_cdf_tk/apps/_core_app.py +19 -5
  4. cognite_toolkit/_cdf_tk/apps/_data_app.py +1 -1
  5. cognite_toolkit/_cdf_tk/apps/_dev_app.py +86 -0
  6. cognite_toolkit/_cdf_tk/apps/_download_app.py +693 -25
  7. cognite_toolkit/_cdf_tk/apps/_dump_app.py +44 -102
  8. cognite_toolkit/_cdf_tk/apps/_import_app.py +41 -0
  9. cognite_toolkit/_cdf_tk/apps/_landing_app.py +18 -4
  10. cognite_toolkit/_cdf_tk/apps/_migrate_app.py +424 -9
  11. cognite_toolkit/_cdf_tk/apps/_modules_app.py +0 -3
  12. cognite_toolkit/_cdf_tk/apps/_purge.py +15 -43
  13. cognite_toolkit/_cdf_tk/apps/_run.py +11 -0
  14. cognite_toolkit/_cdf_tk/apps/_upload_app.py +45 -6
  15. cognite_toolkit/_cdf_tk/builders/__init__.py +2 -2
  16. cognite_toolkit/_cdf_tk/builders/_base.py +28 -42
  17. cognite_toolkit/_cdf_tk/builders/_raw.py +1 -1
  18. cognite_toolkit/_cdf_tk/cdf_toml.py +20 -1
  19. cognite_toolkit/_cdf_tk/client/_toolkit_client.py +32 -12
  20. cognite_toolkit/_cdf_tk/client/api/infield.py +114 -17
  21. cognite_toolkit/_cdf_tk/client/api/{canvas.py → legacy/canvas.py} +15 -7
  22. cognite_toolkit/_cdf_tk/client/api/{charts.py → legacy/charts.py} +1 -1
  23. cognite_toolkit/_cdf_tk/client/api/{extended_data_modeling.py → legacy/extended_data_modeling.py} +1 -1
  24. cognite_toolkit/_cdf_tk/client/api/{extended_files.py → legacy/extended_files.py} +2 -2
  25. cognite_toolkit/_cdf_tk/client/api/{extended_functions.py → legacy/extended_functions.py} +15 -18
  26. cognite_toolkit/_cdf_tk/client/api/{extended_raw.py → legacy/extended_raw.py} +1 -1
  27. cognite_toolkit/_cdf_tk/client/api/{extended_timeseries.py → legacy/extended_timeseries.py} +5 -2
  28. cognite_toolkit/_cdf_tk/client/api/{location_filters.py → legacy/location_filters.py} +1 -1
  29. cognite_toolkit/_cdf_tk/client/api/legacy/robotics/__init__.py +8 -0
  30. cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/capabilities.py +1 -1
  31. cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/data_postprocessing.py +1 -1
  32. cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/frames.py +1 -1
  33. cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/locations.py +1 -1
  34. cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/maps.py +1 -1
  35. cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/robots.py +2 -2
  36. cognite_toolkit/_cdf_tk/client/api/{search_config.py → legacy/search_config.py} +5 -1
  37. cognite_toolkit/_cdf_tk/client/api/migration.py +177 -4
  38. cognite_toolkit/_cdf_tk/client/api/project.py +9 -8
  39. cognite_toolkit/_cdf_tk/client/api/search.py +2 -2
  40. cognite_toolkit/_cdf_tk/client/api/streams.py +88 -0
  41. cognite_toolkit/_cdf_tk/client/api/three_d.py +384 -0
  42. cognite_toolkit/_cdf_tk/client/data_classes/api_classes.py +13 -0
  43. cognite_toolkit/_cdf_tk/client/data_classes/base.py +37 -33
  44. cognite_toolkit/_cdf_tk/client/data_classes/charts_data.py +95 -213
  45. cognite_toolkit/_cdf_tk/client/data_classes/infield.py +32 -18
  46. cognite_toolkit/_cdf_tk/client/data_classes/instance_api.py +18 -13
  47. cognite_toolkit/_cdf_tk/client/data_classes/legacy/__init__.py +0 -0
  48. cognite_toolkit/_cdf_tk/client/data_classes/{canvas.py → legacy/canvas.py} +47 -4
  49. cognite_toolkit/_cdf_tk/client/data_classes/{charts.py → legacy/charts.py} +3 -3
  50. cognite_toolkit/_cdf_tk/client/data_classes/{migration.py → legacy/migration.py} +10 -2
  51. cognite_toolkit/_cdf_tk/client/data_classes/streams.py +90 -0
  52. cognite_toolkit/_cdf_tk/client/data_classes/three_d.py +112 -0
  53. cognite_toolkit/_cdf_tk/client/testing.py +42 -18
  54. cognite_toolkit/_cdf_tk/commands/__init__.py +7 -6
  55. cognite_toolkit/_cdf_tk/commands/_changes.py +3 -42
  56. cognite_toolkit/_cdf_tk/commands/_download.py +21 -11
  57. cognite_toolkit/_cdf_tk/commands/_migrate/__init__.py +0 -2
  58. cognite_toolkit/_cdf_tk/commands/_migrate/command.py +22 -20
  59. cognite_toolkit/_cdf_tk/commands/_migrate/conversion.py +140 -92
  60. cognite_toolkit/_cdf_tk/commands/_migrate/creators.py +1 -1
  61. cognite_toolkit/_cdf_tk/commands/_migrate/data_classes.py +108 -26
  62. cognite_toolkit/_cdf_tk/commands/_migrate/data_mapper.py +448 -45
  63. cognite_toolkit/_cdf_tk/commands/_migrate/data_model.py +1 -0
  64. cognite_toolkit/_cdf_tk/commands/_migrate/default_mappings.py +6 -6
  65. cognite_toolkit/_cdf_tk/commands/_migrate/issues.py +52 -1
  66. cognite_toolkit/_cdf_tk/commands/_migrate/migration_io.py +377 -11
  67. cognite_toolkit/_cdf_tk/commands/_migrate/selectors.py +9 -4
  68. cognite_toolkit/_cdf_tk/commands/_profile.py +1 -1
  69. cognite_toolkit/_cdf_tk/commands/_purge.py +36 -39
  70. cognite_toolkit/_cdf_tk/commands/_questionary_style.py +16 -0
  71. cognite_toolkit/_cdf_tk/commands/_upload.py +109 -86
  72. cognite_toolkit/_cdf_tk/commands/about.py +221 -0
  73. cognite_toolkit/_cdf_tk/commands/auth.py +19 -12
  74. cognite_toolkit/_cdf_tk/commands/build_cmd.py +16 -62
  75. cognite_toolkit/_cdf_tk/commands/build_v2/__init__.py +0 -0
  76. cognite_toolkit/_cdf_tk/commands/build_v2/build_cmd.py +241 -0
  77. cognite_toolkit/_cdf_tk/commands/build_v2/build_input.py +85 -0
  78. cognite_toolkit/_cdf_tk/commands/build_v2/build_issues.py +27 -0
  79. cognite_toolkit/_cdf_tk/commands/clean.py +63 -16
  80. cognite_toolkit/_cdf_tk/commands/deploy.py +20 -17
  81. cognite_toolkit/_cdf_tk/commands/dump_resource.py +10 -8
  82. cognite_toolkit/_cdf_tk/commands/init.py +225 -3
  83. cognite_toolkit/_cdf_tk/commands/modules.py +20 -44
  84. cognite_toolkit/_cdf_tk/commands/pull.py +6 -19
  85. cognite_toolkit/_cdf_tk/commands/resources.py +179 -0
  86. cognite_toolkit/_cdf_tk/commands/run.py +1 -1
  87. cognite_toolkit/_cdf_tk/constants.py +20 -1
  88. cognite_toolkit/_cdf_tk/cruds/__init__.py +19 -5
  89. cognite_toolkit/_cdf_tk/cruds/_base_cruds.py +14 -70
  90. cognite_toolkit/_cdf_tk/cruds/_data_cruds.py +10 -19
  91. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/__init__.py +4 -1
  92. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/agent.py +11 -9
  93. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/auth.py +5 -15
  94. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/classic.py +45 -44
  95. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/configuration.py +5 -12
  96. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/data_organization.py +4 -13
  97. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/datamodel.py +206 -67
  98. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/extraction_pipeline.py +6 -18
  99. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/fieldops.py +126 -35
  100. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/file.py +7 -28
  101. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/function.py +23 -30
  102. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/hosted_extractors.py +12 -30
  103. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/industrial_tool.py +4 -8
  104. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/location.py +4 -16
  105. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/migration.py +5 -13
  106. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/raw.py +5 -11
  107. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/relationship.py +3 -8
  108. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/robotics.py +16 -45
  109. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/streams.py +94 -0
  110. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/three_d_model.py +3 -7
  111. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/timeseries.py +5 -15
  112. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/transformation.py +75 -32
  113. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/workflow.py +20 -40
  114. cognite_toolkit/_cdf_tk/cruds/_worker.py +24 -36
  115. cognite_toolkit/_cdf_tk/data_classes/_module_toml.py +1 -0
  116. cognite_toolkit/_cdf_tk/feature_flags.py +16 -36
  117. cognite_toolkit/_cdf_tk/plugins.py +2 -1
  118. cognite_toolkit/_cdf_tk/resource_classes/__init__.py +4 -0
  119. cognite_toolkit/_cdf_tk/resource_classes/capabilities.py +12 -0
  120. cognite_toolkit/_cdf_tk/resource_classes/functions.py +3 -1
  121. cognite_toolkit/_cdf_tk/resource_classes/infield_cdm_location_config.py +109 -0
  122. cognite_toolkit/_cdf_tk/resource_classes/migration.py +8 -17
  123. cognite_toolkit/_cdf_tk/resource_classes/search_config.py +1 -1
  124. cognite_toolkit/_cdf_tk/resource_classes/streams.py +29 -0
  125. cognite_toolkit/_cdf_tk/resource_classes/workflow_version.py +164 -5
  126. cognite_toolkit/_cdf_tk/storageio/__init__.py +9 -21
  127. cognite_toolkit/_cdf_tk/storageio/_annotations.py +19 -16
  128. cognite_toolkit/_cdf_tk/storageio/_applications.py +340 -28
  129. cognite_toolkit/_cdf_tk/storageio/_asset_centric.py +67 -104
  130. cognite_toolkit/_cdf_tk/storageio/_base.py +61 -29
  131. cognite_toolkit/_cdf_tk/storageio/_datapoints.py +276 -20
  132. cognite_toolkit/_cdf_tk/storageio/_file_content.py +435 -0
  133. cognite_toolkit/_cdf_tk/storageio/_instances.py +35 -3
  134. cognite_toolkit/_cdf_tk/storageio/_raw.py +26 -0
  135. cognite_toolkit/_cdf_tk/storageio/selectors/__init__.py +71 -4
  136. cognite_toolkit/_cdf_tk/storageio/selectors/_base.py +14 -2
  137. cognite_toolkit/_cdf_tk/storageio/selectors/_canvas.py +14 -0
  138. cognite_toolkit/_cdf_tk/storageio/selectors/_charts.py +14 -0
  139. cognite_toolkit/_cdf_tk/storageio/selectors/_datapoints.py +23 -3
  140. cognite_toolkit/_cdf_tk/storageio/selectors/_file_content.py +164 -0
  141. cognite_toolkit/_cdf_tk/storageio/selectors/_three_d.py +34 -0
  142. cognite_toolkit/_cdf_tk/tk_warnings/other.py +4 -0
  143. cognite_toolkit/_cdf_tk/tracker.py +2 -2
  144. cognite_toolkit/_cdf_tk/utils/cdf.py +1 -1
  145. cognite_toolkit/_cdf_tk/utils/dtype_conversion.py +9 -3
  146. cognite_toolkit/_cdf_tk/utils/fileio/__init__.py +2 -0
  147. cognite_toolkit/_cdf_tk/utils/fileio/_base.py +5 -1
  148. cognite_toolkit/_cdf_tk/utils/fileio/_readers.py +112 -20
  149. cognite_toolkit/_cdf_tk/utils/fileio/_writers.py +15 -15
  150. cognite_toolkit/_cdf_tk/utils/http_client/__init__.py +28 -0
  151. cognite_toolkit/_cdf_tk/utils/http_client/_client.py +285 -18
  152. cognite_toolkit/_cdf_tk/utils/http_client/_data_classes.py +56 -4
  153. cognite_toolkit/_cdf_tk/utils/http_client/_data_classes2.py +247 -0
  154. cognite_toolkit/_cdf_tk/utils/http_client/_tracker.py +5 -2
  155. cognite_toolkit/_cdf_tk/utils/interactive_select.py +60 -18
  156. cognite_toolkit/_cdf_tk/utils/sql_parser.py +2 -3
  157. cognite_toolkit/_cdf_tk/utils/useful_types.py +6 -2
  158. cognite_toolkit/_cdf_tk/validation.py +83 -1
  159. cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml +1 -1
  160. cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml +1 -1
  161. cognite_toolkit/_resources/cdf.toml +5 -4
  162. cognite_toolkit/_version.py +1 -1
  163. cognite_toolkit/config.dev.yaml +13 -0
  164. {cognite_toolkit-0.6.97.dist-info → cognite_toolkit-0.7.39.dist-info}/METADATA +24 -24
  165. cognite_toolkit-0.7.39.dist-info/RECORD +322 -0
  166. cognite_toolkit-0.7.39.dist-info/WHEEL +4 -0
  167. {cognite_toolkit-0.6.97.dist-info → cognite_toolkit-0.7.39.dist-info}/entry_points.txt +1 -0
  168. cognite_toolkit/_cdf_tk/client/api/robotics/__init__.py +0 -3
  169. cognite_toolkit/_cdf_tk/commands/_migrate/canvas.py +0 -201
  170. cognite_toolkit/_cdf_tk/commands/dump_data.py +0 -489
  171. cognite_toolkit/_cdf_tk/commands/featureflag.py +0 -27
  172. cognite_toolkit/_cdf_tk/prototypes/import_app.py +0 -41
  173. cognite_toolkit/_cdf_tk/utils/table_writers.py +0 -434
  174. cognite_toolkit-0.6.97.dist-info/RECORD +0 -306
  175. cognite_toolkit-0.6.97.dist-info/WHEEL +0 -4
  176. cognite_toolkit-0.6.97.dist-info/licenses/LICENSE +0 -18
  177. /cognite_toolkit/_cdf_tk/{prototypes/commands → client/api/legacy}/__init__.py +0 -0
  178. /cognite_toolkit/_cdf_tk/client/api/{dml.py → legacy/dml.py} +0 -0
  179. /cognite_toolkit/_cdf_tk/client/api/{fixed_transformations.py → legacy/fixed_transformations.py} +0 -0
  180. /cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/api.py +0 -0
  181. /cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/utlis.py +0 -0
  182. /cognite_toolkit/_cdf_tk/client/data_classes/{apm_config_v1.py → legacy/apm_config_v1.py} +0 -0
  183. /cognite_toolkit/_cdf_tk/client/data_classes/{extendable_cognite_file.py → legacy/extendable_cognite_file.py} +0 -0
  184. /cognite_toolkit/_cdf_tk/client/data_classes/{extended_filemetadata.py → legacy/extended_filemetadata.py} +0 -0
  185. /cognite_toolkit/_cdf_tk/client/data_classes/{extended_filemetdata.py → legacy/extended_filemetdata.py} +0 -0
  186. /cognite_toolkit/_cdf_tk/client/data_classes/{extended_timeseries.py → legacy/extended_timeseries.py} +0 -0
  187. /cognite_toolkit/_cdf_tk/client/data_classes/{functions.py → legacy/functions.py} +0 -0
  188. /cognite_toolkit/_cdf_tk/client/data_classes/{graphql_data_models.py → legacy/graphql_data_models.py} +0 -0
  189. /cognite_toolkit/_cdf_tk/client/data_classes/{instances.py → legacy/instances.py} +0 -0
  190. /cognite_toolkit/_cdf_tk/client/data_classes/{location_filters.py → legacy/location_filters.py} +0 -0
  191. /cognite_toolkit/_cdf_tk/client/data_classes/{pending_instances_ids.py → legacy/pending_instances_ids.py} +0 -0
  192. /cognite_toolkit/_cdf_tk/client/data_classes/{project.py → legacy/project.py} +0 -0
  193. /cognite_toolkit/_cdf_tk/client/data_classes/{raw.py → legacy/raw.py} +0 -0
  194. /cognite_toolkit/_cdf_tk/client/data_classes/{robotics.py → legacy/robotics.py} +0 -0
  195. /cognite_toolkit/_cdf_tk/client/data_classes/{search_config.py → legacy/search_config.py} +0 -0
  196. /cognite_toolkit/_cdf_tk/client/data_classes/{sequences.py → legacy/sequences.py} +0 -0
  197. /cognite_toolkit/_cdf_tk/client/data_classes/{streamlit_.py → legacy/streamlit_.py} +0 -0
  198. /cognite_toolkit/_cdf_tk/{prototypes/commands/import_.py → commands/_import_cmd.py} +0 -0
@@ -4,34 +4,51 @@ from typing import Annotated, Any
4
4
 
5
5
  import questionary
6
6
  import typer
7
+ from cognite.client.data_classes import Annotation
7
8
  from cognite.client.data_classes.data_modeling import ContainerId
8
9
 
9
10
  from cognite_toolkit._cdf_tk.client import ToolkitClient
10
- from cognite_toolkit._cdf_tk.commands import (
11
- MigrationCanvasCommand,
12
- MigrationPrepareCommand,
13
- )
11
+ from cognite_toolkit._cdf_tk.commands import MigrationPrepareCommand
14
12
  from cognite_toolkit._cdf_tk.commands._migrate import MigrationCommand
15
13
  from cognite_toolkit._cdf_tk.commands._migrate.creators import (
16
14
  InfieldV2ConfigCreator,
17
15
  InstanceSpaceCreator,
18
16
  SourceSystemCreator,
19
17
  )
20
- from cognite_toolkit._cdf_tk.commands._migrate.data_mapper import AssetCentricMapper
18
+ from cognite_toolkit._cdf_tk.commands._migrate.data_mapper import (
19
+ AssetCentricMapper,
20
+ CanvasMapper,
21
+ ChartMapper,
22
+ ThreeDAssetMapper,
23
+ ThreeDMapper,
24
+ )
21
25
  from cognite_toolkit._cdf_tk.commands._migrate.migration_io import (
26
+ AnnotationMigrationIO,
22
27
  AssetCentricMigrationIO,
28
+ ThreeDAssetMappingMigrationIO,
29
+ ThreeDMigrationIO,
23
30
  )
24
31
  from cognite_toolkit._cdf_tk.commands._migrate.selectors import (
25
32
  AssetCentricMigrationSelector,
26
33
  MigrateDataSetSelector,
27
34
  MigrationCSVFileSelector,
28
35
  )
36
+ from cognite_toolkit._cdf_tk.storageio import CanvasIO, ChartIO
37
+ from cognite_toolkit._cdf_tk.storageio.selectors import (
38
+ CanvasExternalIdSelector,
39
+ ChartExternalIdSelector,
40
+ ThreeDModelIdSelector,
41
+ )
29
42
  from cognite_toolkit._cdf_tk.utils.auth import EnvironmentVariables
30
43
  from cognite_toolkit._cdf_tk.utils.cli_args import parse_view_str
31
44
  from cognite_toolkit._cdf_tk.utils.interactive_select import (
32
45
  AssetInteractiveSelect,
33
46
  DataModelingSelect,
47
+ FileMetadataInteractiveSelect,
48
+ InteractiveCanvasSelect,
49
+ InteractiveChartSelect,
34
50
  ResourceViewMappingInteractiveSelect,
51
+ ThreeDInteractiveSelect,
35
52
  )
36
53
  from cognite_toolkit._cdf_tk.utils.useful_types import AssetCentricKind
37
54
 
@@ -49,7 +66,11 @@ class MigrateApp(typer.Typer):
49
66
  self.command("events")(self.events)
50
67
  self.command("timeseries")(self.timeseries)
51
68
  self.command("files")(self.files)
69
+ self.command("annotations")(self.annotations)
52
70
  self.command("canvas")(self.canvas)
71
+ self.command("charts")(self.charts)
72
+ self.command("3d")(self.three_d)
73
+ self.command("3d-mappings")(self.three_d_asset_mapping)
53
74
  # Uncomment when infield v2 config migration is ready
54
75
  # self.command("infield-configs")(self.infield_configs)
55
76
 
@@ -694,6 +715,149 @@ class MigrateApp(typer.Typer):
694
715
  )
695
716
  )
696
717
 
718
+ @classmethod
719
+ def annotations(
720
+ cls,
721
+ ctx: typer.Context,
722
+ mapping_file: Annotated[
723
+ Path | None,
724
+ typer.Option(
725
+ "--mapping-file",
726
+ "-m",
727
+ help="Path to the mapping file that contains the mapping from Annotations to CogniteDiagramAnnotation. "
728
+ "This file is expected to have the following columns: [id, space, externalId, ingestionView].",
729
+ ),
730
+ ] = None,
731
+ data_set_id: Annotated[
732
+ str | None,
733
+ typer.Option(
734
+ "--data-set-id",
735
+ "-s",
736
+ help="The data set ID to select for the annotations to migrate. If not provided and the mapping file is not provided, "
737
+ "an interactive selection will be performed to select the data set to migrate annotations from.",
738
+ ),
739
+ ] = None,
740
+ instance_space: Annotated[
741
+ str | None,
742
+ typer.Option(
743
+ "--instance-space",
744
+ "-i",
745
+ help="The instance space to use for the migrated annotations. Required when using --data-set-id.",
746
+ ),
747
+ ] = None,
748
+ asset_annotation_mapping: Annotated[
749
+ str | None,
750
+ typer.Option(
751
+ "--asset-annotation-mapping",
752
+ "-a",
753
+ help="The ingestion mapping to use for asset-linked annotations. If not provided, "
754
+ "the default mapping (cdf_asset_annotations_mapping) will be used.",
755
+ ),
756
+ ] = None,
757
+ file_annotation_mapping: Annotated[
758
+ str | None,
759
+ typer.Option(
760
+ "--file-annotation-mapping",
761
+ "-f",
762
+ help="The ingestion mapping to use for file-linked annotations. If not provided, "
763
+ "the default mapping (cdf_file_annotations_mapping) will be used.",
764
+ ),
765
+ ] = None,
766
+ log_dir: Annotated[
767
+ Path,
768
+ typer.Option(
769
+ "--log-dir",
770
+ "-l",
771
+ help="Path to the directory where logs will be stored. If the directory does not exist, it will be created.",
772
+ ),
773
+ ] = Path(f"migration_logs_{TODAY!s}"),
774
+ dry_run: Annotated[
775
+ bool,
776
+ typer.Option(
777
+ "--dry-run",
778
+ "-d",
779
+ help="If set, the migration will not be executed, but only a report of what would be done is printed.",
780
+ ),
781
+ ] = False,
782
+ verbose: Annotated[
783
+ bool,
784
+ typer.Option(
785
+ "--verbose",
786
+ "-v",
787
+ help="Turn on to get more verbose output when running the command",
788
+ ),
789
+ ] = False,
790
+ ) -> None:
791
+ """Migrate Annotations to CogniteDiagramAnnotation edges in data modeling.
792
+
793
+ Annotations are diagram annotations that link assets or files to other resources. This command
794
+ migrates them to edges in the data modeling space, preserving the relationships and metadata.
795
+ """
796
+ client = EnvironmentVariables.create_from_environment().get_client()
797
+
798
+ if data_set_id is not None and mapping_file is not None:
799
+ raise typer.BadParameter("Cannot specify both data_set_id and mapping_file")
800
+ elif mapping_file is not None:
801
+ selected: AssetCentricMigrationSelector = MigrationCSVFileSelector(
802
+ datafile=mapping_file, kind="Annotations"
803
+ )
804
+ annotation_io = AnnotationMigrationIO(client)
805
+ elif data_set_id is not None:
806
+ if instance_space is None:
807
+ raise typer.BadParameter("--instance-space is required when using --data-set-id")
808
+ selected = MigrateDataSetSelector(data_set_external_id=data_set_id, kind="Annotations")
809
+ annotation_io = AnnotationMigrationIO(
810
+ client,
811
+ instance_space=instance_space,
812
+ default_asset_annotation_mapping=asset_annotation_mapping,
813
+ default_file_annotation_mapping=file_annotation_mapping,
814
+ )
815
+ else:
816
+ # Interactive selection
817
+ selector = FileMetadataInteractiveSelect(client, "migrate")
818
+ selected_data_set_id = selector.select_data_set(allow_empty=False)
819
+ dm_selector = DataModelingSelect(client, "migrate")
820
+ selected_instance_space = dm_selector.select_instance_space(
821
+ multiselect=False,
822
+ message="In which instance space do you want to create the annotations?",
823
+ include_empty=True,
824
+ )
825
+ if selected_instance_space is None:
826
+ raise typer.Abort()
827
+ asset_annotations_selector = ResourceViewMappingInteractiveSelect(client, "migrate asset annotations")
828
+ asset_annotation_mapping = asset_annotations_selector.select_resource_view_mapping(
829
+ resource_type="assetAnnotation",
830
+ ).external_id
831
+ file_annotations_selector = ResourceViewMappingInteractiveSelect(client, "migrate file annotations")
832
+ file_annotation_mapping = file_annotations_selector.select_resource_view_mapping(
833
+ resource_type="fileAnnotation",
834
+ ).external_id
835
+
836
+ selected = MigrateDataSetSelector(data_set_external_id=selected_data_set_id, kind="Annotations")
837
+ annotation_io = AnnotationMigrationIO(
838
+ client,
839
+ instance_space=selected_instance_space,
840
+ default_asset_annotation_mapping=asset_annotation_mapping,
841
+ default_file_annotation_mapping=file_annotation_mapping,
842
+ )
843
+
844
+ dry_run = questionary.confirm("Do you want to perform a dry run?", default=dry_run).ask()
845
+ verbose = questionary.confirm("Do you want verbose output?", default=verbose).ask()
846
+ if any(res is None for res in [dry_run, verbose]):
847
+ raise typer.Abort()
848
+
849
+ cmd = MigrationCommand()
850
+ cmd.run(
851
+ lambda: cmd.migrate(
852
+ selected=selected,
853
+ data=annotation_io,
854
+ mapper=AssetCentricMapper[Annotation](client),
855
+ log_dir=log_dir,
856
+ dry_run=dry_run,
857
+ verbose=verbose,
858
+ )
859
+ )
860
+
697
861
  @staticmethod
698
862
  def canvas(
699
863
  ctx: typer.Context,
@@ -704,6 +868,23 @@ class MigrateApp(typer.Typer):
704
868
  "performed to select the Canvas to migrate."
705
869
  ),
706
870
  ] = None,
871
+ skip_on_missing_ref: Annotated[
872
+ bool,
873
+ typer.Option(
874
+ "--skip-on-missing-ref",
875
+ "-s",
876
+ help="If set, the migration will skip Canvases that reference resources that have not been migrated to data modeling. "
877
+ "If not set, the migration will continue but the result will exclude the missing references.",
878
+ ),
879
+ ] = False,
880
+ log_dir: Annotated[
881
+ Path,
882
+ typer.Option(
883
+ "--log-dir",
884
+ "-l",
885
+ help="Path to the directory where migration logs will be stored.",
886
+ ),
887
+ ] = Path(f"migration_logs_{TODAY}"),
707
888
  dry_run: Annotated[
708
889
  bool,
709
890
  typer.Option(
@@ -729,12 +910,246 @@ class MigrateApp(typer.Typer):
729
910
  is populated with the mapping from Asset-Centric resources to the new data modeling resources.
730
911
  """
731
912
  client = EnvironmentVariables.create_from_environment().get_client()
913
+ if external_id is None:
914
+ interactive = InteractiveCanvasSelect(client)
915
+ external_id = interactive.select_external_ids()
916
+ log_dir = questionary.path("Specify log directory for migration logs:", default=str(log_dir)).ask()
917
+ dry_run = questionary.confirm("Do you want to perform a dry run?", default=dry_run).ask()
918
+ verbose = questionary.confirm("Do you want verbose output?", default=verbose).ask()
919
+ if any(res is None for res in [log_dir, dry_run, verbose]):
920
+ raise typer.Abort()
921
+ log_dir = Path(log_dir)
732
922
 
733
- cmd = MigrationCanvasCommand()
923
+ cmd = MigrationCommand()
924
+ selector = CanvasExternalIdSelector(external_ids=tuple(external_id))
734
925
  cmd.run(
735
- lambda: cmd.migrate_canvas(
736
- client,
737
- external_ids=external_id,
926
+ lambda: cmd.migrate(
927
+ selected=selector,
928
+ data=CanvasIO(client, exclude_existing_version=True),
929
+ mapper=CanvasMapper(client, dry_run=dry_run, skip_on_missing_ref=skip_on_missing_ref),
930
+ log_dir=log_dir,
931
+ dry_run=dry_run,
932
+ verbose=verbose,
933
+ )
934
+ )
935
+
936
+ @staticmethod
937
+ def charts(
938
+ ctx: typer.Context,
939
+ external_id: Annotated[
940
+ list[str] | None,
941
+ typer.Argument(
942
+ help="The external ID of the Chart to migrate. If not provided, an interactive selection will be "
943
+ "performed to select the Charts to migrate."
944
+ ),
945
+ ] = None,
946
+ log_dir: Annotated[
947
+ Path,
948
+ typer.Option(
949
+ "--log-dir",
950
+ "-l",
951
+ help="Path to the directory where migration logs will be stored.",
952
+ ),
953
+ ] = Path(f"migration_logs_{TODAY}"),
954
+ dry_run: Annotated[
955
+ bool,
956
+ typer.Option(
957
+ "--dry-run",
958
+ "-d",
959
+ help="If set, the migration will not be executed, but only a report of "
960
+ "what would be done is printed. This is useful for checking that all time series referenced by the Charts "
961
+ "have been migrated to the new data modeling resources in CDF.",
962
+ ),
963
+ ] = False,
964
+ verbose: Annotated[
965
+ bool,
966
+ typer.Option(
967
+ "--verbose",
968
+ "-v",
969
+ help="Turn on to get more verbose output when running the command",
970
+ ),
971
+ ] = False,
972
+ ) -> None:
973
+ """Migrate Charts from time series references to data modeling in CDF.
974
+
975
+ This command expects that the CogniteMigration data model is already deployed, and that the Mapping view
976
+ is populated with the mapping from time series to the new data modeling resources.
977
+ """
978
+ client = EnvironmentVariables.create_from_environment().get_client()
979
+
980
+ selected_external_ids: list[str]
981
+ if external_id:
982
+ selected_external_ids = external_id
983
+ else:
984
+ selected_external_ids = InteractiveChartSelect(client).select_external_ids()
985
+
986
+ cmd = MigrationCommand()
987
+ cmd.run(
988
+ lambda: cmd.migrate(
989
+ selected=ChartExternalIdSelector(external_ids=tuple(selected_external_ids)),
990
+ data=ChartIO(client),
991
+ mapper=ChartMapper(client),
992
+ log_dir=log_dir,
993
+ dry_run=dry_run,
994
+ verbose=verbose,
995
+ )
996
+ )
997
+
998
+ @staticmethod
999
+ def three_d(
1000
+ ctx: typer.Context,
1001
+ id: Annotated[
1002
+ list[int] | None,
1003
+ typer.Argument(
1004
+ help="The ID of the 3D Model to migrate. If not provided, an interactive selection will be "
1005
+ "performed to select the 3D Models to migrate."
1006
+ ),
1007
+ ] = None,
1008
+ log_dir: Annotated[
1009
+ Path,
1010
+ typer.Option(
1011
+ "--log-dir",
1012
+ "-l",
1013
+ help="Path to the directory where migration logs will be stored.",
1014
+ ),
1015
+ ] = Path(f"migration_logs_{TODAY}"),
1016
+ dry_run: Annotated[
1017
+ bool,
1018
+ typer.Option(
1019
+ "--dry-run",
1020
+ "-d",
1021
+ help="If set, the migration will not be executed, but only a report of "
1022
+ "what would be done is printed. This is useful for checking that all resources referenced by the 3D Models "
1023
+ "have been migrated to the new data modeling resources in CDF.",
1024
+ ),
1025
+ ] = False,
1026
+ verbose: Annotated[
1027
+ bool,
1028
+ typer.Option(
1029
+ "--verbose",
1030
+ "-v",
1031
+ help="Turn on to get more verbose output when running the command",
1032
+ ),
1033
+ ] = False,
1034
+ ) -> None:
1035
+ """Migrate 3D Models from Asset-Centric to data modeling in CDF.
1036
+
1037
+ This command expects that the CogniteMigration data model is already deployed, and that the Mapping view
1038
+ is populated with the mapping from Asset-Centric resources to the new data modeling resources.
1039
+ """
1040
+ client = EnvironmentVariables.create_from_environment().get_client()
1041
+ selected_ids: list[int]
1042
+ if id:
1043
+ selected_ids = id
1044
+ else:
1045
+ selected_models = ThreeDInteractiveSelect(client, "migrate").select_three_d_models("classic")
1046
+ selected_ids = [model.id for model in selected_models]
1047
+
1048
+ cmd = MigrationCommand()
1049
+ cmd.run(
1050
+ lambda: cmd.migrate(
1051
+ selected=ThreeDModelIdSelector(ids=tuple(selected_ids)),
1052
+ data=ThreeDMigrationIO(client),
1053
+ mapper=ThreeDMapper(client),
1054
+ log_dir=log_dir,
1055
+ dry_run=dry_run,
1056
+ verbose=verbose,
1057
+ )
1058
+ )
1059
+
1060
+ @staticmethod
1061
+ def three_d_asset_mapping(
1062
+ ctx: typer.Context,
1063
+ model_id: Annotated[
1064
+ list[int] | None,
1065
+ typer.Argument(
1066
+ help="The IDs of the 3D model to migrate asset mappings for. If not provided, an interactive selection will be "
1067
+ "performed to select the."
1068
+ ),
1069
+ ] = None,
1070
+ object_3D_space: Annotated[
1071
+ str | None,
1072
+ typer.Option(
1073
+ "--object-3d-space",
1074
+ "-o",
1075
+ help="The instance space to ceate the 3D object nodes in.",
1076
+ ),
1077
+ ] = None,
1078
+ cad_node_space: Annotated[
1079
+ str | None,
1080
+ typer.Option(
1081
+ "--cad-node-space",
1082
+ "-c",
1083
+ help="The instance space to create the CAD node nodes in.",
1084
+ ),
1085
+ ] = None,
1086
+ log_dir: Annotated[
1087
+ Path,
1088
+ typer.Option(
1089
+ "--log-dir",
1090
+ "-l",
1091
+ help="Path to the directory where migration logs will be stored.",
1092
+ ),
1093
+ ] = Path(f"migration_logs_{TODAY}"),
1094
+ dry_run: Annotated[
1095
+ bool,
1096
+ typer.Option(
1097
+ "--dry-run",
1098
+ "-d",
1099
+ help="If set, the migration will not be executed, but only a report of what would be done is printed.",
1100
+ ),
1101
+ ] = False,
1102
+ verbose: Annotated[
1103
+ bool,
1104
+ typer.Option(
1105
+ "--verbose",
1106
+ "-v",
1107
+ help="Turn on to get more verbose output when running the command",
1108
+ ),
1109
+ ] = False,
1110
+ ) -> None:
1111
+ """Migrate 3D Model Asset Mappings from Asset-Centric to data modeling in CDF.
1112
+
1113
+ This command expects that the selected 3D model has already been migrated to data modeling.
1114
+ """
1115
+ client = EnvironmentVariables.create_from_environment().get_client()
1116
+ selected_ids: list[int]
1117
+ if model_id is not None:
1118
+ selected_ids = model_id
1119
+ else:
1120
+ # Interactive selection
1121
+ selected_models = ThreeDInteractiveSelect(client, "migrate").select_three_d_models("dm")
1122
+ selected_ids = [model.id for model in selected_models]
1123
+ space_selector = DataModelingSelect(client, "migrate")
1124
+ object_3D_space = space_selector.select_instance_space(
1125
+ multiselect=False,
1126
+ message="In which instance space do you want to create the 3D Object nodes?",
1127
+ include_empty=False,
1128
+ )
1129
+ cad_node_space = space_selector.select_instance_space(
1130
+ multiselect=False,
1131
+ message="In which instance space do you want to create the CAD Node nodes?",
1132
+ include_empty=False,
1133
+ )
1134
+ dry_run = questionary.confirm("Do you want to perform a dry run?", default=dry_run).ask()
1135
+ verbose = questionary.confirm("Do you want verbose output?", default=verbose).ask()
1136
+ if any(res is None for res in [dry_run, verbose]):
1137
+ raise typer.Abort()
1138
+
1139
+ if object_3D_space is None or cad_node_space is None:
1140
+ raise typer.BadParameter(
1141
+ "--object-3d-space and --cad-node-space are required when specifying IDs directly."
1142
+ )
1143
+
1144
+ cmd = MigrationCommand()
1145
+ cmd.run(
1146
+ lambda: cmd.migrate(
1147
+ selected=ThreeDModelIdSelector(ids=tuple(selected_ids)),
1148
+ data=ThreeDAssetMappingMigrationIO(
1149
+ client, object_3D_space=object_3D_space, cad_node_space=cad_node_space
1150
+ ),
1151
+ mapper=ThreeDAssetMapper(client),
1152
+ log_dir=log_dir,
738
1153
  dry_run=dry_run,
739
1154
  verbose=verbose,
740
1155
  )
@@ -6,7 +6,6 @@ from rich import print
6
6
 
7
7
  from cognite_toolkit._cdf_tk.cdf_toml import CDFToml
8
8
  from cognite_toolkit._cdf_tk.commands import ModulesCommand, PullCommand
9
- from cognite_toolkit._cdf_tk.feature_flags import Flags
10
9
  from cognite_toolkit._cdf_tk.utils.auth import EnvironmentVariables
11
10
  from cognite_toolkit._version import __version__
12
11
 
@@ -58,7 +57,6 @@ class ModulesApp(typer.Typer):
58
57
  "--library-url",
59
58
  "-u",
60
59
  help="URL of the library to add to the project.",
61
- hidden=not Flags.EXTERNAL_LIBRARIES.is_enabled(),
62
60
  ),
63
61
  ] = None,
64
62
  library_checksum: Annotated[
@@ -67,7 +65,6 @@ class ModulesApp(typer.Typer):
67
65
  "--library-checksum",
68
66
  "-c",
69
67
  help="Checksum of the library to add to the project.",
70
- hidden=not Flags.EXTERNAL_LIBRARIES.is_enabled(),
71
68
  ),
72
69
  ] = None,
73
70
  verbose: Annotated[
@@ -8,7 +8,6 @@ from rich import print
8
8
 
9
9
  from cognite_toolkit._cdf_tk.commands import PurgeCommand
10
10
  from cognite_toolkit._cdf_tk.exceptions import ToolkitValueError
11
- from cognite_toolkit._cdf_tk.feature_flags import Flags
12
11
  from cognite_toolkit._cdf_tk.storageio.selectors import (
13
12
  InstanceFileSelector,
14
13
  InstanceSelector,
@@ -31,8 +30,7 @@ class PurgeApp(typer.Typer):
31
30
  self.callback(invoke_without_command=True)(self.main)
32
31
  self.command("dataset")(self.purge_dataset)
33
32
  self.command("space")(self.purge_space)
34
- if Flags.PURGE_INSTANCES.is_enabled() or Flags.v07.is_enabled():
35
- self.command("instances")(self.purge_instances)
33
+ self.command("instances")(self.purge_instances)
36
34
 
37
35
  def main(self, ctx: typer.Context) -> None:
38
36
  """Commands deleting data from Cognite Data Fusion."""
@@ -48,21 +46,11 @@ class PurgeApp(typer.Typer):
48
46
  help="External id of the dataset to purge. If not provided, interactive mode will be used.",
49
47
  ),
50
48
  ] = None,
51
- include_dataset: Annotated[
52
- bool,
53
- typer.Option(
54
- "--include-dataset",
55
- "-i",
56
- help="Whether to archive the dataset itself after purging its contents.",
57
- hidden=Flags.v07.is_enabled(),
58
- ),
59
- ] = False,
60
49
  archive_dataset: Annotated[
61
50
  bool,
62
51
  typer.Option(
63
52
  "--archive-dataset",
64
53
  help="Whether to archive the dataset itself after purging its contents.",
65
- hidden=not Flags.v07.is_enabled(),
66
54
  ),
67
55
  ] = False,
68
56
  skip_data: Annotated[
@@ -73,7 +61,6 @@ class PurgeApp(typer.Typer):
73
61
  help="Skip deleting the data in the dataset, only delete configurations. The resources that are "
74
62
  "considered data are: time series, event, files, assets, sequences, relationships, "
75
63
  "labels, and 3D Models",
76
- hidden=not Flags.v07.is_enabled(),
77
64
  ),
78
65
  ] = False,
79
66
  include_configurations: Annotated[
@@ -82,7 +69,6 @@ class PurgeApp(typer.Typer):
82
69
  "--include-configurations",
83
70
  "-c",
84
71
  help="Include configurations, workflows, extraction pipelines and transformations in the purge.",
85
- hidden=not Flags.v07.is_enabled(),
86
72
  ),
87
73
  ] = False,
88
74
  asset_recursive: Annotated[
@@ -92,7 +78,6 @@ class PurgeApp(typer.Typer):
92
78
  "-a",
93
79
  help="When deleting assets, delete all child assets recursively. CAVEAT: This can lead to assets"
94
80
  " not in the selected dataset being deleted if they are children of assets in the dataset.",
95
- hidden=not Flags.v07.is_enabled(),
96
81
  ),
97
82
  ] = False,
98
83
  dry_run: Annotated[
@@ -128,39 +113,28 @@ class PurgeApp(typer.Typer):
128
113
  # Is Interactive
129
114
  interactive = AssetInteractiveSelect(client, operation="purge")
130
115
  external_id = interactive.select_data_set(allow_empty=False)
131
- if Flags.v07.is_enabled():
132
- skip_data = not questionary.confirm(
133
- "Delete data in the dataset (time series, events, files, assets, sequences, relationships, labels, 3D models)?",
134
- default=True,
135
- ).ask()
136
- include_configurations = questionary.confirm(
137
- "Delete configurations (workflows, extraction pipelines and transformations) in the dataset?",
138
- default=False,
139
- ).ask()
140
- asset_recursive = questionary.confirm(
141
- "When deleting assets, delete all child assets recursively? (WARNING: This can lead "
142
- "to assets not in the selected dataset being deleted if they are children of assets in the dataset.)",
143
- default=False,
144
- ).ask()
116
+ skip_data = not questionary.confirm(
117
+ "Delete data in the dataset (time series, events, files, assets, sequences, relationships, labels, 3D models)?",
118
+ default=True,
119
+ ).ask()
120
+ include_configurations = questionary.confirm(
121
+ "Delete configurations (workflows, extraction pipelines and transformations) in the dataset?",
122
+ default=False,
123
+ ).ask()
124
+ asset_recursive = questionary.confirm(
125
+ "When deleting assets, delete all child assets recursively? (WARNING: This can lead "
126
+ "to assets not in the selected dataset being deleted if they are children of assets in the dataset.)",
127
+ default=False,
128
+ ).ask()
145
129
  archive_dataset = questionary.confirm("Archive the dataset itself after purging?", default=False).ask()
146
130
  dry_run = questionary.confirm("Dry run?", default=True).ask()
147
131
  verbose = questionary.confirm("Verbose?", default=True).ask()
148
132
 
149
- user_options = [archive_dataset, dry_run, verbose]
150
- if Flags.v07.is_enabled():
151
- user_options.extend([skip_data, include_configurations, asset_recursive])
133
+ user_options = [archive_dataset, dry_run, verbose, skip_data, include_configurations, asset_recursive]
152
134
 
153
135
  if any(selected is None for selected in user_options):
154
136
  raise typer.Abort("Aborted by user.")
155
137
 
156
- else:
157
- archive_dataset = archive_dataset if Flags.v07.is_enabled() else include_dataset
158
-
159
- if not Flags.v07.is_enabled():
160
- skip_data = False
161
- include_configurations = True
162
- asset_recursive = False
163
-
164
138
  cmd.run(
165
139
  lambda: cmd.dataset(
166
140
  client,
@@ -197,7 +171,6 @@ class PurgeApp(typer.Typer):
197
171
  typer.Option(
198
172
  "--delete-datapoints",
199
173
  help="Delete datapoints linked to CogniteTimeSeries nodes in the space.",
200
- hidden=not Flags.v07.is_enabled(),
201
174
  ),
202
175
  ] = False,
203
176
  delete_file_content: Annotated[
@@ -205,7 +178,6 @@ class PurgeApp(typer.Typer):
205
178
  typer.Option(
206
179
  "--delete-file-content",
207
180
  help="Delete file content linked to CogniteFile nodes in the space.",
208
- hidden=not Flags.v07.is_enabled(),
209
181
  ),
210
182
  ] = False,
211
183
  dry_run: Annotated[