drift-ml 0.1.11__py3-none-any.whl → 0.2.1__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.
drift/engine_launcher.py CHANGED
@@ -1,11 +1,10 @@
1
1
  """
2
2
  Download and start the drift engine binary when no backend is running.
3
- Makes pipx install drift-ml work standalone (no npm needed).
3
+ Open source no tokens, no auth. Downloads from public GitHub Releases.
4
4
  """
5
5
 
6
6
  import os
7
7
  import platform
8
- import shutil
9
8
  import subprocess
10
9
  import sys
11
10
  from pathlib import Path
@@ -16,9 +15,8 @@ try:
16
15
  except ImportError:
17
16
  requests = None
18
17
 
19
- ENGINE_TAG = "v0.1.4"
20
- GITHUB_REPO = "lakshitsachdeva/drift"
21
- GITHUB_API = f"https://api.github.com/repos/{GITHUB_REPO}/releases/tags/{ENGINE_TAG}"
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
22
20
  ENGINE_PORT = os.environ.get("DRIFT_ENGINE_PORT", "8000")
23
21
  HEALTH_URL = f"http://127.0.0.1:{ENGINE_PORT}/health"
24
22
 
@@ -60,47 +58,26 @@ def _engine_running() -> bool:
60
58
  return False
61
59
 
62
60
 
63
- def _get_asset_download_url(asset_name: str) -> str:
64
- """Resolve GitHub release asset to download URL. Prefer direct URL (no API)."""
61
+ def _get_asset_url(asset_name: str) -> str:
62
+ """Direct download URL. No API avoids rate limits."""
65
63
  base = os.environ.get("DRIFT_ENGINE_BASE_URL")
66
64
  if base:
67
65
  return f"{base.rstrip('/')}/{asset_name}"
68
66
  return f"https://github.com/{GITHUB_REPO}/releases/download/{ENGINE_TAG}/{asset_name}"
69
67
 
70
68
 
71
- def _get_asset_download_url_via_api(asset_name: str) -> str:
72
- """Fallback: get URL via GitHub API (for private repos)."""
73
- token = os.environ.get("DRIFT_GITHUB_TOKEN") or os.environ.get("GITHUB_TOKEN")
74
- headers = {
75
- "User-Agent": "Drift-Engine-Launcher/1.0",
76
- "Accept": "application/vnd.github+json",
77
- }
78
- if token:
79
- headers["Authorization"] = f"Bearer {token}"
80
- r = requests.get(GITHUB_API, headers=headers, timeout=15)
81
- if r.status_code == 404:
82
- raise RuntimeError(
83
- f"Release {ENGINE_TAG} not found. "
84
- "If the repo is private, set DRIFT_GITHUB_TOKEN with repo read access."
85
- )
86
- r.raise_for_status()
87
- data = r.json()
88
- for a in data.get("assets", []):
89
- if a.get("name") == asset_name:
90
- url = a.get("browser_download_url") or a.get("url")
91
- if url:
92
- return url
93
- raise RuntimeError(f"Asset {asset_name} not found in release {ENGINE_TAG}")
94
-
95
-
96
69
  def _download_file(url: str, dest: Path) -> None:
97
70
  dest.parent.mkdir(parents=True, exist_ok=True)
98
- token = os.environ.get("DRIFT_GITHUB_TOKEN") or os.environ.get("GITHUB_TOKEN")
99
- headers = {"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36"}
100
- if "api.github.com" in url:
101
- headers["Accept"] = "application/octet-stream"
102
- if token:
103
- headers["Authorization"] = f"Bearer {token}"
71
+ headers = {"User-Agent": "Drift/1.0"}
72
+
73
+ def try_curl():
74
+ result = subprocess.run(
75
+ ["curl", "-fsSL", "-o", str(dest), url],
76
+ capture_output=True,
77
+ timeout=120,
78
+ )
79
+ if result.returncode != 0:
80
+ raise RuntimeError("curl failed")
104
81
 
105
82
  def try_requests():
106
83
  r = requests.get(url, headers=headers, stream=True, timeout=60)
@@ -116,40 +93,28 @@ def _download_file(url: str, dest: Path) -> None:
116
93
  with open(dest, "wb") as f:
117
94
  f.write(resp.read())
