splight-cli 2.3.12__tar.gz → 2.3.14__tar.gz

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 (76) hide show
  1. {splight-cli-2.3.12 → splight-cli-2.3.14}/PKG-INFO +1 -1
  2. {splight-cli-2.3.12 → splight-cli-2.3.14}/README.md +29 -2
  3. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/cli.py +0 -40
  4. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/component/__init__.py +33 -17
  5. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/component/component.py +7 -3
  6. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/component/tests/test_run.py +5 -2
  7. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/context/__init__.py +1 -21
  8. splight-cli-2.3.14/cli/context/context.py +9 -0
  9. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/engine/datalake/tests/test_list.py +1 -7
  10. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/hub/component/hub_manager.py +4 -4
  11. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/settings.py +2 -5
  12. splight-cli-2.3.14/cli/tests/__init__.py +0 -0
  13. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/tests/test_configure.py +2 -0
  14. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/tests/test_generic.py +1 -0
  15. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/utils/__init__.py +0 -3
  16. splight-cli-2.3.14/cli/version.py +1 -0
  17. {splight-cli-2.3.12 → splight-cli-2.3.14}/setup.py +1 -1
  18. {splight-cli-2.3.12 → splight-cli-2.3.14}/splight_cli.egg-info/PKG-INFO +1 -1
  19. {splight-cli-2.3.12 → splight-cli-2.3.14}/splight_cli.egg-info/SOURCES.txt +1 -4
  20. splight-cli-2.3.14/splight_cli.egg-info/entry_points.txt +3 -0
  21. {splight-cli-2.3.12 → splight-cli-2.3.14}/splight_cli.egg-info/requires.txt +1 -1
  22. splight-cli-2.3.12/cli/__init__.py +0 -1
  23. splight-cli-2.3.12/cli/utils/api_requests.py +0 -35
  24. splight-cli-2.3.12/cli/utils/headers.py +0 -8
  25. splight-cli-2.3.12/cli/utils/uuid.py +0 -8
  26. splight-cli-2.3.12/cli/utils/validation.py +0 -6
  27. splight-cli-2.3.12/cli/version.py +0 -1
  28. splight-cli-2.3.12/splight_cli.egg-info/entry_points.txt +0 -3
  29. {splight-cli-2.3.12/cli/component/tests → splight-cli-2.3.14/cli}/__init__.py +0 -0
  30. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/component/exceptions.py +0 -0
  31. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/component/loaders.py +0 -0
  32. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/component/spec.py +0 -0
  33. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/component/templates/Initialization +0 -0
  34. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/component/templates/README.md +0 -0
  35. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/component/templates/auto_readme.md +0 -0
  36. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/component/templates/component.py +0 -0
  37. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/component/templates/spec.json +0 -0
  38. {splight-cli-2.3.12/cli/engine/datalake → splight-cli-2.3.14/cli/component}/tests/__init__.py +0 -0
  39. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/component/tests/test_create.py +0 -0
  40. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/component/tests/test_initialize.py +0 -0
  41. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/config/__init__.py +0 -0
  42. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/constants.py +0 -0
  43. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/context/framework.py +0 -0
  44. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/context/workspace.py +0 -0
  45. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/deployment/__init__.py +0 -0
  46. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/deployment/deployment.py +0 -0
  47. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/engine/__init__.py +0 -0
  48. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/engine/alert/__init__.py +0 -0
  49. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/engine/asset/__init__.py +0 -0
  50. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/engine/attribute/__init__.py +0 -0
  51. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/engine/component/__init__.py +0 -0
  52. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/engine/datalake/__init__.py +0 -0
  53. {splight-cli-2.3.12/cli → splight-cli-2.3.14/cli/engine/datalake}/tests/__init__.py +0 -0
  54. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/engine/datalake/tests/test_dump.py +0 -0
  55. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/engine/datalake/tests/test_load.py +0 -0
  56. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/engine/file/__init__.py +0 -0
  57. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/engine/graph/__init__.py +0 -0
  58. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/engine/manager/__init__.py +0 -0
  59. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/engine/manager/manager.py +0 -0
  60. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/engine/query/__init__.py +0 -0
  61. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/engine/secret/__init__.py +0 -0
  62. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/engine/setpoint/__init__.py +0 -0
  63. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/hub/__init__.py +0 -0
  64. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/hub/component/__init__.py +0 -0
  65. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/hub/component/exceptions.py +0 -0
  66. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/tests/TestHub/__init__.py +0 -0
  67. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/utils/input.py +0 -0
  68. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/utils/json.py +0 -0
  69. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/utils/loader.py +0 -0
  70. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/utils/pprint.py +0 -0
  71. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/utils/template.py +0 -0
  72. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/utils/yaml.py +0 -0
  73. {splight-cli-2.3.12 → splight-cli-2.3.14}/cli/workspace/__init__.py +0 -0
  74. {splight-cli-2.3.12 → splight-cli-2.3.14}/setup.cfg +0 -0
  75. {splight-cli-2.3.12 → splight-cli-2.3.14}/splight_cli.egg-info/dependency_links.txt +0 -0
  76. {splight-cli-2.3.12 → splight-cli-2.3.14}/splight_cli.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: splight-cli
3
- Version: 2.3.12
3
+ Version: 2.3.14
4
4
  Summary: CLI tool to build and run Splight components
5
5
  Home-page: UNKNOWN
6
6
  Author: Splight
@@ -538,8 +538,35 @@ the limit is your imagination.
538
538
 
539
539
  #### Running Locally
540
540
 
541
- You can run the component locally before pushing it to the platform
541
+ You can run the component locally before pushing it to the platform with the `--local` option:
542
542
 
543
543
  ```bash
544
- splight component run <component directory>
544
+ splight component run <component directory> --local
545
545
  ```
546
+
547
+ This way, the component will run using local clients for database and datalake. This is extremely
548
+ useful for development since you can create instances of the different database objects in the
549
+ local database for running different scenearios or differents tests. The same can be applied for
550
+ datalake data, the local client stores the data in files. In both cases, for database and datalake,
551
+ the files are created in the same directory as the `__init__.py` file of the component, so you
552
+ can modified it based on your needs.
553
+
554
+ You can interact with the local databases using the library, for example
555
+
556
+ ```python
557
+ from splight_models import Asset, Attribute, Number
558
+ from splight_lib.client.database import LocalDatabaseClient
559
+ from splight_lib.client.datalake import LocalDatalakeClient
560
+
561
+
562
+ component_path = ...
563
+ db_client = LocalDatabaseClient(namespace="default", path=component_path)
564
+ dl_client = LocalDatalakeClient(namespace="default", path=component_path)
565
+
566
+ all_assets = db_client.get(Asset)
567
+ attribute = Attribute(name="SomeAttribute")
568
+
569
+ db_client.save(attribute)
570
+
571
+ df = client.get_dataframe(Number, asset=all_assets[0].id, attribute=attribute.id)
572
+ ```
@@ -38,43 +38,3 @@ def main(
38
38
  ),
39
39
  ):
40
40
  ctx.obj = Context()
41
-
42
-
43
- # @cli.group()
44
- # @pass_context
45
- # @needs_credentials
46
- # def component(ctx):
47
- # ctx.obj = Context()
48
- #
49
- #
50
- # @cli.group()
51
- # @pass_context
52
- # @needs_credentials
53
- # def datalake(ctx):
54
- # ctx.obj = Context()
55
- #
56
- #
57
- # @cli.group()
58
- # @pass_context
59
- # @needs_credentials
60
- # def database(ctx):
61
- # ctx.obj = Context()
62
- #
63
- #
64
- # @cli.group()
65
- # @pass_context
66
- # @needs_credentials
67
- # def deployment(ctx):
68
- # ctx.obj = Context()
69
- #
70
- #
71
- # @cli.group()
72
- # @pass_context
73
- # def workspace(ctx):
74
- # ctx.obj = Context()
75
- #
76
- #
77
- # @cli.group(cls=DefaultGroup, default="config", default_if_no_args=True)
78
- # @pass_context
79
- # def configure(ctx: Context, from_json: str = False) -> None:
80
- # ctx.obj = Context()
@@ -1,14 +1,15 @@
1
1
  import json
2
2
  import logging
3
- from typing import List, Optional
4
3
  from pathlib import Path
4
+ from typing import Optional
5
5
 
6
6
  import typer
7
7
  from rich.console import Console
8
8
 
9
- from cli.context import check_credentials
10
9
  from cli.component.component import Component
11
10
  from cli.constants import error_style, success_style
11
+ from cli.context import check_credentials
12
+ from cli.context.context import local_environment_context
12
13
 
