cognite-toolkit 0.7.47__py3-none-any.whl → 0.7.49__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 (62) hide show
  1. cognite_toolkit/_cdf_tk/apps/_migrate_app.py +6 -6
  2. cognite_toolkit/_cdf_tk/client/_toolkit_client.py +6 -4
  3. cognite_toolkit/_cdf_tk/client/api/instances.py +139 -0
  4. cognite_toolkit/_cdf_tk/client/api/location_filters.py +177 -0
  5. cognite_toolkit/_cdf_tk/client/api/raw.py +2 -2
  6. cognite_toolkit/_cdf_tk/client/api/robotics.py +19 -0
  7. cognite_toolkit/_cdf_tk/client/api/robotics_capabilities.py +127 -0
  8. cognite_toolkit/_cdf_tk/client/api/robotics_data_postprocessing.py +138 -0
  9. cognite_toolkit/_cdf_tk/client/api/robotics_frames.py +122 -0
  10. cognite_toolkit/_cdf_tk/client/api/robotics_locations.py +127 -0
  11. cognite_toolkit/_cdf_tk/client/api/robotics_maps.py +122 -0
  12. cognite_toolkit/_cdf_tk/client/api/robotics_robots.py +122 -0
  13. cognite_toolkit/_cdf_tk/client/api/search_config.py +101 -0
  14. cognite_toolkit/_cdf_tk/client/api/streams.py +63 -55
  15. cognite_toolkit/_cdf_tk/client/api/three_d.py +293 -277
  16. cognite_toolkit/_cdf_tk/client/cdf_client/api.py +34 -5
  17. cognite_toolkit/_cdf_tk/client/http_client/_client.py +5 -2
  18. cognite_toolkit/_cdf_tk/client/http_client/_data_classes2.py +4 -3
  19. cognite_toolkit/_cdf_tk/client/request_classes/filters.py +45 -1
  20. cognite_toolkit/_cdf_tk/client/resource_classes/apm_config.py +128 -0
  21. cognite_toolkit/_cdf_tk/client/resource_classes/cognite_file.py +53 -0
  22. cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/__init__.py +4 -0
  23. cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_instance.py +22 -11
  24. cognite_toolkit/_cdf_tk/client/resource_classes/identifiers.py +7 -0
  25. cognite_toolkit/_cdf_tk/client/resource_classes/location_filter.py +9 -2
  26. cognite_toolkit/_cdf_tk/client/resource_classes/resource_view_mapping.py +38 -0
  27. cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_map.py +6 -1
  28. cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_robot.py +10 -5
  29. cognite_toolkit/_cdf_tk/client/resource_classes/streams.py +1 -20
  30. cognite_toolkit/_cdf_tk/client/resource_classes/three_d.py +30 -9
  31. cognite_toolkit/_cdf_tk/client/testing.py +2 -2
  32. cognite_toolkit/_cdf_tk/commands/_migrate/command.py +103 -108
  33. cognite_toolkit/_cdf_tk/commands/_migrate/conversion.py +6 -1
  34. cognite_toolkit/_cdf_tk/commands/_migrate/data_mapper.py +119 -41
  35. cognite_toolkit/_cdf_tk/commands/_migrate/issues.py +21 -38
  36. cognite_toolkit/_cdf_tk/commands/_migrate/migration_io.py +14 -12
  37. cognite_toolkit/_cdf_tk/commands/build_v2/_module_parser.py +138 -0
  38. cognite_toolkit/_cdf_tk/commands/build_v2/_modules_parser.py +163 -0
  39. cognite_toolkit/_cdf_tk/commands/build_v2/build_cmd.py +83 -96
  40. cognite_toolkit/_cdf_tk/commands/build_v2/{build_input.py → build_parameters.py} +8 -22
  41. cognite_toolkit/_cdf_tk/commands/build_v2/data_classes/_modules.py +27 -0
  42. cognite_toolkit/_cdf_tk/commands/build_v2/data_classes/_resource.py +22 -0
  43. cognite_toolkit/_cdf_tk/cruds/__init__.py +11 -5
  44. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/streams.py +14 -30
  45. cognite_toolkit/_cdf_tk/data_classes/__init__.py +3 -0
  46. cognite_toolkit/_cdf_tk/data_classes/_issues.py +36 -0
  47. cognite_toolkit/_cdf_tk/data_classes/_module_directories.py +2 -1
  48. cognite_toolkit/_cdf_tk/storageio/_base.py +2 -0
  49. cognite_toolkit/_cdf_tk/storageio/logger.py +162 -0
  50. cognite_toolkit/_cdf_tk/utils/__init__.py +8 -1
  51. cognite_toolkit/_cdf_tk/utils/interactive_select.py +3 -1
  52. cognite_toolkit/_cdf_tk/utils/modules.py +7 -0
  53. cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml +1 -1
  54. cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml +1 -1
  55. cognite_toolkit/_resources/cdf.toml +1 -1
  56. cognite_toolkit/_version.py +1 -1
  57. {cognite_toolkit-0.7.47.dist-info → cognite_toolkit-0.7.49.dist-info}/METADATA +1 -1
  58. {cognite_toolkit-0.7.47.dist-info → cognite_toolkit-0.7.49.dist-info}/RECORD +61 -43
  59. cognite_toolkit/_cdf_tk/commands/build_v2/build_issues.py +0 -27
  60. /cognite_toolkit/_cdf_tk/client/resource_classes/{search_config_resource.py → search_config.py} +0 -0
  61. {cognite_toolkit-0.7.47.dist-info → cognite_toolkit-0.7.49.dist-info}/WHEEL +0 -0
  62. {cognite_toolkit-0.7.47.dist-info → cognite_toolkit-0.7.49.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,27 @@
1
+ import sys
2
+ from pathlib import Path
3
+
4
+ from pydantic import BaseModel, ConfigDict
5
+
6
+ from cognite_toolkit._cdf_tk.data_classes._module_toml import ModuleToml
7
+
8
+ if sys.version_info >= (3, 11):
9
+ from typing import Self
10
+ else:
11
+ from typing_extensions import Self
12
+
13
+
14
+ class Module(BaseModel):
15
+ model_config = ConfigDict(
16
+ frozen=True,
17
+ validate_assignment=True,
18
+ arbitrary_types_allowed=True,
19
+ )
20
+
21
+ path: Path
22
+ definition: ModuleToml | None = None
23
+
24
+ @classmethod
25
+ def load(cls, path: Path) -> Self:
26
+ definition = ModuleToml.load(path / ModuleToml.filename) if (path / ModuleToml.filename).exists() else None
27
+ return cls(path=path, definition=definition)
@@ -0,0 +1,22 @@
1
+ import sys
2
+ from pathlib import Path
3
+
4
+ from pydantic import BaseModel, ConfigDict
5
+
6
+ if sys.version_info >= (3, 11):
7
+ from typing import Self
8
+ else:
9
+ from typing_extensions import Self
10
+
11
+
12
+ class Resource(BaseModel):
13
+ model_config = ConfigDict(
14
+ frozen=True,
15
+ validate_assignment=True,
16
+ )
17
+
18
+ path: Path
19
+
20
+ @classmethod
21
+ def load(cls, path: Path) -> Self:
22
+ return cls(path=path)
@@ -12,6 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  import itertools
15
+ from collections import defaultdict
15
16
  from typing import Literal, TypeAlias
16
17
 
17
18
  from cognite_toolkit._cdf_tk.feature_flags import FeatureFlag, Flags
@@ -90,24 +91,28 @@ if not FeatureFlag.is_enabled(Flags.STREAMS):
90
91
  if not FeatureFlag.is_enabled(Flags.SIMULATORS):
91
92
  _EXCLUDED_CRUDS.add(SimulatorModelCRUD)
92
93
 
93
- CRUDS_BY_FOLDER_NAME: dict[str, list[type[Loader]]] = {}
94
+ CRUDS_BY_FOLDER_NAME_INCLUDE_ALPHA: defaultdict[str, list[type[Loader]]] = defaultdict(list)
95
+ CRUDS_BY_FOLDER_NAME: defaultdict[str, list[type[Loader]]] = defaultdict(list)
94
96
  for _loader in itertools.chain(
95
97
  ResourceCRUD.__subclasses__(),
96
98
  ResourceContainerCRUD.__subclasses__(),
97
99
  DataCRUD.__subclasses__(),
98
100
  GroupCRUD.__subclasses__(),
99
101
  ):
100
- if _loader in [ResourceCRUD, ResourceContainerCRUD, DataCRUD, GroupCRUD] or _loader in _EXCLUDED_CRUDS:
102
+ if _loader in [ResourceCRUD, ResourceContainerCRUD, DataCRUD, GroupCRUD]:
101
103
  # Skipping base classes
102
104
  continue
103
- if _loader.folder_name not in CRUDS_BY_FOLDER_NAME: # type: ignore[attr-defined]
104
- CRUDS_BY_FOLDER_NAME[_loader.folder_name] = [] # type: ignore[attr-defined]
105
105
  # MyPy bug: https://github.com/python/mypy/issues/4717
106
- CRUDS_BY_FOLDER_NAME[_loader.folder_name].append(_loader) # type: ignore[arg-type, attr-defined]
106
+ CRUDS_BY_FOLDER_NAME_INCLUDE_ALPHA[_loader.folder_name].append(_loader) # type: ignore[arg-type, attr-defined]
107
+
108
+ if _loader not in _EXCLUDED_CRUDS:
109
+ CRUDS_BY_FOLDER_NAME[_loader.folder_name].append(_loader) # type: ignore[arg-type, attr-defined]
107
110
  del _loader # cleanup module namespace
108
111
 
112
+
109
113
  # For backwards compatibility
110
114
  CRUDS_BY_FOLDER_NAME["data_models"] = CRUDS_BY_FOLDER_NAME["data_modeling"] # Todo: Remove in v1.0
115
+ CRUDS_BY_FOLDER_NAME_INCLUDE_ALPHA["data_models"] = CRUDS_BY_FOLDER_NAME_INCLUDE_ALPHA["data_modeling"]
111
116
  RESOURCE_CRUD_BY_FOLDER_NAME = {
112
117
  folder_name: cruds
113
118
  for folder_name, loaders in CRUDS_BY_FOLDER_NAME.items()
@@ -166,6 +171,7 @@ __all__ = [
166
171
  "RESOURCE_CRUD_CONTAINER_LIST",
167
172
  "RESOURCE_CRUD_LIST",
168
173
  "RESOURCE_DATA_CRUD_LIST",
174
+ "_EXCLUDED_CRUDS",
169
175
  "AgentCRUD",
170
176
  "AssetCRUD",
171
177
  "CogniteFileCRUD",
@@ -4,11 +4,10 @@ from typing import Any, final
4
4
  from cognite.client.data_classes.capabilities import Capability, StreamsAcl
5
5
  from cognite.client.utils.useful_types import SequenceNotStr
6
6
 
7
- from cognite_toolkit._cdf_tk.client.http_client import ToolkitAPIError
7
+ from cognite_toolkit._cdf_tk.client.resource_classes.identifiers import ExternalId
8
8
  from cognite_toolkit._cdf_tk.client.resource_classes.streams import (
9
9
  StreamRequest,
10
10
  StreamResponse,
11
- StreamResponseList,
12
11
  )
13
12
  from cognite_toolkit._cdf_tk.cruds._base_cruds import ResourceCRUD
14
13
  from cognite_toolkit._cdf_tk.resource_classes import StreamYAML
@@ -17,7 +16,7 @@ from .datamodel import ContainerCRUD
17
16
 
18
17
 
19
18
  @final
20
- class StreamCRUD(ResourceCRUD[str, StreamRequest, StreamResponse]):
19
+ class StreamCRUD(ResourceCRUD[ExternalId, StreamRequest, StreamResponse]):
21
20
  folder_name = "streams"
22
21
  resource_cls = StreamResponse
23
22
  resource_write_cls = StreamRequest
@@ -32,14 +31,14 @@ class StreamCRUD(ResourceCRUD[str, StreamRequest, StreamResponse]):
32
31
  return "streams"
33
32
 
34
33
  @classmethod
35
- def get_id(cls, item: StreamRequest | StreamResponse | dict) -> str:
34
+ def get_id(cls, item: StreamRequest | StreamResponse | dict) -> ExternalId:
36
35
  if isinstance(item, dict):
37
- return item["externalId"]
38
- return item.external_id
36
+ return ExternalId(external_id=item["externalId"])
37
+ return ExternalId(external_id=item.external_id)
39
38
 
40
39
  @classmethod
41
- def dump_id(cls, id: str) -> dict[str, Any]:
42
- return {"externalId": id}
40
+ def dump_id(cls, id: ExternalId) -> dict[str, Any]:
41
+ return id.dump()
43
42
 
44
43
  @classmethod
45
44
  def get_required_capability(
@@ -55,30 +54,15 @@ class StreamCRUD(ResourceCRUD[str, StreamRequest, StreamResponse]):
55
54
  )
56
55
  return StreamsAcl(actions, StreamsAcl.Scope.All())
57
56
 
58
- def create(self, items: Sequence[StreamRequest]) -> StreamResponseList:
59
- created = self.client.streams.create(list(items))
60
- return StreamResponseList(created)
57
+ def create(self, items: Sequence[StreamRequest]) -> list[StreamResponse]:
58
+ return self.client.streams.create(items)
61
59
 
62
- def retrieve(self, ids: SequenceNotStr[str]) -> StreamResponseList:
63
- retrieved: list[StreamResponse] = []
64
- for _id in ids:
65
- try:
66
- _resp = self.client.streams.retrieve(_id)
67
- except ToolkitAPIError:
68
- continue
69
- if _resp is not None:
70
- retrieved.append(_resp)
71
- return StreamResponseList(retrieved)
60
+ def retrieve(self, ids: SequenceNotStr[ExternalId]) -> list[StreamResponse]:
61
+ return self.client.streams.retrieve(list(ids), ignore_unknown_ids=True)
72
62
 
73
- def delete(self, ids: SequenceNotStr[str]) -> int:
74
- count = 0
75
- for _id in ids:
76
- try:
77
- self.client.streams.delete(_id)
78
- except ToolkitAPIError:
79
- continue
80
- count += 1
81
- return count
63
+ def delete(self, ids: SequenceNotStr[ExternalId]) -> int:
64
+ self.client.streams.delete(list(ids), ignore_unknown_ids=True)
65
+ return len(ids)
82
66
 
83
67
  def _iterate(
84
68
  self,
@@ -29,6 +29,7 @@ from ._deploy_results import (
29
29
  ResourceDeployResult,
30
30
  UploadDeployResult,
31
31
  )
32
+ from ._issues import Issue, IssueList
32
33
  from ._module_directories import ModuleDirectories, ModuleLocation
33
34
  from ._module_resources import ModuleResources
34
35
  from ._packages import Package, Packages
@@ -56,6 +57,8 @@ __all__ = [
56
57
  "DeployResults",
57
58
  "Environment",
58
59
  "InitConfigYAML",
60
+ "Issue",
61
+ "IssueList",
59
62
  "ModuleDirectories",
60
63
  "ModuleLocation",
61
64
  "ModuleResources",
@@ -0,0 +1,36 @@
1
+ import sys
2
+ from collections import UserList
3
+
4
+ if sys.version_info >= (3, 11):
5
+ from typing import Self
6
+ else:
7
+ from typing_extensions import Self
8
+
9
+ from pydantic import BaseModel, Field
10
+
11
+ from cognite_toolkit._cdf_tk.tk_warnings import ToolkitWarning, WarningList
12
+
13
+ MODULE_ISSUE_CODE = "MOD"
14
+
15
+
16
+ class Issue(BaseModel):
17
+ """Base class for all issues"""
18
+
19
+ code: str
20
+ message: str | None = Field(default=None)
21
+
22
+
23
+ # temporary adapter to manage existing warnings
24
+ class IssueList(UserList[Issue]):
25
+ """List of build issues."""
26
+
27
+ @classmethod
28
+ def from_warning_list(cls, warning_list: WarningList[ToolkitWarning]) -> Self:
29
+ """Create a IssueList from a WarningList."""
30
+ return cls([Issue(code="WARN", message=warning.get_message()) for warning in warning_list])
31
+
32
+
33
+ class ModuleLoadingIssue(Issue):
34
+ """Issue with the loading of a module folder."""
35
+
36
+ code: str = "MOD_001"
@@ -8,7 +8,8 @@ from pathlib import Path
8
8
  from typing import Any, SupportsIndex, overload
9
9
 
10
10
  from cognite_toolkit._cdf_tk.constants import INDEX_PATTERN
11
- from cognite_toolkit._cdf_tk.utils import calculate_directory_hash, iterate_modules, resource_folder_from_path
11
+ from cognite_toolkit._cdf_tk.utils.hashing import calculate_directory_hash
12
+ from cognite_toolkit._cdf_tk.utils.modules import iterate_modules, resource_folder_from_path
12
13
 
13
14
  from ._module_toml import ModuleToml
14
15
 
@@ -11,6 +11,7 @@ from cognite_toolkit._cdf_tk.utils.collection import chunker
11
11
  from cognite_toolkit._cdf_tk.utils.fileio import MultiFileReader, SchemaColumn
12
12
  from cognite_toolkit._cdf_tk.utils.useful_types import JsonVal
13
13
 
14
+ from .logger import DataLogger, NoOpLogger
14
15
  from .selectors import DataSelector
15
16
 
16
17
 
@@ -76,6 +77,7 @@ class StorageIO(ABC, Generic[T_Selector, T_ResourceResponse]):
76
77
 
77
78
  def __init__(self, client: ToolkitClient) -> None:
78
79
  self.client = client
80
+ self.logger: DataLogger = NoOpLogger()
79
81
 
80
82
  @abstractmethod
81
83
  def as_id(self, item: T_ResourceResponse) -> str:
@@ -0,0 +1,162 @@
1
+ from abc import ABC, abstractmethod
2
+ from collections import defaultdict
3
+ from collections.abc import Sequence
4
+ from threading import Lock
5
+ from typing import Literal, TypeAlias
6
+
7
+ from pydantic import BaseModel
8
+ from pydantic.alias_generators import to_camel
9
+
10
+ from cognite_toolkit._cdf_tk.utils.fileio import NDJsonWriter
11
+
12
+
13
+ class LogEntry(BaseModel, alias_generator=to_camel, extra="ignore", populate_by_name=True):
14
+ """Represents a log entry for tracking storage I/O operations."""
15
+
16
+ id: str
17
+
18
+
19
+ OperationStatus: TypeAlias = Literal["success", "failure", "unchanged", "pending"]
20
+
21
+
22
+ class ItemTracker:
23
+ """Tracks issues accumulated for a single item during pipeline processing."""
24
+
25
+ def __init__(self, item_id: str) -> None:
26
+ self.item_id = item_id
27
+ self.issues: list[str] = []
28
+
29
+ def add_issue(self, issue: str) -> None:
30
+ """Add an issue encountered during processing."""
31
+ self.issues.append(issue)
32
+
33
+
34
+ class OperationTracker(ABC):
35
+ """Abstract base class for operation trackers."""
36
+
37
+ @abstractmethod
38
+ def add_issue(self, item_id: str, issue: str) -> None:
39
+ """Add an issue to an item."""
40
+ raise NotImplementedError()
41
+
42
+ @abstractmethod
43
+ def finalize_item(self, item_id: str | list[str], status: OperationStatus) -> None:
44
+ """Finalize an item with its final status."""
45
+ raise NotImplementedError()
46
+
47
+ @abstractmethod
48
+ def get_status_counts(self) -> dict[OperationStatus, int]:
49
+ """Get counts per final status."""
50
+ raise NotImplementedError()
51
+
52
+ @abstractmethod
53
+ def get_issue_counts(self, status: OperationStatus) -> dict[str, int]:
54
+ """Get issue counts, optionally filtered by status."""
55
+ raise NotImplementedError()
56
+
57
+
58
+ class NoOpTracker(OperationTracker):
59
+ """A no-op tracker that does nothing."""
60
+
61
+ def add_issue(self, item_id: str, issue: str) -> None:
62
+ """No-op: Discard the issue."""
63
+ pass
64
+
65
+ def finalize_item(self, item_id: str | list[str], status: OperationStatus) -> None:
66
+ """No-op: Do nothing."""
67
+ pass
68
+
69
+ def get_status_counts(self) -> dict[OperationStatus, int]:
70
+ """Return empty status counts."""
71
+ return {}
72
+
73
+ def get_issue_counts(self, status: OperationStatus) -> dict[str, int]:
74
+ """Return empty issue counts."""
75
+ return {}
76
+
77
+
78
+ class MemoryOperationTracker(OperationTracker):
79
+ """Tracks the overall operation progress and issues across multiple items.
80
+
81
+ Tracks counts of final statuses and issues per status.
82
+ """
83
+
84
+ def __init__(self) -> None:
85
+ self._lock = Lock()
86
+ self._active_items: dict[str, ItemTracker] = {}
87
+ self._status_counts: dict[OperationStatus, int] = defaultdict(int)
88
+ self._issue_counts: dict[OperationStatus, dict[str, int]] = defaultdict(lambda: defaultdict(int))
89
+
90
+ def add_issue(self, item_id: str, issue: str) -> None:
91
+ """Add an issue to an item, creating tracker if needed."""
92
+ with self._lock:
93
+ if item_id not in self._active_items:
94
+ self._active_items[item_id] = ItemTracker(item_id)
95
+ self._active_items[item_id].add_issue(issue)
96
+
97
+ def finalize_item(self, item_id: str | list[str], status: OperationStatus) -> None:
98
+ """Finalize an item with its final status.
99
+
100
+ Args:
101
+ item_id: The item's identifier.
102
+ status: Final status (success, failure, unchanged).
103
+ """
104
+ with self._lock:
105
+ if isinstance(item_id, list):
106
+ for iid in item_id:
107
+ self._finalize_item_unlocked(iid, status)
108
+ else:
109
+ self._finalize_item_unlocked(item_id, status)
110
+
111
+ def _finalize_item_unlocked(self, item_id: str, status: OperationStatus) -> None:
112
+ """Internal method to finalize an item without acquiring the lock."""
113
+ tracker = self._active_items.pop(item_id, None)
114
+ self._status_counts[status] += 1
115
+ if tracker is not None:
116
+ for issue in tracker.issues:
117
+ self._issue_counts[status][issue] += 1
118
+
119
+ def get_status_counts(self) -> dict[OperationStatus, int]:
120
+ """Get counts per final status."""
121
+ with self._lock:
122
+ return dict(self._status_counts)
123
+
124
+ def get_issue_counts(self, status: OperationStatus) -> dict[str, int]:
125
+ """Get issue counts, optionally filtered by status."""
126
+ with self._lock:
127
+ return dict(self._issue_counts.get(status, {}))
128
+
129
+
130
+ class DataLogger(ABC):
131
+ """Abstract base class for data loggers that track operations and log entries."""
132
+
133
+ tracker: OperationTracker
134
+
135
+ @abstractmethod
136
+ def log(self, entry: LogEntry | Sequence[LogEntry]) -> None:
137
+ """Log a detailed entry."""
138
+ raise NotImplementedError()
139
+
140
+
141
+ class NoOpLogger(DataLogger):
142
+ """A no-op logger that discards all log entries and does no tracking."""
143
+
144
+ def __init__(self) -> None:
145
+ self.tracker = NoOpTracker()
146
+
147
+ def log(self, entry: LogEntry | Sequence[LogEntry]) -> None:
148
+ """Discard the log entry (no-op)."""
149
+ pass
150
+
151
+
152
+ class FileDataLogger(DataLogger):
153
+ """Composes aggregation tracking with detailed file logging."""
154
+
155
+ def __init__(self, writer: NDJsonWriter) -> None:
156
+ self.tracker = MemoryOperationTracker()
157
+ self._writer = writer
158
+
159
+ def log(self, entry: LogEntry | Sequence[LogEntry]) -> None:
160
+ """Log a detailed entry to the file."""
161
+ entries = entry if isinstance(entry, Sequence) else [entry]
162
+ self._writer.write_chunks([e.model_dump(by_alias=True) for e in entries])
@@ -19,7 +19,13 @@ from .hashing import (
19
19
  calculate_hash,
20
20
  calculate_secure_hash,
21
21
  )
22
- from .modules import find_directory_with_subdirectories, iterate_modules, module_from_path, resource_folder_from_path
22
+ from .modules import (
23
+ find_directory_with_subdirectories,
24
+ iterate_modules,
25
+ module_from_path,
26
+ module_path_display_name,
27
+ resource_folder_from_path,
28
+ )
23
29
  from .sentry_utils import sentry_exception_filter
24
30
 
25
31
  __all__ = [
@@ -37,6 +43,7 @@ __all__ = [
37
43
  "iterate_modules",
38
44
  "load_yaml_inject_variables",
39
45
  "module_from_path",
46
+ "module_path_display_name",
40
47
  "quote_int_value_by_key_in_yaml",
41
48
  "read_yaml_content",
42
49
  "read_yaml_file",
@@ -852,7 +852,9 @@ class ThreeDInteractiveSelect:
852
852
  ],
853
853
  ).ask()
854
854
 
855
- models = self.client.tool.three_d.models.list(published=published, include_revision_info=True, limit=None)
855
+ models = self.client.tool.three_d.models_classic.list(
856
+ published=published, include_revision_info=True, limit=None
857
+ )
856
858
  if model_type == "classic":
857
859
  models = [model for model in models if model.space is None]
858
860
  else:
@@ -12,6 +12,7 @@ from cognite_toolkit._cdf_tk.constants import (
12
12
  def iterate_modules(root_dir: Path) -> Iterator[tuple[Path, list[Path]]]:
13
13
  """Iterate over all modules in the project and yield the module directory and all files in the module.
14
14
 
15
+
15
16
  Args:
16
17
  root_dir (Path): The root directory of the project
17
18
 
@@ -110,6 +111,12 @@ def is_module_path(path: Path) -> bool:
110
111
  return any(sub_folder.name in CRUDS_BY_FOLDER_NAME for sub_folder in path.iterdir() if sub_folder.is_dir())
111
112
 
112
113
 
114
+ def module_path_display_name(org_path: Path, module_path: Path) -> str:
115
+ """Returns the module directory path relative to the organization path as a posix string."""
116
+ rel = module_path.relative_to(org_path)
117
+ return rel.as_posix()
118
+
119
+
113
120
  def find_directory_with_subdirectories(
114
121
  directory_name: str | None, root_directory: Path
115
122
  ) -> tuple[Path | None, list[str]]:
@@ -12,7 +12,7 @@ jobs:
12
12
  environment: dev
13
13
  name: Deploy
14
14
  container:
15
- image: cognite/toolkit:0.7.47
15
+ image: cognite/toolkit:0.7.49
16
16
  env:
17
17
  CDF_CLUSTER: ${{ vars.CDF_CLUSTER }}
18
18
  CDF_PROJECT: ${{ vars.CDF_PROJECT }}
@@ -10,7 +10,7 @@ jobs:
10
10
  environment: dev
11
11
  name: Deploy Dry Run
12
12
  container:
13
- image: cognite/toolkit:0.7.47
13
+ image: cognite/toolkit:0.7.49
14
14
  env:
15
15
  CDF_CLUSTER: ${{ vars.CDF_CLUSTER }}
16
16
  CDF_PROJECT: ${{ vars.CDF_PROJECT }}
@@ -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.7.47"
7
+ version = "0.7.49"
8
8
 
9
9
 
10
10
  [plugins]
@@ -1 +1 @@
1
- __version__ = "0.7.47"
1
+ __version__ = "0.7.49"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cognite_toolkit
3
- Version: 0.7.47
3
+ Version: 0.7.49
4
4
  Summary: Official Cognite Data Fusion tool for project templates and configuration deployment
5
5
  Author: Cognite AS
6
6
  Author-email: Cognite AS <support@cognite.com>