hanzo 0.2.7__py3-none-any.whl → 0.2.9__py3-none-any.whl

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.

Potentially problematic release.


This version of hanzo might be problematic. Click here for more details.

hanzo/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """Hanzo - Complete AI Infrastructure Platform with CLI, Router, MCP, and Agent Runtime."""
2
2
 
3
- __version__ = "0.2.7"
3
+ __version__ = "0.2.9"
4
4
  __all__ = ["main", "cli"]
5
5
 
6
6
  from .cli import main, cli
hanzo/cli.py CHANGED
@@ -12,7 +12,7 @@ from .interactive.repl import HanzoREPL
12
12
  from .utils.output import console
13
13
 
14
14
  # Version
15
- __version__ = "0.2.7"
15
+ __version__ = "0.2.9"
16
16
 
17
17
 
18
18
  @click.group(invoke_without_command=True)
@@ -88,6 +88,18 @@ def serve(ctx, name: str, port: int):
88
88
  asyncio.run(cluster.start_cluster(ctx, name, port))
89
89
 
90
90
 
91
+ @cli.command()
92
+ @click.option("--name", "-n", help="Node name (auto-generated if not provided)")
93
+ @click.option("--port", "-p", default=52415, help="Node port (default: 52415 for hanzo/net)")
94
+ @click.option("--network", default="local", help="Network to join (mainnet/testnet/local)")
95
+ @click.option("--models", "-m", multiple=True, help="Models to serve (e.g., llama-3.2-3b)")
96
+ @click.option("--max-jobs", type=int, default=10, help="Max concurrent jobs")
97
+ @click.pass_context
98
+ def net(ctx, name: str, port: int, network: str, models: tuple, max_jobs: int):
99
+ """Start the Hanzo Network distributed AI compute node."""
100
+ asyncio.run(start_compute_node(ctx, name, port, network, models, max_jobs))
101
+
102
+
91
103
  @cli.command()
92
104
  @click.option("--name", "-n", help="Node name (auto-generated if not provided)")
93
105
  @click.option("--port", "-p", default=52415, help="Node port (default: 52415 for hanzo/net)")
@@ -96,7 +108,7 @@ def serve(ctx, name: str, port: int):
96
108
  @click.option("--max-jobs", type=int, default=10, help="Max concurrent jobs")
97
109
  @click.pass_context
98
110
  def node(ctx, name: str, port: int, network: str, models: tuple, max_jobs: int):
99
- """Start as a compute node for the Hanzo network using hanzo/net."""
111
+ """Alias for 'hanzo net' - Start as a compute node for the Hanzo network."""
100
112
  asyncio.run(start_compute_node(ctx, name, port, network, models, max_jobs))
101
113
 
102
114
 
@@ -134,26 +146,37 @@ async def start_compute_node(ctx, name: str = None, port: int = 52415,
134
146
  # net is installed as a package
135
147
  console.print("[green]✓[/green] Using installed hanzo/net")
136
148
 
137
- # Import and run net
138
- sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(sys.executable)), "lib", "python3.*/site-packages"))
139
- from net.main import run as net_run
140
-
141
- # Set up environment for net
142
- if models:
143
- os.environ["NET_MODELS"] = ",".join(models)
144
- if name:
145
- os.environ["NET_NODE_NAME"] = name
146
-
147
- console.print(f"\n[green]✓[/green] Node initialized")
148
- console.print(f" Port: {port}")
149
- console.print(f" Models: {', '.join(models) if models else 'auto-detect'}")
150
- console.print("\n[bold green]Hanzo Net is running![/bold green]")
151
- console.print("WebUI: http://localhost:52415")
152
- console.print("API: http://localhost:52415/v1/chat/completions")
153
- console.print("\nPress Ctrl+C to stop\n")
154
-
155
- # Run net
156
- await net_run()
149
+ # Set up sys.argv for net's argparse
150
+ original_argv = sys.argv.copy()
151
+ try:
152
+ # Build argv for net
153
+ sys.argv = ["hanzo-net"] # Program name
154
+
155
+ # Add options
156
+ if port != 52415:
157
+ sys.argv.extend(["--chatgpt-api-port", str(port)])
158
+ if name:
159
+ sys.argv.extend(["--node-id", name])
160
+ if network != "local":
161
+ sys.argv.extend(["--discovery-module", network])
162
+ if models:
163
+ sys.argv.extend(["--default-model", models[0]])
164
+
165
+ # Import and run net
166
+ from net.main import run as net_run
167
+
168
+ console.print(f"\n[green]✓[/green] Node initialized")
169
+ console.print(f" Port: {port}")
170
+ console.print(f" Models: {', '.join(models) if models else 'auto-detect'}")
171
+ console.print("\n[bold green]Hanzo Net is running![/bold green]")
172
+ console.print("WebUI: http://localhost:52415")
173
+ console.print("API: http://localhost:52415/v1/chat/completions")
174
+ console.print("\nPress Ctrl+C to stop\n")
175
+
176
+ # Run net
177
+ await net_run()
178
+ finally:
179
+ sys.argv = original_argv
157
180
  else:
