drift-ml 0.2.1__tar.gz → 0.2.6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: drift-ml
3
- Version: 0.2.1
3
+ Version: 0.2.6
4
4
  Summary: drift — terminal-first, chat-based AutoML. Open source. No tokens. No auth.
5
5
  Project-URL: Homepage, https://github.com/lakshitsachdeva/intent2model
6
6
  Project-URL: Repository, https://github.com/lakshitsachdeva/intent2model
@@ -19,7 +19,10 @@ def main() -> None:
19
19
  from drift.engine_launcher import ensure_engine
20
20
 
21
21
  if not ensure_engine():
22
- print("drift: Failed to start engine. Set DRIFT_BACKEND_URL or run: npm install -g drift-ml", file=sys.stderr)
22
+ print("drift: Failed to start engine.", file=sys.stderr)
23
+ print("drift: Check ~/.drift/bin/.engine-stderr.log", file=sys.stderr)
24
+ print("drift: On macOS: System Settings → Privacy & Security → allow drift-engine", file=sys.stderr)
25
+ print("drift: Or set DRIFT_BACKEND_URL to a running engine", file=sys.stderr)
23
26
  sys.exit(1)
24
27
  base_url = f"http://127.0.0.1:{os.environ.get('DRIFT_ENGINE_PORT', '8000')}"
25
28
  run_repl(base_url=base_url)
@@ -15,8 +15,8 @@ try:
15
15
  except ImportError:
16
16
  requests = None
17
17
 
18
- GITHUB_REPO = "lakshitsachdeva/drift" # Engine binaries (v0.2.0+ also in intent2model)
19
- ENGINE_TAG = "v0.2.0" # Pinned — direct URL, no API, no rate limits
18
+ GITHUB_REPO = "lakshitsachdeva/intent2model" # Engine binaries (same repo)
19
+ ENGINE_TAG = "v0.2.6" # Pinned — direct URL, no API, no rate limits
20
20
  ENGINE_PORT = os.environ.get("DRIFT_ENGINE_PORT", "8000")
21
21
  HEALTH_URL = f"http://127.0.0.1:{ENGINE_PORT}/health"
22
22
 
@@ -143,24 +143,67 @@ def ensure_engine() -> bool:
143
143
  try:
144
144
  bin_path.chmod(0o755)
145
145
  subprocess.run(["xattr", "-dr", "com.apple.quarantine", str(bin_path)], check=False, capture_output=True)
146
+ # Ad-hoc sign so macOS Gatekeeper doesn't kill the binary (requires non-UPX build)
147
+ subprocess.run(["codesign", "-s", "-", "--force", str(bin_path)], check=False, capture_output=True)
146
148
  except Exception:
147
149
  pass
148
150
 
151
+ # macOS: use wrapper script via bash to avoid spawn -88
152
+ # Windows: use batch file so engine starts reliably (inherits PATH for gemini etc.)
153
+ if platform.system() == "Darwin":
154
+ wrapper = bin_dir / "run-engine.sh"
155
+ port = ENGINE_PORT
156
+ bin_name = bin_path.name
157
+ script = f'#!/bin/bash\ncd "$(dirname "$0")"\nexport DRIFT_ENGINE_PORT="{port}"\nexec ./{bin_name}\n'
158
+ if not wrapper.exists() or wrapper.read_text() != script:
159
+ wrapper.write_text(script)
160
+ wrapper.chmod(0o755)
161
+ launch_cmd = ["/bin/bash", str(wrapper)]
162
+ elif platform.system() == "Windows":
163
+ bat = bin_dir / "run-engine.bat"
164
+ port = ENGINE_PORT
165
+ bin_name = bin_path.name
166
+ script = f'@echo off\ncd /d "%~dp0"\nset DRIFT_ENGINE_PORT={port}\nstart /b "" {bin_name}\n'
167
+ if not bat.exists() or bat.read_text() != script:
168
+ bat.write_text(script)
169
+ launch_cmd = ["cmd", "/c", str(bat)]
170
+ else:
171
+ launch_cmd = [str(bin_path)]
172
+
149
173
  env = {**os.environ, "DRIFT_ENGINE_PORT": ENGINE_PORT}
150
- proc = subprocess.Popen(
151
- [str(bin_path)],
152
- cwd=str(bin_dir),
153
- env=env,
154
- stdout=subprocess.DEVNULL,
155
- stderr=subprocess.DEVNULL,
156
- start_new_session=True,
157
- )
158
- proc.wait()
159
- del proc
160
-
161
- for _ in range(60):
174
+ stderr_file = bin_dir / ".engine-stderr.log"
175
+ proc = None
176
+ try:
177
+ with open(stderr_file, "w") as errf:
178
+ proc = subprocess.Popen(
179
+ launch_cmd,
180
+ cwd=str(bin_dir),
181
+ env=env,
182
+ stdout=subprocess.DEVNULL,
183
+ stderr=errf,
184
+ start_new_session=True,
185
+ )
186
+ try:
187
+ proc.wait(timeout=3)
188
+ if proc.returncode and proc.returncode != 0:
189
+ err = stderr_file.read_text().strip() if stderr_file.exists() else ""
190
+ print(f"drift: Engine exited with code {proc.returncode}", file=sys.stderr)
191
+ if err:
192
+ print(f"drift: {err[-400:]}", file=sys.stderr)
193
+ return False
194
+ except subprocess.TimeoutExpired:
195
+ pass # Engine still running
196
+ except Exception as e:
197
+ print(f"drift: Engine spawn failed: {e}", file=sys.stderr)
198
+ return False
199
+
200
+ import time
201
+ print("drift: Starting engine (first run may take 30s)...", file=sys.stderr)
202
+ for i in range(120): # 60s — PyInstaller binary can take 30+ s to unpack
162
203
  if _engine_running():
163
204
  return True
164
- import time
165
205
  time.sleep(0.5)
206
+ err = stderr_file.read_text().strip() if stderr_file.exists() else ""
207
+ if err:
208
+ print(f"drift: Engine log: {err[-400:]}", file=sys.stderr)
166
209
  return False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: drift-ml
3
- Version: 0.2.1
3
+ Version: 0.2.6
4
4
  Summary: drift — terminal-first, chat-based AutoML. Open source. No tokens. No auth.
5
5
  Project-URL: Homepage, https://github.com/lakshitsachdeva/intent2model
6
6
  Project-URL: Repository, https://github.com/lakshitsachdeva/intent2model
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "drift-ml"
7
- version = "0.2.1"
7
+ version = "0.2.6"
8
8
  description = "drift — terminal-first, chat-based AutoML. Open source. No tokens. No auth."
9
9
  requires-python = ">=3.10"
10
10
  dependencies = [
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes