doushi-cli 1.0.2__tar.gz → 1.0.4__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.
- {doushi_cli-1.0.2/doushi_cli.egg-info → doushi_cli-1.0.4}/PKG-INFO +1 -1
- {doushi_cli-1.0.2 → doushi_cli-1.0.4}/doushi/__init__.py +1 -1
- {doushi_cli-1.0.2 → doushi_cli-1.0.4}/doushi/client.py +29 -0
- {doushi_cli-1.0.2 → doushi_cli-1.0.4}/doushi/commands/export.py +8 -0
- {doushi_cli-1.0.2 → doushi_cli-1.0.4}/doushi/templates.py +2 -0
- {doushi_cli-1.0.2 → doushi_cli-1.0.4/doushi_cli.egg-info}/PKG-INFO +1 -1
- {doushi_cli-1.0.2 → doushi_cli-1.0.4}/pyproject.toml +1 -1
- {doushi_cli-1.0.2 → doushi_cli-1.0.4}/tests/test_cli.py +2 -1
- {doushi_cli-1.0.2 → doushi_cli-1.0.4}/LICENSE +0 -0
- {doushi_cli-1.0.2 → doushi_cli-1.0.4}/README.md +0 -0
- {doushi_cli-1.0.2 → doushi_cli-1.0.4}/doushi/commands/__init__.py +0 -0
- {doushi_cli-1.0.2 → doushi_cli-1.0.4}/doushi/commands/auth.py +0 -0
- {doushi_cli-1.0.2 → doushi_cli-1.0.4}/doushi/commands/demo.py +0 -0
- {doushi_cli-1.0.2 → doushi_cli-1.0.4}/doushi/commands/logs.py +0 -0
- {doushi_cli-1.0.2 → doushi_cli-1.0.4}/doushi/commands/predict.py +0 -0
- {doushi_cli-1.0.2 → doushi_cli-1.0.4}/doushi/commands/projects.py +0 -0
- {doushi_cli-1.0.2 → doushi_cli-1.0.4}/doushi/commands/train.py +0 -0
- {doushi_cli-1.0.2 → doushi_cli-1.0.4}/doushi/config.py +0 -0
- {doushi_cli-1.0.2 → doushi_cli-1.0.4}/doushi/main.py +0 -0
- {doushi_cli-1.0.2 → doushi_cli-1.0.4}/doushi/ui.py +0 -0
- {doushi_cli-1.0.2 → doushi_cli-1.0.4}/doushi_cli.egg-info/SOURCES.txt +0 -0
- {doushi_cli-1.0.2 → doushi_cli-1.0.4}/doushi_cli.egg-info/dependency_links.txt +0 -0
- {doushi_cli-1.0.2 → doushi_cli-1.0.4}/doushi_cli.egg-info/entry_points.txt +0 -0
- {doushi_cli-1.0.2 → doushi_cli-1.0.4}/doushi_cli.egg-info/requires.txt +0 -0
- {doushi_cli-1.0.2 → doushi_cli-1.0.4}/doushi_cli.egg-info/top_level.txt +0 -0
- {doushi_cli-1.0.2 → doushi_cli-1.0.4}/setup.cfg +0 -0
|
@@ -253,3 +253,32 @@ class DoushiClient:
|
|
|
253
253
|
headers=self._get_headers()
|
|
254
254
|
)
|
|
255
255
|
return self._handle_response(resp)
|
|
256
|
+
|
|
257
|
+
def download_model_artifact(self, project_id: str, dest_file: Path) -> bool:
|
|
258
|
+
"""Download trained model.pkl artifact to destination file."""
|
|
259
|
+
self.check_auth_or_exit()
|
|
260
|
+
try:
|
|
261
|
+
with httpx.Client(timeout=self.timeout) as client:
|
|
262
|
+
resp = client.get(f"{self.base_url}/api/projects/{project_id}/download-model", headers=self._get_headers())
|
|
263
|
+
data = self._handle_response(resp)
|
|
264
|
+
presigned_url = data.get("url")
|
|
265
|
+
except Exception:
|
|
266
|
+
return False
|
|
267
|
+
|
|
268
|
+
if not presigned_url:
|
|
269
|
+
return False
|
|
270
|
+
|
|
271
|
+
try:
|
|
272
|
+
with httpx.Client(timeout=180.0, follow_redirects=True) as client:
|
|
273
|
+
with client.stream("GET", presigned_url) as stream_resp:
|
|
274
|
+
if stream_resp.status_code == 404:
|
|
275
|
+
return False
|
|
276
|
+
if not stream_resp.is_success:
|
|
277
|
+
return False
|
|
278
|
+
with open(dest_file, "wb") as f:
|
|
279
|
+
for chunk in stream_resp.iter_bytes(chunk_size=65536):
|
|
280
|
+
f.write(chunk)
|
|
281
|
+
return dest_file.exists() and dest_file.stat().st_size > 0
|
|
282
|
+
except Exception:
|
|
283
|
+
return False
|
|
284
|
+
|
|
@@ -66,9 +66,17 @@ def export_model(
|
|
|
66
66
|
with open(out_dir / "README.md", "w", encoding="utf-8") as f:
|
|
67
67
|
f.write(generate_export_readme(project_id=project_id, project_name=project_name))
|
|
68
68
|
|
|
69
|
+
# 4. Download trained model.pkl artifact
|
|
70
|
+
model_file = out_dir / "model.pkl"
|
|
71
|
+
has_model_file = False
|
|
72
|
+
with console.status(f"[bold cyan]Downloading model artifact (model.pkl)...[/bold cyan]"):
|
|
73
|
+
has_model_file = client.download_model_artifact(project_id=project_id, dest_file=model_file)
|
|
74
|
+
|
|
69
75
|
console.print("\n")
|
|
70
76
|
print_success(f"Project exported successfully to [bold cyan]{out_dir}[/bold cyan]!")
|
|
71
77
|
console.print("\n[dim]Files created:[/dim]")
|
|
78
|
+
if has_model_file:
|
|
79
|
+
console.print(f" ├── [bold green]{out_dir}/model.pkl[/bold green] (trained model weights)")
|
|
72
80
|
console.print(f" ├── {out_dir}/pipeline.py")
|
|
73
81
|
console.print(f" ├── {out_dir}/serve.py")
|
|
74
82
|
console.print(f" ├── {out_dir}/Dockerfile")
|
|
@@ -39,9 +39,10 @@ class TestDoushiCLI(unittest.TestCase):
|
|
|
39
39
|
|
|
40
40
|
def test_version_output(self):
|
|
41
41
|
"""Verify --version flag outputs version."""
|
|
42
|
+
from doushi import __version__
|
|
42
43
|
result = self.runner.invoke(app, ["--version"])
|
|
43
44
|
self.assertEqual(result.exit_code, 0)
|
|
44
|
-
self.assertIn(
|
|
45
|
+
self.assertIn(__version__, result.output)
|
|
45
46
|
|
|
46
47
|
def test_subcommand_helps(self):
|
|
47
48
|
"""Verify subcommands provide descriptive help."""
|
|
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
|
|
File without changes
|
|
File without changes
|