drift-ml 0.1.11__py3-none-any.whl → 0.2.2__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/__main__.py +1 -1
- drift/engine_launcher.py +58 -72
- drift_ml-0.2.2.dist-info/METADATA +10 -0
- {drift_ml-0.1.11.dist-info → drift_ml-0.2.2.dist-info}/RECORD +8 -7
- drift_ml-0.2.2.dist-info/licenses/LICENSE +21 -0
- drift_ml-0.1.11.dist-info/METADATA +0 -6
- {drift_ml-0.1.11.dist-info → drift_ml-0.2.2.dist-info}/WHEEL +0 -0
- {drift_ml-0.1.11.dist-info → drift_ml-0.2.2.dist-info}/entry_points.txt +0 -0
- {drift_ml-0.1.11.dist-info → drift_ml-0.2.2.dist-info}/top_level.txt +0 -0
drift/__main__.py
CHANGED
|
@@ -19,7 +19,7 @@ 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.
|
|
22
|
+
print("drift: Failed to start engine. Check ~/.drift/bin/.engine-stderr.log or set DRIFT_BACKEND_URL", file=sys.stderr)
|
|
23
23
|
sys.exit(1)
|
|
24
24
|
base_url = f"http://127.0.0.1:{os.environ.get('DRIFT_ENGINE_PORT', '8000')}"
|
|
25
25
|
run_repl(base_url=base_url)
|
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
|
-
|
|
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
|
-
|
|
20
|
-
|
|
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
|
|
64
|
-
"""
|
|
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
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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,23 +139,46 @@ def ensure_engine() -> bool:
|
|
|
176
139
|
except Exception:
|
|
177
140
|
pass
|
|
178
141
|
|
|
179
|
-
|
|
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
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
150
|
+
stderr_file = bin_dir / ".engine-stderr.log"
|
|
151
|
+
proc = None
|
|
152
|
+
try:
|
|
153
|
+
with open(stderr_file, "w") as errf:
|
|
154
|
+
proc = subprocess.Popen(
|
|
155
|
+
[str(bin_path)],
|
|
156
|
+
cwd=str(bin_dir),
|
|
157
|
+
env=env,
|
|
158
|
+
stdout=subprocess.DEVNULL,
|
|
159
|
+
stderr=errf,
|
|
160
|
+
start_new_session=True,
|
|
161
|
+
)
|
|
162
|
+
try:
|
|
163
|
+
proc.wait(timeout=3)
|
|
164
|
+
if proc.returncode and proc.returncode != 0:
|
|
165
|
+
err = stderr_file.read_text().strip() if stderr_file.exists() else ""
|
|
166
|
+
print(f"drift: Engine exited with code {proc.returncode}", file=sys.stderr)
|
|
167
|
+
if err:
|
|
168
|
+
print(f"drift: {err[-400:]}", file=sys.stderr)
|
|
169
|
+
return False
|
|
170
|
+
except subprocess.TimeoutExpired:
|
|
171
|
+
pass # Engine still running
|
|
172
|
+
except Exception as e:
|
|
173
|
+
print(f"drift: Engine spawn failed: {e}", file=sys.stderr)
|
|
174
|
+
return False
|
|
175
|
+
|
|
176
|
+
import time
|
|
193
177
|
for _ in range(60):
|
|
194
178
|
if _engine_running():
|
|
195
179
|
return True
|
|
196
|
-
import time
|
|
197
180
|
time.sleep(0.5)
|
|
181
|
+
err = stderr_file.read_text().strip() if stderr_file.exists() else ""
|
|
182
|
+
if err:
|
|
183
|
+
print(f"drift: Engine log: {err[-400:]}", file=sys.stderr)
|
|
198
184
|
return False
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: drift-ml
|
|
3
|
+
Version: 0.2.2
|
|
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
|
-
drift/__main__.py,sha256=
|
|
3
|
-
drift/engine_launcher.py,sha256=
|
|
2
|
+
drift/__main__.py,sha256=b0sqvVmeQhI-iDKQ_G_nB_n77whL5bnnPp-Llt556Ws,865
|
|
3
|
+
drift/engine_launcher.py,sha256=HmpnjTiOj_Pftj43uvrhY5akEXWPhIIFslqlmqFcCy8,6119
|
|
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.
|
|
13
|
-
drift_ml-0.
|
|
14
|
-
drift_ml-0.
|
|
15
|
-
drift_ml-0.
|
|
16
|
-
drift_ml-0.
|
|
12
|
+
drift_ml-0.2.2.dist-info/licenses/LICENSE,sha256=MdZfE1ctfpz-RISaUozKjRDuwTLqlMKcoHDzT3m43zk,1073
|
|
13
|
+
drift_ml-0.2.2.dist-info/METADATA,sha256=qJA4kDoZbcJDw98c_82Gi3tvFxmTOH23AUw5-4Ycir0,383
|
|
14
|
+
drift_ml-0.2.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
15
|
+
drift_ml-0.2.2.dist-info/entry_points.txt,sha256=aCY7U9M8nhYj_tIfTXJmYkVmXY3ZoxF0tebDZzYswv8,46
|
|
16
|
+
drift_ml-0.2.2.dist-info/top_level.txt,sha256=3u2KGqsciGZQ2uCoBivm55t3e8er8S4xnqkgdQ_8oeM,6
|
|
17
|
+
drift_ml-0.2.2.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.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|