158
181
  # Run from source directory using the detected python_exe
159
182
  console.print(f"[green]✓[/green] Using hanzo/net from {net_path}")
@@ -183,9 +206,20 @@ async def start_compute_node(ctx, name: str = None, port: int = 52415,
183
206
  console.print("API: http://localhost:52415/v1/chat/completions")
184
207
  console.print("\nPress Ctrl+C to stop\n")
185
208
 
209
+ # Build command line args
210
+ cmd_args = [python_exe, "-m", "net.main"]
211
+ if port != 52415:
212
+ cmd_args.extend(["--chatgpt-api-port", str(port)])
213
+ if name:
214
+ cmd_args.extend(["--node-id", name])
215
+ if network != "local":
216
+ cmd_args.extend(["--discovery-module", network])
217
+ if models:
218
+ cmd_args.extend(["--default-model", models[0]])
219
+
186
220
  # Run net command with detected python
187
221
  process = subprocess.run(
188
- [python_exe, "-c", "from net.main import run; run()"],
222
+ cmd_args,
189
223
  env=env,
190
224
  check=False
191
225
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hanzo
3
- Version: 0.2.7
3
+ Version: 0.2.9
4
4
  Summary: Hanzo AI - Complete AI Infrastructure Platform with CLI, Router, MCP, and Agent Runtime
5
5
  Project-URL: Homepage, https://hanzo.ai
6
6
  Project-URL: Repository, https://github.com/hanzoai/python-sdk
@@ -1,6 +1,6 @@
1
- hanzo/__init__.py,sha256=QXW5M-0xXAPkNapOByrAATqn9tjNUhl5BekPICT4zLY,168
1
+ hanzo/__init__.py,sha256=O-S9Q3naeDCxSdeZ3BZjTZXg9z54f9bMlQmqG7hHoL4,168
2
2
  hanzo/__main__.py,sha256=qRjwG8-7MHPOy3czoyDP9VK1GhEaJJsVeZcz2AG9NV0,104
3
- hanzo/cli.py,sha256=OKi2C6pxqlCYSpXd7XwtFU3wskipIfZPODAeO4Br_-Q,8900
3
+ hanzo/cli.py,sha256=2DY7lxAJS5lfhAN0Iu0sN1KnmhZIoswy_XTjhDsqSGU,10501
4
4
  hanzo/mcp_server.py,sha256=FBqcXhaJgV8_9O83H3fUy_pv4cV1707XCYm7FXaJeWY,422
5
5
  hanzo/repl.py,sha256=sC7EXbIBn7Oxnmzqey6neAg5-116gfpmrF0YFDYrhAQ,1014
6
6
  hanzo/commands/__init__.py,sha256=vXfIgioA6eakIYEN5ff5k_5BqOYQCJggD_MW40gb56w,138
@@ -22,7 +22,7 @@ hanzo/utils/__init__.py,sha256=zmCH4YxefrpWmR-netV99UeECqrXjkKbi3ZjbcD79dw,68
22
22
  hanzo/utils/config.py,sha256=RU27eiSxGWAT9fI5-CjRdEJZEeT_xjMxjlMVeKC1gMg,4830
23
23
  hanzo/utils/net_check.py,sha256=WDElDu19MYN3qs7y_DbIpcnVsxiMCgg2CTI-48A15vE,3066
24
24
  hanzo/utils/output.py,sha256=lROF8RDOkck7ySt1kiTlVlHZqx1E0B-PqcJc78ZHYOs,2694
25
- hanzo-0.2.7.dist-info/METADATA,sha256=ePZsIg6wTtju_Y9PVZWEvQNOpmd6aACB20rU9pFivHM,4347
26
- hanzo-0.2.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
27
- hanzo-0.2.7.dist-info/entry_points.txt,sha256=pQLPMdqOXU_2BfTcMDhkqTCDNk_H6ApvYuSaWcuQOOw,171
28
- hanzo-0.2.7.dist-info/RECORD,,
25
+ hanzo-0.2.9.dist-info/METADATA,sha256=ZzDpNHR4yPmxBnt5zZeGM4OZDgtxPeRLpG25Kze1xmw,4347
26
+ hanzo-0.2.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
27
+ hanzo-0.2.9.dist-info/entry_points.txt,sha256=pQLPMdqOXU_2BfTcMDhkqTCDNk_H6ApvYuSaWcuQOOw,171
28
+ hanzo-0.2.9.dist-info/RECORD,,
File without changes