hanzo 0.2.5__tar.gz → 0.2.7__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.

Potentially problematic release.


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

Files changed (28) hide show
  1. {hanzo-0.2.5 → hanzo-0.2.7}/PKG-INFO +2 -1
  2. {hanzo-0.2.5 → hanzo-0.2.7}/pyproject.toml +2 -1
  3. {hanzo-0.2.5 → hanzo-0.2.7}/src/hanzo/__init__.py +1 -1
  4. {hanzo-0.2.5 → hanzo-0.2.7}/src/hanzo/cli.py +48 -65
  5. hanzo-0.2.7/src/hanzo/utils/net_check.py +109 -0
  6. {hanzo-0.2.5 → hanzo-0.2.7}/.gitignore +0 -0
  7. {hanzo-0.2.5 → hanzo-0.2.7}/README.md +0 -0
  8. {hanzo-0.2.5 → hanzo-0.2.7}/src/hanzo/__main__.py +0 -0
  9. {hanzo-0.2.5 → hanzo-0.2.7}/src/hanzo/commands/__init__.py +0 -0
  10. {hanzo-0.2.5 → hanzo-0.2.7}/src/hanzo/commands/agent.py +0 -0
  11. {hanzo-0.2.5 → hanzo-0.2.7}/src/hanzo/commands/auth.py +0 -0
  12. {hanzo-0.2.5 → hanzo-0.2.7}/src/hanzo/commands/chat.py +0 -0
  13. {hanzo-0.2.5 → hanzo-0.2.7}/src/hanzo/commands/cluster.py +0 -0
  14. {hanzo-0.2.5 → hanzo-0.2.7}/src/hanzo/commands/config.py +0 -0
  15. {hanzo-0.2.5 → hanzo-0.2.7}/src/hanzo/commands/mcp.py +0 -0
  16. {hanzo-0.2.5 → hanzo-0.2.7}/src/hanzo/commands/miner.py +0 -0
  17. {hanzo-0.2.5 → hanzo-0.2.7}/src/hanzo/commands/network.py +0 -0
  18. {hanzo-0.2.5 → hanzo-0.2.7}/src/hanzo/commands/repl.py +0 -0
  19. {hanzo-0.2.5 → hanzo-0.2.7}/src/hanzo/commands/tools.py +0 -0
  20. {hanzo-0.2.5 → hanzo-0.2.7}/src/hanzo/interactive/__init__.py +0 -0
  21. {hanzo-0.2.5 → hanzo-0.2.7}/src/hanzo/interactive/dashboard.py +0 -0
  22. {hanzo-0.2.5 → hanzo-0.2.7}/src/hanzo/interactive/repl.py +0 -0
  23. {hanzo-0.2.5 → hanzo-0.2.7}/src/hanzo/mcp_server.py +0 -0
  24. {hanzo-0.2.5 → hanzo-0.2.7}/src/hanzo/repl.py +0 -0
  25. {hanzo-0.2.5 → hanzo-0.2.7}/src/hanzo/router/__init__.py +0 -0
  26. {hanzo-0.2.5 → hanzo-0.2.7}/src/hanzo/utils/__init__.py +0 -0
  27. {hanzo-0.2.5 → hanzo-0.2.7}/src/hanzo/utils/config.py +0 -0
  28. {hanzo-0.2.5 → hanzo-0.2.7}/src/hanzo/utils/output.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hanzo
3
- Version: 0.2.5
3
+ Version: 0.2.7
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
@@ -23,6 +23,7 @@ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
23
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
24
  Requires-Python: >=3.8
25
25
  Requires-Dist: click>=8.1.0
26
+ Requires-Dist: hanzo-net>=0.1.0
26
27
  Requires-Dist: httpx>=0.23.0
27
28
  Requires-Dist: prompt-toolkit>=3.0.0
28
29
  Requires-Dist: pydantic>=2.0.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "hanzo"
3
- version = "0.2.5"
3
+ version = "0.2.7"
4
4
  description = "Hanzo AI - Complete AI Infrastructure Platform with CLI, Router, MCP, and Agent Runtime"