13
14
  component_app = typer.Typer(
14
15
  name="Splight Component",
@@ -41,13 +42,11 @@ def create(
41
42
  abs_path = str(Path(path).resolve())
42
43
  console.print(
43
44
  f"Component {name} created successfully in {abs_path}",
44
- style=success_style
45
+ style=success_style,
45
46
  )
46
47
 
47
48
  except Exception as e:
48
- console.print(
49
- f"Error creating component: {str(e)}", style=error_style
50
- )
49
+ console.print(f"Error creating component: {str(e)}", style=error_style)
51
50
  typer.Exit(1)
52
51
 
53
52
 
@@ -59,32 +58,53 @@ def run(
59
58
  component_id: str = typer.Option(
60
59
  None, "--component-id", "-id", help="Component's ID"
61
60
  ),
61
+ local_dev: bool = typer.Option(
62
+ False,
63
+ "--local",
64
+ callback=local_environment_context,
65
+ is_eager=True
66
+ ),
62
67
  ) -> None:
63
68
  try:
64
69
  component = Component(ctx.obj)
65
70
  console.print("Running component...", style=success_style)
66
71
  input = json.loads(input) if input else None
67
- component.run(path, input_parameters=input, component_id=component_id)
72
+ component.run(
73
+ path,
74
+ input_parameters=input,
75
+ component_id=component_id,
76
+ )
68
77
  except Exception as e:
69
78
  logger.exception(e)
70
79
  console.print(f"Error running component: {str(e)}", style=error_style)
71
80
  typer.Exit(1)
72
81
 
82
+
73
83
  @component_app.command()
74
84
  def upgrade(
75
85
  ctx: typer.Context,
76
- from_component_id: str = typer.Option(None, "--from-component-id", "-f", help="From Component's ID"),
77
- to_component_id: str = typer.Option(None, "--to-component-id", "-t", help="To Component's ID"),
86
+ from_component_id: str = typer.Option(
87
+ None, "--from-component-id", "-f", help="From Component's ID"
88
+ ),
89
+ to_component_id: str = typer.Option(
90
+ None, "--to-component-id", "-t", help="To Component's ID"
91
+ ),
78
92
  ) -> None:
79
93
  try:
80
94
  component = Component(ctx.obj)
81
95
  console.print("Upgrading component...", style=success_style)
82
- component.upgrade(from_component_id=from_component_id, to_component_id=to_component_id)
96
+ component.upgrade(
97
+ from_component_id=from_component_id,
98
+ to_component_id=to_component_id,
99
+ )
83
100
  except Exception as e:
84
101
  logger.exception(e)
85
- console.print(f"Error upgrading component: {str(e)}", style=error_style)
102
+ console.print(
103
+ f"Error upgrading component: {str(e)}", style=error_style
104
+ )
86
105
  typer.Exit(1)
87
106
 
107
+
88
108
  @component_app.command()
89
109
  def install_requirements(
90
110
  ctx: typer.Context,
@@ -113,7 +133,7 @@ def readme(
113
133
  "--force",
114
134
  "-f",
115
135
  help="Delete if a Readme exists",
116
- )
136
+ ),
117
137
  ) -> None:
118
138
  try:
119
139
  component = Component(ctx.obj)
@@ -121,10 +141,6 @@ def readme(
121
141
  component.readme(path, force)
122
142
  except Exception as e:
123
143
  console.print(
124
- f"Error generating component README: {str(e)}",
125
- style=error_style
144
+ f"Error generating component README: {str(e)}", style=error_style
126
145
  )
127
146
  typer.Exit(1)
128
-
129
-
130
-
@@ -11,7 +11,6 @@ from splight_models import Component as ComponentModel
11
11
  from cli.component.exceptions import InvalidSplightCLIVersion, ReadmeExists
12
12
  from cli.component.loaders import ComponentLoader, InitLoader, SpecLoader
13
13
  from cli.component.spec import Spec
14
- from cli.component.exceptions import InvalidSplightCLIVersion, ReadmeExists
15
14
  from cli.constants import COMPONENT_FILE, README_FILE_1, SPLIGHT_IGNORE
16
15
  from cli.utils import get_template, input_single
17
16
  from cli.version import __version__
@@ -68,7 +67,7 @@ class Component:
68
67
  self,
69
68
  path: str,
70
69
  input_parameters: Optional[List[Dict]] = None,
71
- component_id: str = None,
70
+ component_id: Optional[str] = None,
72
71
  ):
73
72
  # Load py module and validate Splight Component structure
74
73
  loader = ComponentLoader(path=path)
@@ -78,7 +77,10 @@ class Component:
78
77
 
79
78
  if component_id and not input_parameters:
80
79
  remote_input_parameters = []
81
- db_client = self.context.framework.setup.DATABASE_CLIENT()
80
+ db_client = self.context.framework.setup.DATABASE_CLIENT(
81
+ namespace="default",
82
+ path=path
83
+ )
82
84
  component_input = db_client.get(
83
85
  ComponentModel, id=component_id, first=True
84
86
  ).input
@@ -94,6 +96,8 @@ class Component:
94
96
  run_spec=run_spec.dict(),
95
97
  initial_setup=self.context.workspace.settings.dict(),
96
98
  component_id=component_id,
99
+ database_config={"path": path},
100
+ datalake_config={"path": path},
97
101
  )