118
95
 
119
- def try_curl():
120
- result = subprocess.run(
121
- ["curl", "-fsSL", "-o", str(dest), url],
122
- capture_output=True,
123
- timeout=120,
124
- )
125
- if result.returncode != 0:
126
- raise RuntimeError(f"curl failed: {result.stderr.decode() or result.returncode}")
127
-
128
96
  for attempt in [try_curl, try_requests, try_urllib]:
129
97
  try:
130
98
  attempt()
131
99
  return
132
100
  except Exception:
133
101
  continue
134
- raise RuntimeError(f"Download failed. Try manually: curl -L -o {dest} {url}")
102
+ raise RuntimeError(f"Download failed. Try: curl -L -o {dest} {url}")
135
103
 
136
104
 
137
105
  def ensure_engine() -> bool:
138
- """
139
- If engine not running: download (if needed), start it, wait for health.
140
- Returns True if engine is ready, False on failure.
141
- """
106
+ """Download (if needed), start engine, wait for health."""
142
107
  if _engine_running():
143
108
  return True
144
109
 
145
110
  if not requests:
146
- print("drift: 'requests' required for engine download. pip install requests", file=sys.stderr)
111
+ print("drift: 'requests' required. pip install requests", file=sys.stderr)
147
112
  return False
148
113
 
149
114
  bin_path = _get_engine_path()
150
115
  bin_dir = _get_engine_dir()
151
116
  if not bin_path or not bin_dir:
152
- print("drift: Could not resolve engine dir (~/.drift/bin). Set HOME or USERPROFILE.", file=sys.stderr)
117
+ print("drift: Could not resolve ~/.drift/bin. Set HOME or USERPROFILE.", file=sys.stderr)
153
118
  return False
154
119
 
155
120
  bin_dir.mkdir(parents=True, exist_ok=True)
@@ -159,14 +124,12 @@ def ensure_engine() -> bool:
159
124
  ext = ".exe" if platform.system() == "Windows" else ""
160
125
  asset = f"drift-engine-{plat}-{arch}{ext}"
161
126
  print(f"drift: Downloading engine ({asset})...", file=sys.stderr)
162
- url = _get_asset_download_url(asset)
163
127
  try:
128
+ url = _get_asset_url(asset)
164
129
  _download_file(url, bin_path)
165
130
  except Exception as e:
166
131
  print(f"drift: Download failed: {e}", file=sys.stderr)
167
- print(f"drift: Run this manually, then try again:", file=sys.stderr)
168
- print(f" mkdir -p ~/.drift/bin && curl -L -o ~/.drift/bin/{asset} {url}", file=sys.stderr)
169
- print(f" chmod +x ~/.drift/bin/{asset}", file=sys.stderr)
132
+ print(f"drift: Run: mkdir -p ~/.drift/bin && curl -L -o ~/.drift/bin/{asset} <url>", file=sys.stderr)
170
133
  return False
171
134
  if platform.system() != "Windows":
172
135
  bin_path.chmod(0o755)
@@ -176,7 +139,13 @@ def ensure_engine() -> bool:
176
139
  except Exception:
177
140
  pass
178
141
 
179
- # Start engine
142
+ if platform.system() == "Darwin" and bin_path:
143
+ try:
144
+ bin_path.chmod(0o755)
145
+ subprocess.run(["xattr", "-dr", "com.apple.quarantine", str(bin_path)], check=False, capture_output=True)
146
+ except Exception:
147
+ pass
148
+
180
149
  env = {**os.environ, "DRIFT_ENGINE_PORT": ENGINE_PORT}
181
150
  proc = subprocess.Popen(
182
151
  [str(bin_path)],
@@ -186,10 +155,9 @@ def ensure_engine() -> bool:
186
155
  stderr=subprocess.DEVNULL,
187
156
  start_new_session=True,
188
157
  )
189
- proc.wait() # wait briefly to avoid race
158
+ proc.wait()
190
159
  del proc
191
160
 
192
- # Poll for health
193
161
  for _ in range(60):
194
162
  if _engine_running():
195
163
  return True
