blocks-cli 0.1.28__tar.gz → 0.1.30__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 (27) hide show
  1. {blocks-cli-0.1.28 → blocks-cli-0.1.30}/PKG-INFO +1 -1
  2. blocks-cli-0.1.30/blocks_cli/builds.py +23 -0
  3. {blocks-cli-0.1.28 → blocks-cli-0.1.30}/blocks_cli/commands/push.py +8 -2
  4. {blocks-cli-0.1.28 → blocks-cli-0.1.30}/blocks_cli/registration.py +1 -0
  5. {blocks-cli-0.1.28 → blocks-cli-0.1.30}/setup.py +1 -1
  6. blocks-cli-0.1.28/blocks_cli/builds.py +0 -20
  7. {blocks-cli-0.1.28 → blocks-cli-0.1.30}/LICENSE +0 -0
  8. {blocks-cli-0.1.28 → blocks-cli-0.1.30}/MANIFEST.in +0 -0
  9. {blocks-cli-0.1.28 → blocks-cli-0.1.30}/README.md +0 -0
  10. {blocks-cli-0.1.28 → blocks-cli-0.1.30}/blocks_cli/__init__.py +0 -0
  11. {blocks-cli-0.1.28 → blocks-cli-0.1.30}/blocks_cli/api.py +0 -0
  12. {blocks-cli-0.1.28 → blocks-cli-0.1.30}/blocks_cli/bundles.py +0 -0
  13. {blocks-cli-0.1.28 → blocks-cli-0.1.30}/blocks_cli/commands/__base__.py +0 -0
  14. {blocks-cli-0.1.28 → blocks-cli-0.1.30}/blocks_cli/commands/__init__.py +0 -0
  15. {blocks-cli-0.1.28 → blocks-cli-0.1.30}/blocks_cli/commands/configure.py +0 -0
  16. {blocks-cli-0.1.28 → blocks-cli-0.1.30}/blocks_cli/commands/create.py +0 -0
  17. {blocks-cli-0.1.28 → blocks-cli-0.1.30}/blocks_cli/commands/init.py +0 -0
  18. {blocks-cli-0.1.28 → blocks-cli-0.1.30}/blocks_cli/commands/test.py +0 -0
  19. {blocks-cli-0.1.28 → blocks-cli-0.1.30}/blocks_cli/config/__init__.py +0 -0
  20. {blocks-cli-0.1.28 → blocks-cli-0.1.30}/blocks_cli/config/auth.py +0 -0
  21. {blocks-cli-0.1.28 → blocks-cli-0.1.30}/blocks_cli/config/config.py +0 -0
  22. {blocks-cli-0.1.28 → blocks-cli-0.1.30}/blocks_cli/console.py +0 -0
  23. {blocks-cli-0.1.28 → blocks-cli-0.1.30}/blocks_cli/fs.py +0 -0
  24. {blocks-cli-0.1.28 → blocks-cli-0.1.30}/blocks_cli/package.py +0 -0
  25. {blocks-cli-0.1.28 → blocks-cli-0.1.30}/blocks_cli.egg-info/SOURCES.txt +0 -0
  26. {blocks-cli-0.1.28 → blocks-cli-0.1.30}/requirements.txt +0 -0
  27. {blocks-cli-0.1.28 → blocks-cli-0.1.30}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: blocks-cli
3
- Version: 0.1.28
3
+ Version: 0.1.30
4
4
  Summary: CLI tool for Blocks, a platform for writing custom AI-enabled codebase automations in Python. Leverage a full codebase-aware API. Automatically trigger automations from Github, Slack, and other providers.
5
5
  Home-page: https://github.com/BlocksOrg/sdk
6
6
  Author: BlocksOrg