5
5
  authors = [
6
6
  {name = "Hanzo AI", email = "dev@hanzo.ai"},
@@ -13,6 +13,7 @@ dependencies = [
13
13
  "httpx>=0.23.0",
14
14
  "pydantic>=2.0.0",
15
15
  "pyyaml>=6.0",
16
+ "hanzo-net>=0.1.0",
16
17
  ]
17
18
  readme = "README.md"
18
19
  requires-python = ">= 3.8"
@@ -1,6 +1,6 @@
1
1
  """Hanzo - Complete AI Infrastructure Platform with CLI, Router, MCP, and Agent Runtime."""
2
2
 
3
- __version__ = "0.2.5"
3
+ __version__ = "0.2.7"
4
4
  __all__ = ["main", "cli"]
5
5
 
6
6
  from .cli import main, cli
@@ -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.5"
15
+ __version__ = "0.2.7"
16
16
 
17
17
 
18
18
  @click.group(invoke_without_command=True)
@@ -104,78 +104,63 @@ async def start_compute_node(ctx, name: str = None, port: int = 52415,
104
104
  network: str = "mainnet", models: tuple = None,
105
105
  max_jobs: int = 10):
106
106
  """Start this instance as a compute node using hanzo/net."""
107
+ from .utils.net_check import check_net_installation, get_missing_dependencies
108
+
107
109
  console = ctx.obj.get("console", Console())
108
110
 
109
111
  console.print("[bold cyan]Starting Hanzo Net Compute Node[/bold cyan]")
110
112
  console.print(f"Network: {network}")
111
113
  console.print(f"Port: {port}")
112
114
 
115
+ # Check hanzo/net availability
116
+ is_available, net_path, python_exe = check_net_installation()
117
+
118
+ if not is_available:
119
+ console.print("[red]Error:[/red] hanzo-net is not installed")
120
+ console.print("\nTo install hanzo-net from PyPI:")
121
+ console.print(" pip install hanzo-net")
122
+ console.print("\nOr for development, clone from GitHub:")
123
+ console.print(" git clone https://github.com/hanzoai/net.git ~/work/hanzo/net")
124
+ console.print(" cd ~/work/hanzo/net && pip install -e .")
125
+ return
126
+
113
127
  try:
114
128
  import subprocess
115
129
  import sys
116
130
  import os
117
131
 
118
- # Check if hanzo/net is available
119
- net_path = "/Users/z/work/hanzo/net"
120
- if not os.path.exists(net_path):
121
- # Try to find net in the Python environment
122
- try:
123
- import net
124
- # net is installed as a package
125
- console.print("[green]✓[/green] Using installed hanzo/net")
126
-
127
- # Run net directly
128
- from net.main import run as net_run
129
-
130
- # Set up environment for net
131
- if models:
132
- os.environ["NET_MODELS"] = ",".join(models)
133
- if name:
134
- os.environ["NET_NODE_NAME"] = name
135
-
136
- console.print(f"\n[green][/green] Node initialized")
137
- console.print(f" Port: {port}")
138
- console.print(f" Models: {', '.join(models) if models else 'auto-detect'}")
139
- console.print("\n[bold green]Hanzo Net is running![/bold green]")
140
- console.print("WebUI: http://localhost:52415")
141
- console.print("API: http://localhost:52415/v1/chat/completions")
142
- console.print("\nPress Ctrl+C to stop\n")
143
-
144
- # Run net
145
- await net_run()
146
-
147
- except ImportError:
148
- # net not installed, try to run from source
149
- console.print("[yellow]hanzo/net not installed, checking for source...[/yellow]")
150
-
151
- if os.path.exists(net_path):
152
- console.print(f"[green]✓[/green] Found hanzo/net at {net_path}")
153
-
154
- # Add net to Python path
155
- sys.path.insert(0, os.path.join(net_path, "src"))
156
-
157
- # Import and run net
158
- from net.main import run as net_run
159
-
160
- console.print(f"\n[green]✓[/green] Starting net node")
161
- console.print(f" Port: {port}")
162
- console.print(f" Models: {', '.join(models) if models else 'auto-detect'}")
163
- console.print("\n[bold green]Hanzo Net is running![/bold green]")
164
- console.print("WebUI: http://localhost:52415")
165
- console.print("API: http://localhost:52415/v1/chat/completions")
166
- console.print("\nPress Ctrl+C to stop\n")
167
-
168
- # Run net
169
- await net_run()
170
- else:
171
- console.print("[red]Error:[/red] hanzo/net not found")
172
- console.print("\nInstall hanzo/net:")
173
- console.print(" git clone https://github.com/hanzoai/net.git")
174
- console.print(" cd net && pip install -e .")
175
- return
132
+ # Use the checked net_path and python_exe
133
+ if not net_path:
134
+ # net is installed as a package
135
+ console.print("[green]✓[/green] Using installed hanzo/net")
136
+
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()
176
157
  else:
177
- # Run from source directory
158
+ # Run from source directory using the detected python_exe
178
159
  console.print(f"[green]✓[/green] Using hanzo/net from {net_path}")
160
+ if python_exe != sys.executable:
161
+ console.print(f"[green]✓[/green] Using hanzo/net venv")
162
+ else:
163
+ console.print("[yellow]⚠[/yellow] Using system Python")
179
164
 
180
165
  # Change to net directory and run
181
166
  original_cwd = os.getcwd()
@@ -188,6 +173,7 @@ async def start_compute_node(ctx, name: str = None, port: int = 52415,
188
173
  env["NET_MODELS"] = ",".join(models)
189
174
  if name:
190
175
  env["NET_NODE_NAME"] = name
176
+ env["PYTHONPATH"] = os.path.join(net_path, "src") + ":" + env.get("PYTHONPATH", "")
191
177
 
192
178
  console.print(f"\n[green]✓[/green] Starting net node")
193
179
  console.print(f" Port: {port}")
@@ -197,12 +183,9 @@ async def start_compute_node(ctx, name: str = None, port: int = 52415,
197
183
  console.print("API: http://localhost:52415/v1/chat/completions")
198
184
  console.print("\nPress Ctrl+C to stop\n")
199
185
 
200
- # Add src to path and run net
201
- env["PYTHONPATH"] = os.path.join(net_path, "src") + ":" + env.get("PYTHONPATH", "")
202
-
203
- # Run net command
186
+ # Run net command with detected python
204
187
  process = subprocess.run(
205
- [sys.executable, "-c", "from net.main import run; run()"],
188
+ [python_exe, "-c", "from net.main import run; run()"],
206
189
  env=env,
207
190
  check=False
208
191
  )
@@ -0,0 +1,109 @@
1
+ """Utilities for checking hanzo/net availability and dependencies."""
2
+
3
+ import os
4
+ import subprocess
5
+ import sys
6
+ from typing import Optional, Tuple
7
+ from pathlib import Path
8
+
9
+
10
+ def check_net_installation() -> Tuple[bool, Optional[str], Optional[str]]:
11
+ """Check if hanzo/net is available and properly configured.
12
+
13
+ Returns:
14
+ Tuple of (is_available, net_path, python_exe)
15
+ """
16
+ # First try to import as PyPI package (hanzo-net)
17
+ try:
18
+ import net
19
+ return True, None, sys.executable
20
+ except ImportError:
21
+ pass
22
+
23
+ # For development: check for hanzo/net in standard location
24
+ net_path = Path.home() / "work" / "hanzo" / "net"
25
+ if not net_path.exists():
26
+ net_path = Path("/Users/z/work/hanzo/net")
27
+
28
+ if not net_path.exists():
29
+ return False, None, None
30
+
31
+ # Check for venv
32
+ venv_python = net_path / ".venv" / "bin" / "python"
33
+ if venv_python.exists():
34
+ # Check if venv has required packages
35
+ result = subprocess.run(
36
+ [str(venv_python), "-c", "import net, scapy, mlx, transformers"],
37
+ capture_output=True,
38
+ text=True
39
+ )
40
+ if result.returncode == 0:
41
+ return True, str(net_path), str(venv_python)
42
+ else:
43
+ # Venv exists but missing dependencies
44
+ return False, str(net_path), str(venv_python)
45
+
46
+ # No venv, check system Python
47
+ result = subprocess.run(
48
+ [sys.executable, "-c", "import scapy"],
49
+ capture_output=True,
50
+ text=True
51
+ )
52
+
53
+ if result.returncode == 0:
54
+ return True, str(net_path), sys.executable
55
+ else:
56
+ return False, str(net_path), None
57
+
58
+
59
+ def install_net_dependencies(net_path: str, python_exe: str = None) -> bool:
60
+ """Install hanzo/net dependencies.
61
+
62
+ Args:
63
+ net_path: Path to hanzo/net directory
64
+ python_exe: Python executable to use (optional)
65
+
66
+ Returns:
67
+ True if installation successful
68
+ """
69
+ if python_exe is None:
70
+ python_exe = sys.executable
71
+
72
+ # Install dependencies
73
+ result = subprocess.run(
74
+ [python_exe, "-m", "pip", "install", "-e", net_path],
75
+ capture_output=True,
76
+ text=True
77
+ )
78
+
79
+ return result.returncode == 0
80
+
81
+
82
+ def get_missing_dependencies(python_exe: str = None) -> list:
83
+ """Check which dependencies are missing for hanzo/net.
84
+
85
+ Args:
86
+ python_exe: Python executable to check (default: sys.executable)
87
+
88
+ Returns:
89
+ List of missing package names
90
+ """
91
+ if python_exe is None:
92
+ python_exe = sys.executable
93
+
94
+ required_packages = [
95
+ "scapy", "mlx", "mlx_lm", "transformers", "tinygrad",
96
+ "aiohttp", "grpcio", "pydantic", "rich", "tqdm"
97
+ ]
98
+
99
+ missing = []
100
+ for package in required_packages:
101
+ result = subprocess.run(
102
+ [python_exe, "-c", f"import {package}"],
103
+ capture_output=True,
104
+ text=True
105
+ )
106
+ if result.returncode != 0:
107
+ missing.append(package)
108
+
109
+ return missing
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