drift-ml 0.2.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: drift-ml
3
- Version: 0.2.2
3
+ Version: 0.2.7
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. Check ~/.drift/bin/.engine-stderr.log or set DRIFT_BACKEND_URL", 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.7" # 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
 
@@ -119,6 +119,20 @@ def ensure_engine() -> bool:
119
119
 
120
120
  bin_dir.mkdir(parents=True, exist_ok=True)
121
121
 
122
+ # Re-download if engine tag changed (e.g. after pipx upgrade)
123
+ version_file = bin_dir / ".engine-tag"
124
+ if bin_path.exists() and version_file.exists():
125
+ try:
126
+ if version_file.read_text().strip() != ENGINE_TAG:
127
+ bin_path.unlink()
128
+ except Exception:
129
+ pass
130
+ if bin_path.exists() and not version_file.exists():
131
+ try:
132
+ bin_path.unlink()
133
+ except Exception:
134
+ pass
135
+
122
136
  if not bin_path.exists():
123
137
  plat, arch = _get_platform_key()
124
138
  ext = ".exe" if platform.system() == "Windows" else ""
@@ -127,6 +141,10 @@ def ensure_engine() -> bool:
127
141
  try:
128
142
  url = _get_asset_url(asset)
129
143
  _download_file(url, bin_path)
144
+ try:
145
+ version_file.write_text(ENGINE_TAG)
146
+ except Exception:
147
+ pass
130
148
  except Exception as e:
131
149
  print(f"drift: Download failed: {e}", file=sys.stderr)
132
150
  print(f"drift: Run: mkdir -p ~/.drift/bin && curl -L -o ~/.drift/bin/{asset} <url>", file=sys.stderr)
@@ -143,16 +161,40 @@ def ensure_engine() -> bool:
143
161
  try:
144
162
  bin_path.chmod(0o755)
145
163
  subprocess.run(["xattr", "-dr", "com.apple.quarantine", str(bin_path)], check=False, capture_output=True)
164
+ # Ad-hoc sign so macOS Gatekeeper doesn't kill the binary (requires non-UPX build)
165
+ subprocess.run(["codesign", "-s", "-", "--force", str(bin_path)], check=False, capture_output=True)
146
166
  except Exception:
147
167
  pass
148
168
 
169
+ # macOS: use wrapper script via bash to avoid spawn -88
170
+ # Windows: use batch file so engine starts reliably (inherits PATH for gemini etc.)
171
+ if platform.system() == "Darwin":
172
+ wrapper = bin_dir / "run-engine.sh"
173
+ port = ENGINE_PORT
174
+ bin_name = bin_path.name
175
+ script = f'#!/bin/bash\ncd "$(dirname "$0")"\nexport DRIFT_ENGINE_PORT="{port}"\nexec ./{bin_name}\n'
176
+ if not wrapper.exists() or wrapper.read_text() != script:
177
+ wrapper.write_text(script)
178
+ wrapper.chmod(0o755)
179
+ launch_cmd = ["/bin/bash", str(wrapper)]
180
+ elif platform.system() == "Windows":
181
+ bat = bin_dir / "run-engine.bat"
182
+ port = ENGINE_PORT
183
+ bin_name = bin_path.name
184
+ script = f'@echo off\ncd /d "%~dp0"\nset DRIFT_ENGINE_PORT={port}\nstart /b "" {bin_name}\n'
185
+ if not bat.exists() or bat.read_text() != script:
186
+ bat.write_text(script)
187
+ launch_cmd = ["cmd", "/c", str(bat)]
188
+ else:
189
+ launch_cmd = [str(bin_path)]
190
+
149
191
  env = {**os.environ, "DRIFT_ENGINE_PORT": ENGINE_PORT}
150
192
  stderr_file = bin_dir / ".engine-stderr.log"
151
193
  proc = None
152
194
  try:
153
195
  with open(stderr_file, "w") as errf:
154
196
  proc = subprocess.Popen(
155
- [str(bin_path)],
197
+ launch_cmd,
156
198
  cwd=str(bin_dir),
157
199
  env=env,
158
200
  stdout=subprocess.DEVNULL,
@@ -174,7 +216,8 @@ def ensure_engine() -> bool:
174
216
  return False
175
217
 
176
218
  import time
177
- for _ in range(60):
219
+ print("drift: Starting engine (first run may take 30s)...", file=sys.stderr)
220
+ for i in range(120): # 60s — PyInstaller binary can take 30+ s to unpack
178
221
  if _engine_running():
179
222
  return True
180
223
  time.sleep(0.5)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: drift-ml
3
- Version: 0.2.2
3
+ Version: 0.2.7
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.2"
7
+ version = "0.2.7"
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