blocks-cli 0.1.31__tar.gz → 0.1.33__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.31 → blocks-cli-0.1.33}/PKG-INFO +1 -1
  2. {blocks-cli-0.1.31 → blocks-cli-0.1.33}/blocks_cli/builds.py +9 -3
  3. {blocks-cli-0.1.31 → blocks-cli-0.1.33}/blocks_cli/bundles.py +16 -6
  4. {blocks-cli-0.1.31 → blocks-cli-0.1.33}/blocks_cli/commands/push.py +5 -2
  5. {blocks-cli-0.1.31 → blocks-cli-0.1.33}/setup.py +1 -1
  6. {blocks-cli-0.1.31 → blocks-cli-0.1.33}/LICENSE +0 -0
  7. {blocks-cli-0.1.31 → blocks-cli-0.1.33}/MANIFEST.in +0 -0
  8. {blocks-cli-0.1.31 → blocks-cli-0.1.33}/README.md +0 -0
  9. {blocks-cli-0.1.31 → blocks-cli-0.1.33}/blocks_cli/__init__.py +0 -0
  10. {blocks-cli-0.1.31 → blocks-cli-0.1.33}/blocks_cli/api.py +0 -0
  11. {blocks-cli-0.1.31 → blocks-cli-0.1.33}/blocks_cli/commands/__base__.py +0 -0
  12. {blocks-cli-0.1.31 → blocks-cli-0.1.33}/blocks_cli/commands/__init__.py +0 -0
  13. {blocks-cli-0.1.31 → blocks-cli-0.1.33}/blocks_cli/commands/configure.py +0 -0
  14. {blocks-cli-0.1.31 → blocks-cli-0.1.33}/blocks_cli/commands/create.py +0 -0
  15. {blocks-cli-0.1.31 → blocks-cli-0.1.33}/blocks_cli/commands/init.py +0 -0
  16. {blocks-cli-0.1.31 → blocks-cli-0.1.33}/blocks_cli/commands/test.py +0 -0
  17. {blocks-cli-0.1.31 → blocks-cli-0.1.33}/blocks_cli/config/__init__.py +0 -0
  18. {blocks-cli-0.1.31 → blocks-cli-0.1.33}/blocks_cli/config/auth.py +0 -0
  19. {blocks-cli-0.1.31 → blocks-cli-0.1.33}/blocks_cli/config/config.py +0 -0
  20. {blocks-cli-0.1.31 → blocks-cli-0.1.33}/blocks_cli/console.py +0 -0
  21. {blocks-cli-0.1.31 → blocks-cli-0.1.33}/blocks_cli/fs.py +0 -0
  22. {blocks-cli-0.1.31 → blocks-cli-0.1.33}/blocks_cli/package.py +0 -0
  23. {blocks-cli-0.1.31 → blocks-cli-0.1.33}/blocks_cli/registration.py +0 -0
  24. {blocks-cli-0.1.31 → blocks-cli-0.1.33}/blocks_cli.egg-info/SOURCES.txt +0 -0
  25. {blocks-cli-0.1.31 → blocks-cli-0.1.33}/requirements.txt +0 -0
  26. {blocks-cli-0.1.31 → blocks-cli-0.1.33}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: blocks-cli
3
- Version: 0.1.31
3
+ Version: 0.1.33
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,19 @@ 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
19
  random_file_name = str(uuid.uuid4())
20
- zip_filename = f"{random_file_name}.zip"
20
+ zip_filename_only = f"{random_file_name}.zip"
21
+
22
+ if zip_file_path:
23
+ # Use provided directory path
24
+ zip_directory = zip_file_path
25
+ zip_directory.mkdir(parents=True, exist_ok=True)
26
+ zip_filename = str(zip_directory / zip_filename_only)
27
+ else:
28
+ # Use current directory
29
+ zip_filename = zip_filename_only
21
30
 
22
31
  if os.path.exists(zip_filename):
23
32
  os.remove(zip_filename)
@@ -46,7 +55,8 @@ def upload_bundle_zip(bundle_upload_url: str, base_path: Path):
46
55
  except Exception:
47
56
  raise
48
57
  finally:
49
- # Remove the zip file
50
- os.remove(zip_filename)
58
+ # Remove the zip file only if delete_after_upload is True
59
+ if delete_after_upload and os.path.exists(zip_filename):
60
+ os.remove(zip_filename)
51
61
 
52
- return response.text
62
+ return response.text
@@ -75,7 +75,7 @@ def push(file: Path = typer.Argument(..., help="Name of blocks file to push.")):
75
75
  init_progress.update(
76
76
  init_task, total=1, description="Bundle uploaded successfully"
77
77
  )
78
- upload_bundle_zip(bundle_upload_url, cwd)
78
+ upload_bundle_zip(bundle_upload_url, cwd, cwd.parent)
79
79
  init_progress.update(
80
80
  init_task, total=1, description="Bundle uploaded successfully"
81
81
  )
@@ -212,9 +212,12 @@ def push(file: Path = typer.Argument(..., help="Name of blocks file to push.")):
212
212
  build_task, total=1, description="Build succeeded"
213
213
  )
214
214
  except Exception as e:
215
+ error_message = str(e)
215
216
  build_progress.update(
216
- 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"
217
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]")
218
221
  raise typer.Exit(1)
219
222
  except Exception as e:
220
223
  console.print(f"[red]{str(e)}[/red]")
@@ -6,7 +6,7 @@ with open("requirements.txt") as f:
6
6
 
7
7
  setup(
8
8
  name="blocks-cli",
9
- version="0.1.31",
9
+ version="0.1.33",
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