98
102
  component.execution_client.start(Thread(target=component.start))
99
103
 
@@ -1,4 +1,5 @@
1
1
  import os
2
+
2
3
  os.environ["SPLIGHT_ACCESS_ID"] = "access_id"
3
4
  os.environ["SPLIGHT_SECRET_KEY"] = "secret_key"
4
5
 
@@ -12,9 +13,11 @@ from cli.tests.test_generic import SplightCLITest
12
13
 
13
14
 
14
15
  class TestRun(SplightCLITest):
15
-
16
16
  @patch.object(Component, "_validate_cli_version", return_value=None)
17
- @patch("remote_splight_lib.datalake.DatalakeClient.create_index", return_value=None)
17
+ @patch(
18
+ "splight_lib.client.datalake.RemoteDatalakeClient.create_index",
19
+ return_value=None,
20
+ )
18
21
  def test_run(self, mock, mock1):
19
22
  self.component = Component(self.context)
20
23
  self.configure()
@@ -1,13 +1,12 @@
1
- # import click
2
1
  import typer
3
2
 
4
- # from functools import wraps
5
3
  from rich.console import Console
6
4
 
7
5
  from cli.constants import error_style
8
6
  from cli.context.framework import FrameworkManager
9
7
  from cli.context.workspace import WorkspaceManager
10
8
 
9
+
11
10
  console = Console()
12
11
 
13
12
 
@@ -29,9 +28,6 @@ class Context:
29
28
  return f"<Context {self.__workspace}>"
30
29
 
31
30
 
32
- # pass_context = click.make_pass_decorator(Context)
33
-
34
-
35
31
  def check_credentials(ctx: typer.Context):
36
32
  settings = ctx.obj.workspace.settings
37
33
 
@@ -43,19 +39,3 @@ def check_credentials(ctx: typer.Context):
43
39
  style=error_style,
44
40
  )
45
41
  raise typer.Exit(1)
46
-
47
-
48
- # def needs_credentials(f):
49
- # @wraps(f)
50
- # def wrapper(ctx: typer.Context, *args, **kwargs):
51
- # __import__('ipdb').set_trace()
52
- # access_id = ctx.workspace.settings.SPLIGHT_ACCESS_ID
53
- # secret_key = ctx.workspace.settings.SPLIGHT_SECRET_KEY
54
- # if access_id is None or secret_key is None:
55
- # click.secho(
56
- # "Please set your Splight credentials. Use \"splightcli configure\"",
57
- # fg="red"
58
- # )
59
- # exit(1)
60
- # return f(ctx, *args, **kwargs)
61
- # return wrapper
@@ -0,0 +1,9 @@
1
+ import typer
2
+
3
+
4
+ def local_environment_context(ctx: typer.Context, local_dev: bool):
5
+ if local_dev:
6
+ db_client_mod = "splight_lib.client.database.LocalDatabaseClient"
7
+ dl_client_mod = "splight_lib.client.datalake.LocalDatalakeClient"
8
+ ctx.obj.workspace.settings.DATABASE_CLIENT = db_client_mod
9
+ ctx.obj.workspace.settings.DATALAKE_CLIENT = dl_client_mod
@@ -1,11 +1,5 @@
1
- import os
2
-
3
- os.environ["SPLIGHT_ACCESS_ID"] = "access_id"
4
- os.environ["SPLIGHT_SECRET_KEY"] = "secret_key"
5
-
6
1
  from unittest.mock import patch
