blocks-cli 0.1.30__tar.gz → 0.1.32__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 (26) hide show
  1. {blocks-cli-0.1.30 → blocks-cli-0.1.32}/PKG-INFO +1 -1
  2. {blocks-cli-0.1.30 → blocks-cli-0.1.32}/blocks_cli/builds.py +9 -3
  3. {blocks-cli-0.1.30 → blocks-cli-0.1.32}/blocks_cli/bundles.py +15 -7
  4. {blocks-cli-0.1.30 → blocks-cli-0.1.32}/blocks_cli/commands/push.py +19 -2
  5. {blocks-cli-0.1.30 → blocks-cli-0.1.32}/requirements.txt +2 -1
  6. {blocks-cli-0.1.30 → blocks-cli-0.1.32}/setup.py +1 -1
  7. {blocks-cli-0.1.30 → blocks-cli-0.1.32}/LICENSE +0 -0
  8. {blocks-cli-0.1.30 → blocks-cli-0.1.32}/MANIFEST.in +0 -0
  9. {blocks-cli-0.1.30 → blocks-cli-0.1.32}/README.md +0 -0
  10. {blocks-cli-0.1.30 → blocks-cli-0.1.32}/blocks_cli/__init__.py +0 -0
  11. {blocks-cli-0.1.30 → blocks-cli-0.1.32}/blocks_cli/api.py +0 -0
  12. {blocks-cli-0.1.30 → blocks-cli-0.1.32}/blocks_cli/commands/__base__.py +0 -0
  13. {blocks-cli-0.1.30 → blocks-cli-0.1.32}/blocks_cli/commands/__init__.py +0 -0
  14. {blocks-cli-0.1.30 → blocks-cli-0.1.32}/blocks_cli/commands/configure.py +0 -0
  15. {blocks-cli-0.1.30 → blocks-cli-0.1.32}/blocks_cli/commands/create.py +0 -0
  16. {blocks-cli-0.1.30 → blocks-cli-0.1.32}/blocks_cli/commands/init.py +0 -0
  17. {blocks-cli-0.1.30 → blocks-cli-0.1.32}/blocks_cli/commands/test.py +0 -0
  18. {blocks-cli-0.1.30 → blocks-cli-0.1.32}/blocks_cli/config/__init__.py +0 -0
  19. {blocks-cli-0.1.30 → blocks-cli-0.1.32}/blocks_cli/config/auth.py +0 -0
  20. {blocks-cli-0.1.30 → blocks-cli-0.1.32}/blocks_cli/config/config.py +0 -0
  21. {blocks-cli-0.1.30 → blocks-cli-0.1.32}/blocks_cli/console.py +0 -0
  22. {blocks-cli-0.1.30 → blocks-cli-0.1.32}/blocks_cli/fs.py +0 -0
  23. {blocks-cli-0.1.30 → blocks-cli-0.1.32}/blocks_cli/package.py +0 -0
  24. {blocks-cli-0.1.30 → blocks-cli-0.1.32}/blocks_cli/registration.py +0 -0
  25. {blocks-cli-0.1.30 → blocks-cli-0.1.32}/blocks_cli.egg-info/SOURCES.txt +0 -0
  26. {blocks-cli-0.1.30 → blocks-cli-0.1.32}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: blocks-cli
3
- Version: 0.1.30
3
+ Version: 0.1.32
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
@@ -17,7 +17,13 @@ def poll_build_status(image_id: str, build_id: str):
17
17
  build_completed = is_completed
18
18
 
19
19
  if is_completed and not is_succeeded:
20
- raise Exception("Build failed")
21
- except Exception:
22
- raise Exception("Failed to retrieve build status")
20
+ error_message = build_status_response.get("error_message") or "Unknown build error"
21
+ logs = build_status_response.get("logs")
22
+ if logs:
23
+ error_message += f"\nBuild logs: {logs}"
24
+ raise Exception(f"Build failed: {error_message}")
25
+ except Exception as e:
26
+ if "Build failed" in str(e):
27
+ raise
28
+ raise Exception(f"Failed to retrieve build status: {str(e)}")
23
29
 
@@ -1,6 +1,7 @@
1
1
  import os
2
2
  import requests
3
3
  from pathlib import Path
4
+ from typing import Optional
4
5
  import uuid
5
6
  import zipfile
6
7
 
@@ -13,11 +14,17 @@ def get_bundle_upload_url():
13
14
  return response.json()
14
15
 
15
16
 
16
- def upload_bundle_zip(bundle_upload_url: str, base_path: Path):
17
+ def upload_bundle_zip(bundle_upload_url: str, base_path: Path, zip_file_path: Optional[Path] = None, delete_after_upload: bool = True):
17
18
  try:
