drift-ml 0.1.9__tar.gz → 0.1.10__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.
- {drift_ml-0.1.9 → drift_ml-0.1.10}/PKG-INFO +1 -1
- {drift_ml-0.1.9 → drift_ml-0.1.10}/drift/__main__.py +4 -0
- {drift_ml-0.1.9 → drift_ml-0.1.10}/drift/engine_launcher.py +25 -18
- {drift_ml-0.1.9 → drift_ml-0.1.10}/drift_ml.egg-info/PKG-INFO +1 -1
- {drift_ml-0.1.9 → drift_ml-0.1.10}/pyproject.toml +1 -1
- {drift_ml-0.1.9 → drift_ml-0.1.10}/README.md +0 -0
- {drift_ml-0.1.9 → drift_ml-0.1.10}/drift/__init__.py +0 -0
- {drift_ml-0.1.9 → drift_ml-0.1.10}/drift/cli/__init__.py +0 -0
- {drift_ml-0.1.9 → drift_ml-0.1.10}/drift/cli/client.py +0 -0
- {drift_ml-0.1.9 → drift_ml-0.1.10}/drift/cli/repl.py +0 -0
- {drift_ml-0.1.9 → drift_ml-0.1.10}/drift/cli/session.py +0 -0
- {drift_ml-0.1.9 → drift_ml-0.1.10}/drift/llm_adapters/__init__.py +0 -0
- {drift_ml-0.1.9 → drift_ml-0.1.10}/drift/llm_adapters/base.py +0 -0
- {drift_ml-0.1.9 → drift_ml-0.1.10}/drift/llm_adapters/gemini_cli.py +0 -0
- {drift_ml-0.1.9 → drift_ml-0.1.10}/drift/llm_adapters/local_llm.py +0 -0
- {drift_ml-0.1.9 → drift_ml-0.1.10}/drift_ml.egg-info/SOURCES.txt +0 -0
- {drift_ml-0.1.9 → drift_ml-0.1.10}/drift_ml.egg-info/dependency_links.txt +0 -0
- {drift_ml-0.1.9 → drift_ml-0.1.10}/drift_ml.egg-info/entry_points.txt +0 -0
- {drift_ml-0.1.9 → drift_ml-0.1.10}/drift_ml.egg-info/requires.txt +0 -0
- {drift_ml-0.1.9 → drift_ml-0.1.10}/drift_ml.egg-info/top_level.txt +0 -0
- {drift_ml-0.1.9 → drift_ml-0.1.10}/setup.cfg +0 -0
|
@@ -10,6 +10,10 @@ from drift.cli.repl import run_repl
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
def main() -> None:
|
|
13
|
+
if "--version" in sys.argv or "-v" in sys.argv:
|
|
14
|
+
from importlib.metadata import version
|
|
15
|
+
print(f"drift-ml {version('drift-ml')}")
|
|
16
|
+
return
|
|
13
17
|
base_url = os.environ.get("DRIFT_BACKEND_URL")
|
|
14
18
|
if not base_url:
|
|
15
19
|
from drift.engine_launcher import ensure_engine
|
|
@@ -62,6 +62,9 @@ def _engine_running() -> bool:
|
|
|
62
62
|
|
|
63
63
|
def _get_asset_download_url(asset_name: str) -> str:
|
|
64
64
|
"""Resolve GitHub release asset to download URL. Prefer direct URL (no API)."""
|
|
65
|
+
base = os.environ.get("DRIFT_ENGINE_BASE_URL")
|
|
66
|
+
if base:
|
|
67
|
+
return f"{base.rstrip('/')}/{asset_name}"
|
|
65
68
|
return f"https://github.com/{GITHUB_REPO}/releases/download/{ENGINE_TAG}/{asset_name}"
|
|
66
69
|
|
|
67
70
|
|
|
@@ -91,19 +94,26 @@ def _get_asset_download_url_via_api(asset_name: str) -> str:
|
|
|
91
94
|
|
|
92
95
|
|
|
93
96
|
def _download_file(url: str, dest: Path) -> None:
|
|
97
|
+
dest.parent.mkdir(parents=True, exist_ok=True)
|
|
94
98
|
token = os.environ.get("DRIFT_GITHUB_TOKEN") or os.environ.get("GITHUB_TOKEN")
|
|
95
|
-
headers = {"User-Agent": "
|
|
96
|
-
# API URLs need Accept: application/octet-stream; browser_download_url works with default
|
|
99
|
+
headers = {"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36"}
|
|
97
100
|
if "api.github.com" in url:
|
|
98
101
|
headers["Accept"] = "application/octet-stream"
|
|
99
102
|
if token:
|
|
100
103
|
headers["Authorization"] = f"Bearer {token}"
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
try:
|
|
105
|
+
r = requests.get(url, headers=headers, stream=True, timeout=60)
|
|
106
|
+
r.raise_for_status()
|
|
107
|
+
with open(dest, "wb") as f:
|
|
108
|
+
for chunk in r.iter_content(chunk_size=65536):
|
|
109
|
+
f.write(chunk)
|
|
110
|
+
except Exception:
|
|
111
|
+
# Fallback: urllib (stdlib, no deps, works when requests has issues)
|
|
112
|
+
import urllib.request
|
|
113
|
+
req = urllib.request.Request(url, headers=headers)
|
|
114
|
+
with urllib.request.urlopen(req, timeout=60) as resp:
|
|
115
|
+
with open(dest, "wb") as f:
|
|
116
|
+
f.write(resp.read())
|
|
107
117
|
|
|
108
118
|
|
|
109
119
|
def ensure_engine() -> bool:
|
|
@@ -131,19 +141,16 @@ def ensure_engine() -> bool:
|
|
|
131
141
|
ext = ".exe" if platform.system() == "Windows" else ""
|
|
132
142
|
asset = f"drift-engine-{plat}-{arch}{ext}"
|
|
133
143
|
print(f"drift: Downloading engine ({asset})...", file=sys.stderr)
|
|
144
|
+
url = _get_asset_download_url(asset)
|
|
134
145
|
try:
|
|
135
|
-
url = _get_asset_download_url(asset)
|
|
136
146
|
_download_file(url, bin_path)
|
|
137
147
|
except Exception as e:
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
return False
|
|
145
|
-
else:
|
|
146
|
-
print(f"drift: Download failed: {e}", file=sys.stderr)
|
|
148
|
+
try:
|
|
149
|
+
url = _get_asset_download_url_via_api(asset)
|
|
150
|
+
_download_file(url, bin_path)
|
|
151
|
+
except Exception as e2:
|
|
152
|
+
print(f"drift: Download failed: {e2}", file=sys.stderr)
|
|
153
|
+
print(f"drift: Try manually: curl -L -o {bin_path} {url}", file=sys.stderr)
|
|
147
154
|
return False
|
|
148
155
|
if platform.system() != "Windows":
|
|
149
156
|
bin_path.chmod(0o755)
|
|
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
|
|
File without changes
|