7
2
 
8
- from remote_splight_lib.database import DatabaseClient
9
3
  from splight_models import Component
10
4
 
11
5
  from cli.engine.datalake import datalake_app
@@ -27,7 +21,7 @@ class TestList(SplightCLITest):
27
21
  super().setUp()
28
22
 
29
23
  @patch(
30
- "remote_splight_lib.database.DatabaseClient.get",
24
+ "splight_lib.client.database.RemoteDatabaseClient.get",
31
25
  return_value=remote_collections,
32
26
  )
33
27
  def test_list(self, mock):
@@ -114,16 +114,16 @@ class HubComponentManager:
114
114
  readme_path = os.path.join(path, README_FILE_2)
115
115
 
116
116
  try:
117
- ignore_pathpec = self._get_ignore_pathspec(path)
117
+ ignore_pathspec = self._get_ignore_pathspec(path)
118
118
  with py7zr.SevenZipFile(file_name, "w") as archive:
119
119
  for root, _, files in os.walk(path):
120
- if ignore_pathpec and ignore_pathpec.match_file(root):
120
+ if ignore_pathspec and ignore_pathspec.match_file(root):
121
121
  continue
122
122
  for file in files:
123
- if ignore_pathpec and ignore_pathpec.match_file(os.path.join(root, file)):
123
+ if ignore_pathspec and ignore_pathspec.match_file(os.path.join(root, file)):
124
124
  continue
125
125
  filepath = os.path.join(root, file)