@@ -0,0 +1,10 @@
1
+ Metadata-Version: 2.4
2
+ Name: drift-ml
3
+ Version: 0.2.1
4
+ Summary: drift — terminal-first, chat-based AutoML. Open source. No tokens. No auth.
5
+ Project-URL: Homepage, https://github.com/lakshitsachdeva/intent2model
6
+ Project-URL: Repository, https://github.com/lakshitsachdeva/intent2model
7
+ Requires-Python: >=3.10
8
+ License-File: LICENSE
9
+ Requires-Dist: requests>=2.28.0
10
+ Dynamic: license-file
@@ -1,6 +1,6 @@
1
1
  drift/__init__.py,sha256=X0NUP5ZAZSz-rBFfjvmmS4IYWP2_CZtu187mqwpWwqk,127
2
2
  drift/__main__.py,sha256=r2mhZ3sCvDY7iEEiZoGDvUPei_CY24tfMQgs7Oal2yk,856
3
- drift/engine_launcher.py,sha256=DlnSRNeHdov_XfVQ-QvDyTTN0J-wQdTlSnx8N_6N_7o,6648
3
+ drift/engine_launcher.py,sha256=OjHNRU9jW3ToqfXuXHPpTwdaS_Axad-gNVpZZbs1W8c,5231
4
4
  drift/cli/__init__.py,sha256=OQt7M06e98e_L_60Qz-HsmSqGXKWdH53SvgETJ_BZZ0,172
5
5
  drift/cli/client.py,sha256=hGxz-J8fC_gGV9BZnpCBwkQZg4Q0_s9-Agk2PuXQ5MQ,5527
6
6
  drift/cli/repl.py,sha256=hRnx4nfP_StnXDbdRZXnnjA8aNvrdQSV-uTNsuaaO60,8262
@@ -9,8 +9,9 @@ drift/llm_adapters/__init__.py,sha256=y1UhZWlC8Ik_OKfLcOp0JZP-FKR3MBBCemWwsL6Tnk
9
9
  drift/llm_adapters/base.py,sha256=KlZUPYpvCI8pafklBWel0GHHLNtVKVwSHA92MZt3VsI,1331
10
10
  drift/llm_adapters/gemini_cli.py,sha256=Z61wY3yFiZqPrQrpJAQrBtMbBkr2qLWBkni-A4p9lZo,2163
11
11
  drift/llm_adapters/local_llm.py,sha256=Z6j6z1CXk2LMeQ5ZnY4o38PiYkHYmcIkgJGkHdU50M8,2279
12
- drift_ml-0.1.11.dist-info/METADATA,sha256=NMdqz6WMo0nNe81-4M3T96-FglpZOZouWyCM31q8YPE,169
13
- drift_ml-0.1.11.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
14
- drift_ml-0.1.11.dist-info/entry_points.txt,sha256=aCY7U9M8nhYj_tIfTXJmYkVmXY3ZoxF0tebDZzYswv8,46
15
- drift_ml-0.1.11.dist-info/top_level.txt,sha256=3u2KGqsciGZQ2uCoBivm55t3e8er8S4xnqkgdQ_8oeM,6
16
- drift_ml-0.1.11.dist-info/RECORD,,
12
+ drift_ml-0.2.1.dist-info/licenses/LICENSE,sha256=MdZfE1ctfpz-RISaUozKjRDuwTLqlMKcoHDzT3m43zk,1073
13
+ drift_ml-0.2.1.dist-info/METADATA,sha256=gT3VtfUdVbmlqr47_c-OG9RkGVY0mN8RPQpe5_M_Rx4,383
14
+ drift_ml-0.2.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
15
+ drift_ml-0.2.1.dist-info/entry_points.txt,sha256=aCY7U9M8nhYj_tIfTXJmYkVmXY3ZoxF0tebDZzYswv8,46
16
+ drift_ml-0.2.1.dist-info/top_level.txt,sha256=3u2KGqsciGZQ2uCoBivm55t3e8er8S4xnqkgdQ_8oeM,6
17
+ drift_ml-0.2.1.dist-info/RECORD,,
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Lakshit Sachdeva
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,6 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: drift-ml
3
- Version: 0.1.11
4
- Summary: Terminal-first AutoML CLI - chat-based ML engineer
5
- Requires-Python: >=3.10
6
- Requires-Dist: requests>=2.28.0