blocks-cli 0.1.25__tar.gz → 0.1.27__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.
- {blocks-cli-0.1.25 → blocks-cli-0.1.27}/PKG-INFO +1 -1
- {blocks-cli-0.1.25 → blocks-cli-0.1.27}/blocks_cli/bundles.py +7 -7
- {blocks-cli-0.1.25 → blocks-cli-0.1.27}/blocks_cli/commands/push.py +10 -10
- {blocks-cli-0.1.25 → blocks-cli-0.1.27}/blocks_cli/config/auth.py +4 -2
- {blocks-cli-0.1.25 → blocks-cli-0.1.27}/setup.py +1 -1
- {blocks-cli-0.1.25 → blocks-cli-0.1.27}/LICENSE +0 -0
- {blocks-cli-0.1.25 → blocks-cli-0.1.27}/MANIFEST.in +0 -0
- {blocks-cli-0.1.25 → blocks-cli-0.1.27}/README.md +0 -0
- {blocks-cli-0.1.25 → blocks-cli-0.1.27}/blocks_cli/__init__.py +0 -0
- {blocks-cli-0.1.25 → blocks-cli-0.1.27}/blocks_cli/api.py +0 -0
- {blocks-cli-0.1.25 → blocks-cli-0.1.27}/blocks_cli/builds.py +0 -0
- {blocks-cli-0.1.25 → blocks-cli-0.1.27}/blocks_cli/commands/__base__.py +0 -0
- {blocks-cli-0.1.25 → blocks-cli-0.1.27}/blocks_cli/commands/__init__.py +0 -0
- {blocks-cli-0.1.25 → blocks-cli-0.1.27}/blocks_cli/commands/configure.py +0 -0
- {blocks-cli-0.1.25 → blocks-cli-0.1.27}/blocks_cli/commands/create.py +0 -0
- {blocks-cli-0.1.25 → blocks-cli-0.1.27}/blocks_cli/commands/init.py +0 -0
- {blocks-cli-0.1.25 → blocks-cli-0.1.27}/blocks_cli/commands/test.py +0 -0
- {blocks-cli-0.1.25 → blocks-cli-0.1.27}/blocks_cli/config/__init__.py +0 -0
- {blocks-cli-0.1.25 → blocks-cli-0.1.27}/blocks_cli/config/config.py +0 -0
- {blocks-cli-0.1.25 → blocks-cli-0.1.27}/blocks_cli/console.py +0 -0
- {blocks-cli-0.1.25 → blocks-cli-0.1.27}/blocks_cli/fs.py +0 -0
- {blocks-cli-0.1.25 → blocks-cli-0.1.27}/blocks_cli/package.py +0 -0
- {blocks-cli-0.1.25 → blocks-cli-0.1.27}/blocks_cli/registration.py +0 -0
- {blocks-cli-0.1.25 → blocks-cli-0.1.27}/blocks_cli.egg-info/SOURCES.txt +0 -0
- {blocks-cli-0.1.25 → blocks-cli-0.1.27}/requirements.txt +0 -0
- {blocks-cli-0.1.25 → blocks-cli-0.1.27}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: blocks-cli
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.27
|
|
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
|
|
@@ -12,6 +12,7 @@ def get_bundle_upload_url():
|
|
|
12
12
|
response.raise_for_status()
|
|
13
13
|
return response.json()
|
|
14
14
|
|
|
15
|
+
|
|
15
16
|
def upload_bundle_zip(bundle_upload_url: str, base_path: Path):
|
|
16
17
|
try:
|
|
17
18
|
# Generate a unique ID for the run
|
|
@@ -31,22 +32,21 @@ def upload_bundle_zip(bundle_upload_url: str, base_path: Path):
|
|
|
31
32
|
continue
|
|
32
33
|
file_path = os.path.join(root, file)
|
|
33
34
|
arcname = os.path.relpath(file_path, base_path)
|
|
34
|
-
|
|
35
35
|
zipf.write(file_path, arcname)
|
|
36
36
|
|
|
37
37
|
# Confirm the creation of the zip file
|
|
38
38
|
if not os.path.exists(zip_filename):
|
|
39
39
|
raise Exception(f"Failed to create {zip_filename}")
|
|
40
40
|
|
|
41
|
-
# Upload the zip file to presigned S3
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
# Upload the zip file to presigned S3 URL
|
|
42
|
+
with open(zip_filename, "rb") as f:
|
|
43
|
+
response = requests.put(bundle_upload_url, data=f, headers={"Content-Type": "application/zip"})
|
|
44
|
+
response.raise_for_status()
|
|
45
|
+
|
|
46
46
|
except Exception:
|
|
47
47
|
raise
|
|
48
48
|
finally:
|
|
49
|
-
#
|
|
49
|
+
# Remove the zip file
|
|
50
50
|
os.remove(zip_filename)
|
|
51
51
|
|
|
52
52
|
return response.text
|
|
@@ -58,9 +58,6 @@ def push(file: Path = typer.Argument(..., help="Name of blocks file to push.")):
|
|
|
58
58
|
# working directory from where the command was invoked
|
|
59
59
|
cwd = file.resolve().parent
|
|
60
60
|
|
|
61
|
-
# parent folder name
|
|
62
|
-
parent_folder_name = cwd.name
|
|
63
|
-
|
|
64
61
|
git_remote_url = None
|
|
65
62
|
|
|
66
63
|
try:
|
|
@@ -115,11 +112,13 @@ def push(file: Path = typer.Argument(..., help="Name of blocks file to push.")):
|
|
|
115
112
|
task_kwargs = automation.get("task_kwargs", {})
|
|
116
113
|
|
|
117
114
|
automation_name = task_kwargs.get("name")
|
|
118
|
-
vcpus = task_kwargs.get("vcpus", 1)
|
|
119
|
-
memory_mib = task_kwargs.get("memory_mib", 1024)
|
|
120
|
-
gpu_count = task_kwargs.get("gpu_count", 0)
|
|
121
|
-
gpu_type = task_kwargs.get("gpu_type", "")
|
|
122
115
|
|
|
116
|
+
# compute resource fields
|
|
117
|
+
runner = task_kwargs.get("runner")
|
|
118
|
+
vcpus = task_kwargs.get("vcpus")
|
|
119
|
+
memory = task_kwargs.get("memory")
|
|
120
|
+
gpu_count = task_kwargs.get("gpu_count")
|
|
121
|
+
gpu_type = task_kwargs.get("gpu_type")
|
|
123
122
|
repos: list = trigger_kwargs.get("repos", [])
|
|
124
123
|
|
|
125
124
|
if len(repos) == 0 and git_remote_url:
|
|
@@ -132,9 +131,10 @@ def push(file: Path = typer.Argument(..., help="Name of blocks file to push.")):
|
|
|
132
131
|
# Extract known fields
|
|
133
132
|
automation_config = {
|
|
134
133
|
"name": automation_name,
|
|
135
|
-
"import_path": f"{
|
|
134
|
+
"import_path": f"{file.name}:{function_name}",
|
|
135
|
+
"runner": runner,
|
|
136
136
|
"vcpus": vcpus,
|
|
137
|
-
"
|
|
137
|
+
"memory": memory,
|
|
138
138
|
"gpu_count": gpu_count,
|
|
139
139
|
"gpu_type": gpu_type,
|
|
140
140
|
"trigger_alias": trigger_alias,
|
|
@@ -145,7 +145,7 @@ def push(file: Path = typer.Argument(..., help="Name of blocks file to push.")):
|
|
|
145
145
|
# Add any additional args that weren't explicitly handled
|
|
146
146
|
additional_task_kwargs = {
|
|
147
147
|
k: v
|
|
148
|
-
for k, v in
|
|
148
|
+
for k, v in task_kwargs.items()
|
|
149
149
|
if k not in ["vcpus", "memory_mib", "gpu_count", "gpu_type", "name"]
|
|
150
150
|
}
|
|
151
151
|
automation_config["trigger_kwargs"] = trigger_kwargs
|
|
@@ -7,6 +7,7 @@ class AuthConfig(BaseModel):
|
|
|
7
7
|
|
|
8
8
|
uid: Optional[str] = ""
|
|
9
9
|
puid: Optional[str] = ""
|
|
10
|
+
wid: Optional[str] = ""
|
|
10
11
|
# Corresponds to env variable BLOCKS_AUTH__API_KEY
|
|
11
12
|
api_key: Optional[str] = ""
|
|
12
13
|
|
|
@@ -36,10 +37,11 @@ class AuthConfig(BaseModel):
|
|
|
36
37
|
def get_auth_headers(self) -> dict:
|
|
37
38
|
from blocks_cli.console import console
|
|
38
39
|
headers = {}
|
|
39
|
-
if self.uid and self.puid:
|
|
40
|
-
console.print("⚠️ Using uid and
|
|
40
|
+
if self.uid and self.puid and self.wid:
|
|
41
|
+
console.print("⚠️ Using uid, puid and wid for auth headers. This is intended for development purposes only.", style="yellow bold")
|
|
41
42
|
headers["x-blocks-uid"] = self.uid
|
|
42
43
|
headers["x-blocks-puid"] = self.puid
|
|
44
|
+
headers["x-blocks-wid"] = self.wid
|
|
43
45
|
else:
|
|
44
46
|
headers["Authorization"] = f"ApiKey {self.api_key}"
|
|
45
47
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|