blocks-cli 0.1.26__tar.gz → 0.1.28__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.26 → blocks-cli-0.1.28}/PKG-INFO +1 -3
  2. {blocks-cli-0.1.26 → blocks-cli-0.1.28}/blocks_cli/commands/create.py +6 -4
  3. {blocks-cli-0.1.26 → blocks-cli-0.1.28}/blocks_cli/commands/push.py +12 -10
  4. {blocks-cli-0.1.26 → blocks-cli-0.1.28}/blocks_cli/config/auth.py +4 -2
  5. {blocks-cli-0.1.26 → blocks-cli-0.1.28}/setup.py +1 -1
  6. {blocks-cli-0.1.26 → blocks-cli-0.1.28}/LICENSE +0 -0
  7. {blocks-cli-0.1.26 → blocks-cli-0.1.28}/MANIFEST.in +0 -0
  8. {blocks-cli-0.1.26 → blocks-cli-0.1.28}/README.md +0 -0
  9. {blocks-cli-0.1.26 → blocks-cli-0.1.28}/blocks_cli/__init__.py +0 -0
  10. {blocks-cli-0.1.26 → blocks-cli-0.1.28}/blocks_cli/api.py +0 -0
  11. {blocks-cli-0.1.26 → blocks-cli-0.1.28}/blocks_cli/builds.py +0 -0
  12. {blocks-cli-0.1.26 → blocks-cli-0.1.28}/blocks_cli/bundles.py +0 -0
  13. {blocks-cli-0.1.26 → blocks-cli-0.1.28}/blocks_cli/commands/__base__.py +0 -0
  14. {blocks-cli-0.1.26 → blocks-cli-0.1.28}/blocks_cli/commands/__init__.py +0 -0
  15. {blocks-cli-0.1.26 → blocks-cli-0.1.28}/blocks_cli/commands/configure.py +0 -0
  16. {blocks-cli-0.1.26 → blocks-cli-0.1.28}/blocks_cli/commands/init.py +0 -0
  17. {blocks-cli-0.1.26 → blocks-cli-0.1.28}/blocks_cli/commands/test.py +0 -0
  18. {blocks-cli-0.1.26 → blocks-cli-0.1.28}/blocks_cli/config/__init__.py +0 -0
  19. {blocks-cli-0.1.26 → blocks-cli-0.1.28}/blocks_cli/config/config.py +0 -0
  20. {blocks-cli-0.1.26 → blocks-cli-0.1.28}/blocks_cli/console.py +0 -0
  21. {blocks-cli-0.1.26 → blocks-cli-0.1.28}/blocks_cli/fs.py +0 -0
  22. {blocks-cli-0.1.26 → blocks-cli-0.1.28}/blocks_cli/package.py +0 -0
  23. {blocks-cli-0.1.26 → blocks-cli-0.1.28}/blocks_cli/registration.py +0 -0
  24. {blocks-cli-0.1.26 → blocks-cli-0.1.28}/blocks_cli.egg-info/SOURCES.txt +0 -0
  25. {blocks-cli-0.1.26 → blocks-cli-0.1.28}/requirements.txt +0 -0
  26. {blocks-cli-0.1.26 → blocks-cli-0.1.28}/setup.cfg +0 -0
@@ -1,12 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: blocks-cli
3
- Version: 0.1.26
3
+ Version: 0.1.28
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
7
7
  Author-email: dev@blocksorg.com
8
8
  License: AGPL
9
- Platform: UNKNOWN
10
9
  Classifier: Development Status :: 3 - Alpha
11
10
  Classifier: Intended Audience :: Developers
12
11
  Classifier: License :: OSI Approved :: GNU Affero General Public License v3
@@ -68,4 +67,3 @@ def my_automation(event):
68
67
  blocks init --api-key <your-api-key>
69
68
  blocks push automation.py
70
69
  ```
71
-
@@ -29,8 +29,8 @@ def create(
29
29
  warn_current_package_version()
30
30
 
31
31
  # Validate automation name (only allow alphanumeric, dash, and underscore)
32
- if not name or re.search(r'[^a-zA-Z0-9\_]', name):
33
- raise InvalidAutomationNameError("Automation name must contain only letters, numbers, and underscores")
32
+ if not name or re.search(r'[^a-zA-Z0-9\_-]', name) or name[0].isdigit():
33
+ raise InvalidAutomationNameError("Automation name cannot start with a number, and must contain only letters, numbers, dashes, and underscores")
34
34
 
35
35
  blocks_dir = find_dir(target=".blocks")
36
36
 
@@ -45,6 +45,8 @@ def create(
45
45
  try:
46
46
  # Create directory and files
47
47
  automation_dir.mkdir(parents=True)
48
+
49
+ function_name = name.replace("-", "_")
48
50
 
49
51
  # Create main.py with basic template
50
52
  with open(automation_dir / 'main.py', 'w') as f:
@@ -52,9 +54,9 @@ def create(
52
54
 
53
55
  @task(name="{name}")
54
56
  @on("", repos=[])
55
- def {name}(input):
57
+ def {function_name}(input):
56
58
  print(input)
57
- '''.format(name=name))
59
+ '''.format(name=name, function_name=function_name))
58
60
 
59
61
  sdk_version = get_latest_sdk_version()
60
62
  latest_version = sdk_version.get("latest_version")
@@ -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:
@@ -127,16 +126,19 @@ def push(file: Path = typer.Argument(..., help="Name of blocks file to push.")):
127
126
 
128
127
  function_name = automation.get("function_name")
129
128
  function_source_code = automation.get("function_source_code")
129
+ config_schema = automation.get("config_schema")
130
130
  trigger_alias = automation.get("trigger_alias")
131
131
 
132
132
  # Extract known fields
133
133
  automation_config = {
134
134
  "name": automation_name,
135
- "import_path": f"{parent_folder_name}/{file.name}:{function_name}",
135
+ "import_path": f"{file.name}:{function_name}",
136
+ "runner": runner,
136
137
  "vcpus": vcpus,
137
- "memory_mib": memory_mib,
138
+ "memory": memory,
138
139
  "gpu_count": gpu_count,
139
140
  "gpu_type": gpu_type,
141
+ "config_schema": config_schema,
140
142
  "trigger_alias": trigger_alias,
141
143
  "trigger_kwargs": {},
142
144
  "task_kwargs": {},
@@ -145,7 +147,7 @@ def push(file: Path = typer.Argument(..., help="Name of blocks file to push.")):
145
147
  # Add any additional args that weren't explicitly handled
146
148
  additional_task_kwargs = {
147
149
  k: v
148
- for k, v in trigger_kwargs.items()
150
+ for k, v in task_kwargs.items()
149
151
  if k not in ["vcpus", "memory_mib", "gpu_count", "gpu_type", "name"]
150
152
  }
151
153
  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 puid for auth headers. This is intended for development purposes only.", style="yellow bold")
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
 
@@ -6,7 +6,7 @@ with open("requirements.txt") as f:
6
6
 
7
7
  setup(
8
8
  name="blocks-cli",
9
- version="0.1.26",
9
+ version="0.1.28",
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