@@ -0,0 +1,23 @@
1
+ import time
2
+
3
+ from blocks_cli.api import api_client
4
+ from blocks_cli.config.config import config
5
+
6
+ def poll_build_status(image_id: str, build_id: str):
7
+ build_completed = False
8
+ while not build_completed:
9
+ try:
10
+ time.sleep(0.5)
11
+ res = api_client.get(f"{config.clients.orchestrator_url}/v1/images/{image_id}/builds/{build_id}")
12
+ build_status_response = res.json()
13
+
14
+ is_completed = build_status_response.get("is_completed")
15
+ is_succeeded = build_status_response.get("is_succeeded")
16
+
17
+ build_completed = is_completed
18
+
19
+ if is_completed and not is_succeeded:
20
+ raise Exception("Build failed")
21
+ except Exception:
22
+ raise Exception("Failed to retrieve build status")
23
+
@@ -119,6 +119,9 @@ def push(file: Path = typer.Argument(..., help="Name of blocks file to push.")):
119
119
  memory = task_kwargs.get("memory")
120
120
  gpu_count = task_kwargs.get("gpu_count")
121
121
  gpu_type = task_kwargs.get("gpu_type")
122
+ runtime = task_kwargs.get("runtime") # e.x. "python3.10"
123
+ plugins = task_kwargs.get("plugins", [])
124
+
122
125
  repos: list = trigger_kwargs.get("repos", [])
123
126
 
124
127
  if len(repos) == 0 and git_remote_url:
@@ -126,7 +129,7 @@ def push(file: Path = typer.Argument(..., help="Name of blocks file to push.")):
126
129
 
127
130
  function_name = automation.get("function_name")
128
131
  function_source_code = automation.get("function_source_code")
129
- config_schema = automation.get("config_schema")
132
+ config_schema = automation.get("config_class").model_json_schema() if automation.get("config_class") else None
130
133
  trigger_alias = automation.get("trigger_alias")
131
134
 
132
135
  # Extract known fields
@@ -134,6 +137,8 @@ def push(file: Path = typer.Argument(..., help="Name of blocks file to push.")):
134
137
  "name": automation_name,
135
138
  "import_path": f"{file.name}:{function_name}",
136
139
  "runner": runner,
140
+ "runtime": runtime,
141
+ "plugins": plugins,
137
142
  "vcpus": vcpus,
138
143
  "memory": memory,
139
144
  "gpu_count": gpu_count,
@@ -148,10 +153,11 @@ def push(file: Path = typer.Argument(..., help="Name of blocks file to push.")):
148
153
  additional_task_kwargs = {
149
154
  k: v
150
155
  for k, v in task_kwargs.items()
151
- if k not in ["vcpus", "memory_mib", "gpu_count", "gpu_type", "name"]
156
+ if k not in ["vcpus", "memory_mib", "gpu_count", "gpu_type", "name", "runtime", "runner", "config_class", "plugins", "config_schema"]
152
157
  }
153
158
  automation_config["trigger_kwargs"] = trigger_kwargs
154
159
  automation_config["task_kwargs"] = additional_task_kwargs
160
+
155
161
  registration_payload["automations"].append(automation_config)
156
162
 
157
163
  # Register automation
@@ -1,5 +1,6 @@
1
1
  import sys
2
2
  import importlib.util
3
+
3
4
  from pathlib import Path
4
5
 
5
6
  def get_module_from_file(file: Path):
@@ -6,7 +6,7 @@ with open("requirements.txt") as f:
6
6
 
7
7
  setup(
8
8
  name="blocks-cli",
9
- version="0.1.28",
9
+ version="0.1.30",
10
10
  packages=find_packages(),
11
11
  include_package_data=True,
12
12
  install_requires=requirements,
@@ -1,20 +0,0 @@
1
- import time
2
-
3
- from blocks_cli.api import api_client
4
- from blocks_cli.config.config import config
5
-
6
- def poll_build_status(image_id: str, build_id: str):
7
- build_completed = False
8
- while not build_completed:
9
- time.sleep(0.5)
10
- res = api_client.get(f"{config.clients.orchestrator_url}/v1/images/{image_id}/builds/{build_id}")
11
- build_status_response = res.json()
12
-
13
- is_completed = build_status_response.get("is_completed")
14
- is_succeeded = build_status_response.get("is_succeeded")
15
-
16
- build_completed = is_completed
17
-
18
- if is_completed and not is_succeeded:
19
- raise Exception("Build failed")
20
-
File without changes
File without changes
File without changes
File without changes