drift-ml 0.1.10__tar.gz → 0.1.11__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.1.10
3
+ Version: 0.1.11
4
4
  Summary: Terminal-first AutoML CLI - chat-based ML engineer
5
5
  Requires-Python: >=3.10
6
6
  Requires-Dist: requests>=2.28.0
@@ -101,20 +101,38 @@ def _download_file(url: str, dest: Path) -> None:
101
101
  headers["Accept"] = "application/octet-stream"
102
102
  if token:
103
103
  headers["Authorization"] = f"Bearer {token}"
104
- try:
104
+
105
+ def try_requests():
105
106
  r = requests.get(url, headers=headers, stream=True, timeout=60)
106
107
  r.raise_for_status()
107
108
  with open(dest, "wb") as f:
108
109
  for chunk in r.iter_content(chunk_size=65536):
109
110
  f.write(chunk)
110
- except Exception:
111
- # Fallback: urllib (stdlib, no deps, works when requests has issues)
111
+
112
+ def try_urllib():
112
113
  import urllib.request
113
114
  req = urllib.request.Request(url, headers=headers)
114
115
  with urllib.request.urlopen(req, timeout=60) as resp:
115
116
  with open(dest, "wb") as f:
116
117
  f.write(resp.read())
117
118
 
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
+ for attempt in [try_curl, try_requests, try_urllib]:
129
+ try:
130
+ attempt()
131
+ return
132
+ except Exception:
133
+ continue
134
+ raise RuntimeError(f"Download failed. Try manually: curl -L -o {dest} {url}")
135
+
118
136
 
119
137
  def ensure_engine() -> bool:
120
138
  """
@@ -145,13 +163,11 @@ def ensure_engine() -> bool:
145
163
  try:
146
164
  _download_file(url, bin_path)
147
165
  except Exception as e:
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)
154
- return False
166
+ 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)
170
+ return False
155
171
  if platform.system() != "Windows":
156
172
  bin_path.chmod(0o755)
157
173
  if platform.system() == "Darwin":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: drift-ml
3
- Version: 0.1.10
3
+ Version: 0.1.11
4
4
  Summary: Terminal-first AutoML CLI - chat-based ML engineer
5
5
  Requires-Python: >=3.10
6
6
  Requires-Dist: requests>=2.28.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "drift-ml"
7
- version = "0.1.10"
7
+ version = "0.1.11"
8
8
  description = "Terminal-first AutoML CLI - chat-based ML engineer"
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