cognite-toolkit 0.6.112__py3-none-any.whl → 0.6.113__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.
@@ -19,7 +19,7 @@ from cognite_toolkit._cdf_tk.commands.collect import CollectCommand
19
19
  from cognite_toolkit._cdf_tk.commands.modules import ModulesCommand
20
20
  from cognite_toolkit._cdf_tk.commands.repo import RepoCommand
21
21
  from cognite_toolkit._cdf_tk.exceptions import ToolkitError
22
- from cognite_toolkit._cdf_tk.feature_flags import Flags
22
+ from cognite_toolkit._cdf_tk.feature_flags import FeatureFlag, Flags
23
23
 
24
24
 
25
25
  class InitItemStatus(Enum):
@@ -32,8 +32,6 @@ class InitItemStatus(Enum):
32
32
 
33
33
  @dataclass
34
34
  class InitChecklistItem:
35
- """Represents an item in the init checklist"""
36
-
37
35
  name: str
38
36
  description: str
39
37
  function: Callable[[], None]
@@ -41,7 +39,6 @@ class InitChecklistItem:
41
39
  mandatory: bool = False
42
40
 
43
41
  def get_status_display(self) -> str:
44
- """Get a display string for the status"""
45
42
  if self.status == InitItemStatus.SUCCESSFUL:
46
43
  return "✓"
47
44
  elif self.status == InitItemStatus.FAILED:
@@ -50,12 +47,17 @@ class InitChecklistItem:
50
47
  return "○"
51
48
 
52
49
  def get_choice_title(self) -> str:
53
- """Get the title for the questionary choice"""
54
50
  status_icon = self.get_status_display()
55
51
  return f"{status_icon} {self.description} (required)" if self.mandatory else f"{status_icon} {self.description}"
56
52
 
57
53
 
58
54
  class InitCommand(ToolkitCommand):
55
+ organization_dir: Path | None
56
+
57
+ def __init__(self, print_warning: bool = True, skip_tracking: bool = False, silent: bool = False) -> None:
58
+ super().__init__(print_warning, skip_tracking, silent)
59
+ self.organization_dir = None
60
+
59
61
  def execute(self, dry_run: bool = False, emulate_dot_seven: bool = False) -> None:
60
62
  if not Flags.v07.is_enabled() and not emulate_dot_seven:
61
63
  print("This command is deprecated. Use 'cdf modules init' instead.")
@@ -140,7 +142,6 @@ class InitCommand(ToolkitCommand):
140
142
  if selected == "__exit__":
141
143
  if all_mandatory_complete:
142
144
  print("Setup complete!")
143
- print("You can now start using the Cognite Toolkit.")
144
145
  break
145
146
  else:
146
147
  incomplete_mandatory = [
@@ -168,7 +169,6 @@ class InitCommand(ToolkitCommand):
168
169
  if not confirm:
169
170
  continue
170
171
 
171
- # Run the function
172
172
  try:
173
173
  selected_item.function()
174
174
  selected_item.status = InitItemStatus.SUCCESSFUL
@@ -188,12 +188,14 @@ class InitCommand(ToolkitCommand):
188
188
  print(f"Unexpected error occurred. Full traceback:\n{traceback.format_exc()}")
189
189
 
190
190
  def _init_toml(self, dry_run: bool = False) -> None:
191
- organization_dir = ModulesCommand._prompt_organization_dir()
191
+ if self.organization_dir is None:
192
+ self.organization_dir = ModulesCommand._prompt_organization_dir()
192
193
  if dry_run:
193
194
  print("Would initialize cdf.toml configuration file")
194
195
  return
195
- CDFToml.write(organization_dir, "dev")
196
- print(f"cdf.toml configuration file initialized in {organization_dir}")
196
+ CDFToml.write(self.organization_dir, "dev")
197
+ FeatureFlag.flush()
198
+ print(f"cdf.toml configuration file initialized in {self.organization_dir}")
197
199
 
198
200
  def _init_auth(self, dry_run: bool = False) -> None:
199
201
  auth_command = AuthCommand()
@@ -201,12 +203,14 @@ class InitCommand(ToolkitCommand):
201
203
 
202
204
  def _init_modules(self, dry_run: bool = False) -> None:
203
205
  with ModulesCommand() as modules_command:
206
+ if self.organization_dir is None:
207
+ self.organization_dir = ModulesCommand._prompt_organization_dir()
204
208
  if dry_run:
205
209
  organization_dir = Path(tempfile.mkdtemp(prefix="init_modules_", suffix=".tmp", dir=Path.cwd()))
206
210
  modules_command.run(lambda: modules_command.init(organization_dir=organization_dir))
207
211
  shutil.rmtree(organization_dir)
208
212
  else:
209
- modules_command.run(lambda: modules_command.init())
213
+ modules_command.run(lambda: modules_command.init(organization_dir=self.organization_dir))
210
214
 
211
215
  def _init_repo(self, dry_run: bool = False) -> None:
212
216
  repo_command = RepoCommand()
@@ -216,7 +220,7 @@ class InitCommand(ToolkitCommand):
216
220
  """Opt in to collect usage statistics"""
217
221
 
218
222
  opt_in = questionary.confirm(
219
- "Do you want to opt in to collect usage statistics?",
223
+ "Do you want to opt in to collect usage statistics? This will help us improve the Toolkit.",
220
224
  default=True,
221
225
  ).ask()
222
226
  if dry_run:
@@ -756,6 +756,7 @@ class ModulesCommand(ToolkitCommand):
756
756
  """
757
757
 
758
758
  cdf_toml = CDFToml.load()
759
+
759
760
  if (Flags.EXTERNAL_LIBRARIES.is_enabled() or user_library) and self._module_source_dir is None:
760
761
  libraries = {"userdefined": user_library} if user_library else cdf_toml.libraries
761
762
 
@@ -99,3 +99,7 @@ class FeatureFlag:
99
99
  @lru_cache(typed=True)
100
100
  def is_enabled(flag: Flags) -> bool:
101
101
  return CDFToml.load().alpha_flags.get(clean_name(flag.name), False)
102
+
103
+ @staticmethod
104
+ def flush() -> None:
105
+ FeatureFlag.is_enabled.cache_clear()
@@ -12,7 +12,7 @@ jobs:
12
12
  environment: dev
13
13
  name: Deploy
14
14
  container:
15
- image: cognite/toolkit:0.6.112
15
+ image: cognite/toolkit:0.6.113
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.6.112
13
+ image: cognite/toolkit:0.6.113
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.6.112"
7
+ version = "0.6.113"
8
8
 
9
9
  [alpha_flags]
10
10
  external-libraries = true
@@ -1 +1 @@
1
- __version__ = "0.6.112"
1
+ __version__ = "0.6.113"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cognite_toolkit
3
- Version: 0.6.112
3
+ Version: 0.6.113
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,11 +1,11 @@
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=YdtCh7IlYHUXy1k7RzpZ9PwL65uDkujJSpGAeXnu7a0,24
3
+ cognite_toolkit/_version.py,sha256=DOT6K-RJWjRjHJkjxqDVc26V3kiyLy4jbrtF9QPajHQ,24
4
4
  cognite_toolkit/_cdf_tk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  cognite_toolkit/_cdf_tk/cdf_toml.py,sha256=VSWV9h44HusWIaKpWgjrOMrc3hDoPTTXBXlp6-NOrIM,9079
6
6
  cognite_toolkit/_cdf_tk/constants.py,sha256=aFcJkY03sYOJ92YfvcVpau-waj6akOAb4KgyIwKI-bs,7135
7
7
  cognite_toolkit/_cdf_tk/exceptions.py,sha256=xG0jMwi5A20nvPvyo6sCyz_cyKycynPyIzpYiGR4gcU,6064
8
- cognite_toolkit/_cdf_tk/feature_flags.py,sha256=XMIZIOjPCdnH42SupUOETf_0d11TgKPZSfjCKnLoDJo,3017
8
+ cognite_toolkit/_cdf_tk/feature_flags.py,sha256=TjwUmGG5qXBQ-8P1ongh2qQnuRfVRvGaP1JBtuUot88,3106
9
9
  cognite_toolkit/_cdf_tk/hints.py,sha256=UI1ymi2T5wCcYOpEbKbVaDnlyFReFy8TDtMVt-5E1h8,6493
10
10
  cognite_toolkit/_cdf_tk/plugins.py,sha256=JwaN_jrrky1PXBJ3tRpZ22cIcD01EB46WVFgp_bK-fQ,856
11
11
  cognite_toolkit/_cdf_tk/protocols.py,sha256=Lc8XnBfmDZN6dwmSopmK7cFE9a9jZ2zdUryEeCXn27I,3052
@@ -119,8 +119,8 @@ cognite_toolkit/_cdf_tk/commands/deploy.py,sha256=R185y7oFr3yhh10RSPE81dpYX346gh
119
119
  cognite_toolkit/_cdf_tk/commands/dump_data.py,sha256=8l4M2kqV4DjiV5js5s7EbFVNxV0Np4ld8ogw19vaJp0,21804
120
120
  cognite_toolkit/_cdf_tk/commands/dump_resource.py,sha256=ylAFST3GgkWT1Qa-JIzmQXbrQgNCB1UrptrBf3WsyvY,39658
121
121
  cognite_toolkit/_cdf_tk/commands/featureflag.py,sha256=lgLMwuNIwFjvvKn1sNMunkq4VTwdNqXtrZfdGFTrNcI,968
122
- cognite_toolkit/_cdf_tk/commands/init.py,sha256=55FlBxrRlSkkAkIkdFtHjnV3Z3qniE_Zw-XhYJAIwpI,9171
123
- cognite_toolkit/_cdf_tk/commands/modules.py,sha256=hw5riBMfv9ohXSxV88BfOzcsCTrqrayD1PHMxatLr94,41091
122
+ cognite_toolkit/_cdf_tk/commands/init.py,sha256=M5qT6qMG2AxKwjsi8y6t9tLWBX4nb5uSYp4J6ER8M2A,9463
123
+ cognite_toolkit/_cdf_tk/commands/modules.py,sha256=buGS_SqbrSykechbh-MTfFNvl1VyPhrL_91JE4_jL4I,41092
124
124
  cognite_toolkit/_cdf_tk/commands/pull.py,sha256=ktPXHW3f0HpmqCxeMhH8Ac52dAuQqAum3VBmLWJwQSM,39246
125
125
  cognite_toolkit/_cdf_tk/commands/repo.py,sha256=MNy8MWphTklIZHvQOROCweq8_SYxGv6BaqnLpkFFnuk,3845
126
126
  cognite_toolkit/_cdf_tk/commands/run.py,sha256=JyX9jLEQej9eRrHVCCNlw4GuF80qETSol3-T5CCofgw,37331
@@ -302,13 +302,13 @@ cognite_toolkit/_repo_files/.gitignore,sha256=ip9kf9tcC5OguF4YF4JFEApnKYw0nG0vPi
302
302
  cognite_toolkit/_repo_files/AzureDevOps/.devops/README.md,sha256=OLA0D7yCX2tACpzvkA0IfkgQ4_swSd-OlJ1tYcTBpsA,240
303
303
  cognite_toolkit/_repo_files/AzureDevOps/.devops/deploy-pipeline.yml,sha256=brULcs8joAeBC_w_aoWjDDUHs3JheLMIR9ajPUK96nc,693
304
304
  cognite_toolkit/_repo_files/AzureDevOps/.devops/dry-run-pipeline.yml,sha256=OBFDhFWK1mlT4Dc6mDUE2Es834l8sAlYG50-5RxRtHk,723
305
- cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml,sha256=KQO8WZbRDnrPRvcqQhR9RnDTd3f2r-ZYaE67TAL_zgA,668
306
- cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=_zX7CZV50WD8jgLI-sc95uffoOiw11hfhd3ChWfJcSg,2431
307
- cognite_toolkit/_resources/cdf.toml,sha256=y4PqbIfBl47XVEnfal8OOVNmcgHk0VZ03NGvlXdaAbA,488
305
+ cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml,sha256=LlS9ma4kuTtppYQwCFL5pBw_ZJ1fldSwCoC6LO9am-c,668
306
+ cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=vYjDXyC529ScKEi4OH5L8RnRH5RzIuyrt1Ki5z4DpKE,2431
307
+ cognite_toolkit/_resources/cdf.toml,sha256=cI4FFAswvHyeVPN-uZQkvhju8mbd-yFZQ4jagNwGG-M,488
308
308
  cognite_toolkit/demo/__init__.py,sha256=-m1JoUiwRhNCL18eJ6t7fZOL7RPfowhCuqhYFtLgrss,72
309
309
  cognite_toolkit/demo/_base.py,sha256=6xKBUQpXZXGQ3fJ5f7nj7oT0s2n7OTAGIa17ZlKHZ5U,8052
310
- cognite_toolkit-0.6.112.dist-info/METADATA,sha256=zeQt_5Nhh667iyf7QmikzJkYDiLEM-MCPiCXTfzx6C0,4502
311
- cognite_toolkit-0.6.112.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
312
- cognite_toolkit-0.6.112.dist-info/entry_points.txt,sha256=JlR7MH1_UMogC3QOyN4-1l36VbrCX9xUdQoHGkuJ6-4,83
313
- cognite_toolkit-0.6.112.dist-info/licenses/LICENSE,sha256=CW0DRcx5tL-pCxLEN7ts2S9g2sLRAsWgHVEX4SN9_Mc,752
314
- cognite_toolkit-0.6.112.dist-info/RECORD,,
310
+ cognite_toolkit-0.6.113.dist-info/METADATA,sha256=suhsfAM6ZMpOe4Ahq4rdh8jC01qoKdTY-ocRlfr5qag,4502
311
+ cognite_toolkit-0.6.113.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
312
+ cognite_toolkit-0.6.113.dist-info/entry_points.txt,sha256=JlR7MH1_UMogC3QOyN4-1l36VbrCX9xUdQoHGkuJ6-4,83
313
+ cognite_toolkit-0.6.113.dist-info/licenses/LICENSE,sha256=CW0DRcx5tL-pCxLEN7ts2S9g2sLRAsWgHVEX4SN9_Mc,752
314
+ cognite_toolkit-0.6.113.dist-info/RECORD,,