18
- # Generate a unique ID for the run
19
- random_file_name = str(uuid.uuid4())
20
- zip_filename = f"{random_file_name}.zip"
19
+ # Determine zip filename based on provided path or generate a unique one
20
+ if zip_file_path:
21
+ zip_filename = str(zip_file_path)
22
+ # Ensure the directory exists
23
+ zip_file_path.parent.mkdir(parents=True, exist_ok=True)
24
+ else:
25
+ # Generate a unique ID for the run
26
+ random_file_name = str(uuid.uuid4())
27
+ zip_filename = f"{random_file_name}.zip"
21
28
 
22
29
  if os.path.exists(zip_filename):
23
30
  os.remove(zip_filename)
@@ -46,7 +53,8 @@ def upload_bundle_zip(bundle_upload_url: str, base_path: Path):
46
53
  except Exception:
47
54
  raise
48
55
  finally:
49
- # Remove the zip file
50
- os.remove(zip_filename)
56
+ # Remove the zip file only if delete_after_upload is True
57
+ if delete_after_upload and os.path.exists(zip_filename):
58
+ os.remove(zip_filename)
51
59
 
52
- return response.text
60
+ return response.text
@@ -121,6 +121,7 @@ def push(file: Path = typer.Argument(..., help="Name of blocks file to push.")):
121
121
  gpu_type = task_kwargs.get("gpu_type")
122
122
  runtime = task_kwargs.get("runtime") # e.x. "python3.10"
123
123
  plugins = task_kwargs.get("plugins", [])
124
+ required_env_vars = task_kwargs.get("required_env_vars", [])
124
125
 
125
126
  repos: list = trigger_kwargs.get("repos", [])
126
127
 
@@ -139,6 +140,7 @@ def push(file: Path = typer.Argument(..., help="Name of blocks file to push.")):
139
140
  "runner": runner,
140
141
  "runtime": runtime,
141
142
  "plugins": plugins,
143
+ "required_env_vars": required_env_vars,
142
144
  "vcpus": vcpus,
143
145
  "memory": memory,
144
146
  "gpu_count": gpu_count,
@@ -153,7 +155,19 @@ def push(file: Path = typer.Argument(..., help="Name of blocks file to push.")):
153
155
  additional_task_kwargs = {
154
156
  k: v
155
157
  for k, v in task_kwargs.items()
156
- if k not in ["vcpus", "memory_mib", "gpu_count", "gpu_type", "name", "runtime", "runner", "config_class", "plugins", "config_schema"]
158
+ if k not in [
159
+ "vcpus",
160
+ "memory_mib",
161
+ "gpu_count",
162
+ "gpu_type",
163
+ "name",
164
+ "runtime",
165
+ "runner",
166
+ "config_class",
167
+ "plugins",
168
+ "config_schema",
169
+ "required_env_vars"
170
+ ]
157
171
  }
158
172
  automation_config["trigger_kwargs"] = trigger_kwargs
159
173
  automation_config["task_kwargs"] = additional_task_kwargs
@@ -198,9 +212,12 @@ def push(file: Path = typer.Argument(..., help="Name of blocks file to push.")):
198
212
  build_task, total=1, description="Build succeeded"
199
213
  )
200
214
  except Exception as e:
215
+ error_message = str(e)
201
216
  build_progress.update(
202
- build_task, total=1, description="Build failed, please try again. If the issue persists check your automation's requirements.txt to ensure all dependencies are valid and/or our status page at https://status.blocksorg.com"
217
+ build_task, total=1, description="Build failed"
203
218
  )
219
+ console.print(f"[red]Error: {error_message}[/red]")
220
+ console.print("[yellow]Please check your automation's requirements.txt to ensure all dependencies are valid and/or our status page at https://status.blocksorg.com[/yellow]")
204
221
  raise typer.Exit(1)
205
222
  except Exception as e:
206
223
  console.print(f"[red]{str(e)}[/red]")
@@ -2,4 +2,5 @@ typer>=0.13.1,<0.16.0
2
2
  toml>=0.10.0,<0.11.0
3
3
  GitPython>=3.1.14,<4
4
4
  pydantic-settings>=2.0.0,<3.0.0
5
- pydantic-settings[toml]
5
+ pydantic-settings[toml]
6
+ requests
@@ -6,7 +6,7 @@ with open("requirements.txt") as f:
6
6
 
7
7
  setup(
8
8
  name="blocks-cli",
9
- version="0.1.30",
9
+ version="0.1.32",
10
10
  packages=find_packages(),
11
11
  include_package_data=True,
12
12
  install_requires=requirements,
File without changes
File without changes
File without changes
File without changes