126
- archive.write(filepath, os.path.join(versioned_name, filepath))
126
+ archive.write(filepath, os.path.join(versioned_name, file))
127
127
  data = {
128
128
  "name": name,
129
129
  "version": version,
@@ -10,12 +10,9 @@ class SplightCLISettings(BaseSettings):
10
10
  SPLIGHT_SECRET_KEY: str = ""
11
11
  SPLIGHT_PLATFORM_API_HOST: str = "https://api.splight-ai.com"
12
12
  # FRAMEWORK
13
- DATABASE_CLIENT: str = "remote_splight_lib.database.DatabaseClient"
14
- DATALAKE_CLIENT: str = "remote_splight_lib.datalake.DatalakeClient"
13
+ DATABASE_CLIENT: str = "splight_lib.client.database.RemoteDatabaseClient"
14
+ DATALAKE_CLIENT: str = "splight_lib.client.datalake.RemoteDatalakeClient"
15
15
  HUB_CLIENT: str = "remote_splight_lib.hub.SplightHubClient"
16
- STORAGE_CLIENT: str = "remote_splight_lib.storage.StorageClient"
17
- BLOCKCHAIN_CLIENT: str = "remote_splight_lib.blockchain.BlockchainClient"
18
- DEPLOYMENT_CLIENT: str = "remote_splight_lib.deployment.DeploymentClient"
19
16
  COMMUNICATION_CLIENT: str = (
20
17
  "remote_splight_lib.communication.CommunicationClient"
21
18
  )
File without changes
@@ -9,6 +9,8 @@ from cli.tests.test_generic import SplightCLITest
9
9
 
10
10
  class TestConfigure(SplightCLITest):
11
11
  def test_configure_requested(self):
12
+ self.context.workspace.settings.SPLIGHT_ACCESS_ID = ""
13
+ self.context.workspace.settings.SPLIGHT_SECRET_KEY = ""
12
14
  with patch.object(
13
15
  HubComponentManager, "list_components", return_value=None
14
16
  ):
@@ -103,6 +103,7 @@ class SplightCLITest(TestCase):
103
103
  self.context = FakeContext()
104
104
  self.runner = CliRunner()
105
105
  self.custompath = self.name + self.version + self.component_id
106
+ self.configure()
106
107
 
107
108
  @property
108
109
  def default_configuration(self):
@@ -1,8 +1,5 @@
1
1
  from cli.utils.template import *
2
- from cli.utils.validation import *
3
2
  from cli.utils.json import *
4
- from cli.utils.api_requests import *
5
3
  from cli.utils.yaml import *
6
4
  from cli.utils.input import *
7
5
  from cli.utils.pprint import *
8
- from cli.utils.uuid import *
@@ -0,0 +1 @@
1
+ __version__ = "2.3.14"
@@ -27,7 +27,7 @@ setup(
27
27
  dependency_links=dependency_links,
28
28
  entry_points={
29
29
  'console_scripts': [
30
- 'splight = cli:cli.app',
30
+ 'splight = cli.cli:app',
31
31
  ],
32
32
  },
33
33
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: splight-cli
3
- Version: 2.3.12
3
+ Version: 2.3.14
4
4
  Summary: CLI tool to build and run Splight components
5
5
  Home-page: UNKNOWN
6
6
  Author: Splight
@@ -21,6 +21,7 @@ cli/component/tests/test_initialize.py
21
21
  cli/component/tests/test_run.py
22
22
  cli/config/__init__.py
23
23
  cli/context/__init__.py
24
+ cli/context/context.py
24
25
  cli/context/framework.py
25
26
  cli/context/workspace.py
26
27
  cli/deployment/__init__.py
@@ -51,15 +52,11 @@ cli/tests/test_configure.py
51
52
  cli/tests/test_generic.py
52
53
  cli/tests/TestHub/__init__.py
53
54
  cli/utils/__init__.py
54
- cli/utils/api_requests.py
55
- cli/utils/headers.py
56
55
  cli/utils/input.py
57
56
  cli/utils/json.py
58
57
  cli/utils/loader.py
59
58
  cli/utils/pprint.py
60
59
  cli/utils/template.py
61
- cli/utils/uuid.py
62
- cli/utils/validation.py
63
60
  cli/utils/yaml.py
64
61
  cli/workspace/__init__.py
65
62
  splight_cli.egg-info/PKG-INFO
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ splight = cli.cli:app
3
+
@@ -7,5 +7,5 @@ py7zr==0.18.5
7
7
  requests==2.27.1
8
8
  rich==13.0.1
9
9
  setuptools==60.9.3
10
- splight-lib==2.2.3
10
+ splight-lib==2.2.4
11
11
  typer==0.7.0
@@ -1 +0,0 @@
1
- from cli.cli import app
@@ -1,35 +0,0 @@
1
- import requests
2
- import json
3
- from functools import wraps
4
- from cli.constants import *
5
- from requests.exceptions import ConnectionError
6
-
7
- def http_request_validation(func):
8
- @wraps(func)
9
- def wrapper(*args, **kwargs):
10
- try:
11
- response = func(*args, **kwargs)
12
- if response.status_code >= 400:
13
- response = response.json()
14
- detail = response.get("detail", None)
15
-
16
- if detail in ["Invalid token.", "Authentication credentials were not provided.", "Incorrect authentication credentials."]:
17
- raise Exception(f"{detail} Please check your Splight credentials. Use 'splightcli configure'")
18
-
19
- raise Exception(f"An unknown error ocurred while trying to reach Splight Hub API: {json.dumps(response)}")
20
- return response
21
- except ConnectionError:
22
- raise Exception(f"Splight Hub API is unreachable: Check out your configuration for Splight Hub API host. Use 'splightcli configure'")
23
- return wrapper
24
-
25
- @http_request_validation
26
- def api_get(*args, **kwargs):
27
- return requests.get(*args, **kwargs)
28
-
29
- @http_request_validation
30
- def api_post(*args, **kwargs):
31
- return requests.post(*args, **kwargs)
32
-
33
- @http_request_validation
34
- def api_delete(*args, **kwargs):
35
- return requests.delete(*args, **kwargs)
@@ -1,8 +0,0 @@
1
- from typing import Dict
2
-
3
- from cli.settings import SplightCLISettings
4
-
5
-
6
- def extract_headers(config: SplightCLISettings) -> Dict[str, str]:
7
- header = f"Splight {config.SPLIGHT_ACCESS_ID} {config.SPLIGHT_SECRET_KEY}"
8
- return {"Authorization": header}
@@ -1,8 +0,0 @@
1
- import uuid
2
-
3
- def is_valid_uuid(value: str):
4
- try:
5
- uuid.UUID(value)
6
- return True
7
- except ValueError:
8
- return False
@@ -1,6 +0,0 @@
1
- import os
2
-
3
- def validate_path_isdir(path: str) -> str:
4
- if not os.path.isdir(path):
5
- raise ValueError(f"Path provided: \"{path}\" is not a directory")
6
- return path
@@ -1 +0,0 @@
1
- __version__ = "2.3.12"
@@ -1,3 +0,0 @@
1
- [console_scripts]
2
- splight = cli:cli.app
3
-
File without changes