cerebrium 1.39.6__py3-none-any.whl → 2.1.10__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.
- cerebrium-2.1.10.dist-info/METADATA +85 -0
- cerebrium-2.1.10.dist-info/RECORD +7 -0
- {cerebrium-1.39.6.dist-info → cerebrium-2.1.10.dist-info}/WHEEL +2 -1
- cerebrium-2.1.10.dist-info/entry_points.txt +2 -0
- cerebrium-2.1.10.dist-info/licenses/LICENSE +21 -0
- cerebrium-2.1.10.dist-info/top_level.txt +1 -0
- cerebrium_cli.py +310 -0
- cerebrium/__init__.py +0 -1
- cerebrium/__main__.py +0 -23
- cerebrium/api.py +0 -398
- cerebrium/commands/app.py +0 -379
- cerebrium/commands/auth.py +0 -151
- cerebrium/commands/cortex.py +0 -364
- cerebrium/commands/files.py +0 -397
- cerebrium/commands/logs.py +0 -184
- cerebrium/commands/project.py +0 -109
- cerebrium/commands/run.py +0 -301
- cerebrium/commands/runs.py +0 -112
- cerebrium/config.py +0 -270
- cerebrium/core.py +0 -3
- cerebrium/defaults.py +0 -36
- cerebrium/files.py +0 -11
- cerebrium/main.py +0 -68
- cerebrium/types.py +0 -5
- cerebrium/utils/bugsnag_setup.py +0 -63
- cerebrium/utils/check_cli_version.py +0 -39
- cerebrium/utils/deploy.py +0 -327
- cerebrium/utils/display.py +0 -145
- cerebrium/utils/files.py +0 -65
- cerebrium/utils/logging.py +0 -118
- cerebrium/utils/project.py +0 -42
- cerebrium/utils/requirements.py +0 -138
- cerebrium/utils/sync_files.py +0 -63
- cerebrium/utils/termination.py +0 -69
- cerebrium/utils/verification.py +0 -101
- cerebrium-1.39.6.dist-info/LICENSE +0 -661
- cerebrium-1.39.6.dist-info/METADATA +0 -106
- cerebrium-1.39.6.dist-info/RECORD +0 -33
- cerebrium-1.39.6.dist-info/entry_points.txt +0 -3
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cerebrium
|
|
3
|
+
Version: 2.1.10
|
|
4
|
+
Summary: CLI for deploying and managing Cerebrium apps
|
|
5
|
+
Author-email: Cerebrium AI <support@cerebrium.ai>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Documentation, https://docs.cerebrium.ai/
|
|
8
|
+
Project-URL: Repository, https://github.com/CerebriumAI/cerebrium
|
|
9
|
+
Project-URL: Issues, https://github.com/CerebriumAI/cerebrium/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/CerebriumAI/cerebrium/releases
|
|
11
|
+
Keywords: cerebrium,cli,deployment,ai,ml,machine-learning
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
23
|
+
Classifier: Operating System :: MacOS
|
|
24
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
25
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
26
|
+
Classifier: Topic :: System :: Systems Administration
|
|
27
|
+
Requires-Python: >=3.8
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
# Cerebrium CLI
|
|
33
|
+
|
|
34
|
+
Official Python package for the Cerebrium CLI - deploy and manage AI applications with ease.
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install cerebrium
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This will download and install the appropriate Cerebrium CLI binary for your platform.
|
|
43
|
+
|
|
44
|
+
## Quick Start
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Login to Cerebrium
|
|
48
|
+
cerebrium login
|
|
49
|
+
|
|
50
|
+
# Initialize a new project
|
|
51
|
+
cerebrium init my-app
|
|
52
|
+
|
|
53
|
+
# Deploy your application
|
|
54
|
+
cerebrium deploy
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## About
|
|
58
|
+
|
|
59
|
+
This Python package is a wrapper that downloads and manages the Cerebrium Go CLI binary. On first run, it will:
|
|
60
|
+
|
|
61
|
+
1. Detect your operating system and architecture
|
|
62
|
+
2. Download the appropriate pre-compiled binary from GitHub releases
|
|
63
|
+
3. Verify checksums for security
|
|
64
|
+
4. Install it to `~/.cerebrium/bin/`
|
|
65
|
+
|
|
66
|
+
Subsequent runs use the cached binary.
|
|
67
|
+
|
|
68
|
+
## Supported Platforms
|
|
69
|
+
|
|
70
|
+
- **macOS**: Intel (x86_64) and Apple Silicon (arm64)
|
|
71
|
+
- **Linux**: x86_64 and arm64
|
|
72
|
+
- **Windows**: x86_64
|
|
73
|
+
|
|
74
|
+
## Documentation
|
|
75
|
+
|
|
76
|
+
For full documentation, visit [docs.cerebrium.ai](https://docs.cerebrium.ai)
|
|
77
|
+
|
|
78
|
+
## Support
|
|
79
|
+
|
|
80
|
+
- GitHub Issues: [github.com/CerebriumAI/cerebrium/issues](https://github.com/CerebriumAI/cerebrium/issues)
|
|
81
|
+
- Email: support@cerebrium.ai
|
|
82
|
+
|
|
83
|
+
## License
|
|
84
|
+
|
|
85
|
+
MIT License - see [LICENSE](https://github.com/CerebriumAI/cerebrium/blob/main/LICENSE) for details.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
cerebrium_cli.py,sha256=SidpJQFwGXQsBkV7LN6MCv0YrUUSRZuJAUDlDw3JBns,9842
|
|
2
|
+
cerebrium-2.1.10.dist-info/licenses/LICENSE,sha256=u7XCwQMGRP0gSq7xrRxKLyQPP-IKVUdEcrMzs0_nXJg,1069
|
|
3
|
+
cerebrium-2.1.10.dist-info/METADATA,sha256=q-6xYApuDfGNI-aNG3J4KpzDITE7obXvHmn62c3Obvs,2624
|
|
4
|
+
cerebrium-2.1.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
5
|
+
cerebrium-2.1.10.dist-info/entry_points.txt,sha256=S7rf3wTPoqmRcmtHBf062sRx7JmlXLvaNW4Tf_HbDko,49
|
|
6
|
+
cerebrium-2.1.10.dist-info/top_level.txt,sha256=8HaQPnPNist_EEHsBqhRtv38Z-XjTFNUapEyOgi0XpA,14
|
|
7
|
+
cerebrium-2.1.10.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Cerebrium AI
|
|
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.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cerebrium_cli
|
cerebrium_cli.py
ADDED
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Python wrapper that executes the Go-based Cerebrium CLI binary.
|
|
3
|
+
|
|
4
|
+
Downloads the binary on first run if not present.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import hashlib
|
|
8
|
+
import io
|
|
9
|
+
import os
|
|
10
|
+
import platform
|
|
11
|
+
import re
|
|
12
|
+
import stat
|
|
13
|
+
import subprocess
|
|
14
|
+
import sys
|
|
15
|
+
import tarfile
|
|
16
|
+
import zipfile
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
from urllib.error import HTTPError, URLError
|
|
19
|
+
from urllib.request import urlopen
|
|
20
|
+
|
|
21
|
+
# DO NOT EDIT: This version is automatically updated by the GitHub Action
|
|
22
|
+
# (.github/workflows/pypi-publish.yml) during release. It uses GitHub/semver
|
|
23
|
+
# format (e.g., "2.1.0-beta.1" for beta, "2.1.0" for stable).
|
|
24
|
+
VERSION = "2.1.10"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def github_to_pypi_version(github_version: str) -> str:
|
|
28
|
+
"""Convert GitHub/semver version to PEP 440 format for PyPI.
|
|
29
|
+
|
|
30
|
+
Examples:
|
|
31
|
+
2.1.0-beta.1 -> 2.1.0b1
|
|
32
|
+
2.1.0-alpha.1 -> 2.1.0a1
|
|
33
|
+
2.1.0-rc.1 -> 2.1.0rc1
|
|
34
|
+
2.1.0 -> 2.1.0
|
|
35
|
+
"""
|
|
36
|
+
match = re.match(r"^(\d+\.\d+\.\d+)-(alpha|beta|rc|RC)\.(\d+)$", github_version)
|
|
37
|
+
if match:
|
|
38
|
+
base, pre_type, pre_num = match.groups()
|
|
39
|
+
pre_map = {"alpha": "a", "beta": "b", "rc": "rc", "RC": "rc"}
|
|
40
|
+
return f"{base}{pre_map[pre_type]}{pre_num}"
|
|
41
|
+
|
|
42
|
+
return github_version # Stable version, no change needed
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# PEP 440 version for PyPI - computed from VERSION
|
|
46
|
+
# This is what setuptools reads for the package version
|
|
47
|
+
__version__ = github_to_pypi_version(VERSION)
|
|
48
|
+
|
|
49
|
+
# GitHub repository for releases
|
|
50
|
+
GITHUB_REPO = "CerebriumAI/cerebrium"
|
|
51
|
+
|
|
52
|
+
# GitHub release URL patterns
|
|
53
|
+
RELEASE_URL_TEMPLATE = (
|
|
54
|
+
"https://github.com/{repo}/releases/download/"
|
|
55
|
+
"v{version}/cerebrium_cli_{os}_{arch}.{ext}"
|
|
56
|
+
)
|
|
57
|
+
CHECKSUMS_URL_TEMPLATE = (
|
|
58
|
+
"https://github.com/{repo}/releases/download/v{version}/checksums.txt"
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def get_bin_dir() -> Path:
|
|
63
|
+
"""Get the directory where the binary should be installed."""
|
|
64
|
+
return Path.home() / ".cerebrium" / "bin"
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def get_binary_path() -> Path:
|
|
68
|
+
"""Get the path to the cerebrium binary."""
|
|
69
|
+
binary_name = "cerebrium.exe" if os.name == "nt" else "cerebrium"
|
|
70
|
+
return get_bin_dir() / binary_name
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def get_version_file() -> Path:
|
|
74
|
+
"""Get the path to the version file that tracks installed version."""
|
|
75
|
+
return get_bin_dir() / ".version"
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def get_installed_version() -> str | None:
|
|
79
|
+
"""Get the currently installed version, if any."""
|
|
80
|
+
version_file = get_version_file()
|
|
81
|
+
if version_file.exists():
|
|
82
|
+
return version_file.read_text().strip()
|
|
83
|
+
return None
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def save_installed_version(version: str) -> None:
|
|
87
|
+
"""Save the installed version to the version file."""
|
|
88
|
+
version_file = get_version_file()
|
|
89
|
+
version_file.parent.mkdir(parents=True, exist_ok=True)
|
|
90
|
+
version_file.write_text(version)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def get_platform_info() -> tuple[str, str, str]:
|
|
94
|
+
"""Determine OS and architecture for binary download."""
|
|
95
|
+
system = platform.system().lower()
|
|
96
|
+
machine = platform.machine().lower()
|
|
97
|
+
|
|
98
|
+
# Map Python platform names to GoReleaser naming
|
|
99
|
+
os_map = {
|
|
100
|
+
"darwin": "darwin",
|
|
101
|
+
"linux": "linux",
|
|
102
|
+
"windows": "windows",
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
arch_map = {
|
|
106
|
+
"x86_64": "amd64",
|
|
107
|
+
"amd64": "amd64",
|
|
108
|
+
"aarch64": "arm64",
|
|
109
|
+
"arm64": "arm64",
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
os_name = os_map.get(system)
|
|
113
|
+
arch_name = arch_map.get(machine)
|
|
114
|
+
|
|
115
|
+
if not os_name or not arch_name:
|
|
116
|
+
print(
|
|
117
|
+
f"Error: Unsupported platform: {system} {machine}\n"
|
|
118
|
+
f"Please install the binary manually from:\n"
|
|
119
|
+
f"https://github.com/{GITHUB_REPO}/releases",
|
|
120
|
+
file=sys.stderr,
|
|
121
|
+
)
|
|
122
|
+
sys.exit(1)
|
|
123
|
+
|
|
124
|
+
ext = "zip" if system == "windows" else "tar.gz"
|
|
125
|
+
|
|
126
|
+
return os_name, arch_name, ext
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def verify_checksum(data: bytes, expected_checksums: str, archive_name: str) -> None:
|
|
130
|
+
"""Verify the SHA256 checksum of downloaded data."""
|
|
131
|
+
sha256_hash = hashlib.sha256(data).hexdigest()
|
|
132
|
+
|
|
133
|
+
# Find the expected checksum for this archive
|
|
134
|
+
expected_checksum = None
|
|
135
|
+
for line in expected_checksums.split("\n"):
|
|
136
|
+
if archive_name in line:
|
|
137
|
+
parts = line.split()
|
|
138
|
+
if len(parts) >= 2:
|
|
139
|
+
expected_checksum = parts[0]
|
|
140
|
+
break
|
|
141
|
+
|
|
142
|
+
if not expected_checksum:
|
|
143
|
+
raise RuntimeError(
|
|
144
|
+
f"Checksum not found for {archive_name} in checksums.txt.\n"
|
|
145
|
+
f"This may indicate a compromised release."
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
if sha256_hash != expected_checksum:
|
|
149
|
+
raise RuntimeError(
|
|
150
|
+
f"Checksum verification failed for {archive_name}!\n"
|
|
151
|
+
f"Expected: {expected_checksum}\n"
|
|
152
|
+
f"Got: {sha256_hash}\n"
|
|
153
|
+
f"This may indicate a corrupted download or security issue."
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
print(f" Checksum verified: {sha256_hash[:16]}...")
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def download_with_progress(url: str, desc: str) -> bytes:
|
|
160
|
+
"""Download a URL with a simple progress indicator."""
|
|
161
|
+
try:
|
|
162
|
+
with urlopen(url, timeout=60) as response:
|
|
163
|
+
total_size = response.headers.get("Content-Length")
|
|
164
|
+
if total_size:
|
|
165
|
+
total_size = int(total_size)
|
|
166
|
+
|
|
167
|
+
data = b""
|
|
168
|
+
downloaded = 0
|
|
169
|
+
block_size = 8192
|
|
170
|
+
|
|
171
|
+
while True:
|
|
172
|
+
chunk = response.read(block_size)
|
|
173
|
+
if not chunk:
|
|
174
|
+
break
|
|
175
|
+
data += chunk
|
|
176
|
+
downloaded += len(chunk)
|
|
177
|
+
|
|
178
|
+
if total_size:
|
|
179
|
+
pct = (downloaded / total_size) * 100
|
|
180
|
+
mb_down = downloaded / (1024 * 1024)
|
|
181
|
+
mb_total = total_size / (1024 * 1024)
|
|
182
|
+
print(
|
|
183
|
+
f"\r {desc}: {mb_down:.1f}/{mb_total:.1f} MB ({pct:.0f}%)",
|
|
184
|
+
end="",
|
|
185
|
+
flush=True,
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
print() # Newline after progress
|
|
189
|
+
return data
|
|
190
|
+
except (HTTPError, URLError) as e:
|
|
191
|
+
raise RuntimeError(f"Failed to download from {url}: {e}")
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def download_binary(version: str) -> Path:
|
|
195
|
+
"""Download the appropriate binary for this platform."""
|
|
196
|
+
os_name, arch_name, ext = get_platform_info()
|
|
197
|
+
|
|
198
|
+
archive_name = f"cerebrium_cli_{os_name}_{arch_name}.{ext}"
|
|
199
|
+
url = RELEASE_URL_TEMPLATE.format(
|
|
200
|
+
repo=GITHUB_REPO, version=version, os=os_name, arch=arch_name, ext=ext
|
|
201
|
+
)
|
|
202
|
+
checksums_url = CHECKSUMS_URL_TEMPLATE.format(repo=GITHUB_REPO, version=version)
|
|
203
|
+
|
|
204
|
+
print(f"Downloading Cerebrium CLI v{version} for {os_name}/{arch_name}...")
|
|
205
|
+
|
|
206
|
+
# Download checksums first
|
|
207
|
+
try:
|
|
208
|
+
with urlopen(checksums_url, timeout=10) as response:
|
|
209
|
+
checksums_data = response.read().decode("utf-8")
|
|
210
|
+
except (HTTPError, URLError) as e:
|
|
211
|
+
raise RuntimeError(
|
|
212
|
+
f"Failed to download checksums: {e}\n"
|
|
213
|
+
f"Please install manually from:\n"
|
|
214
|
+
f"https://github.com/{GITHUB_REPO}/releases"
|
|
215
|
+
)
|
|
216
|
+
|
|
217
|
+
# Download the binary archive
|
|
218
|
+
data = download_with_progress(url, "Downloading")
|
|
219
|
+
|
|
220
|
+
# Verify checksum
|
|
221
|
+
verify_checksum(data, checksums_data, archive_name)
|
|
222
|
+
|
|
223
|
+
# Extract the binary
|
|
224
|
+
bin_dir = get_bin_dir()
|
|
225
|
+
bin_dir.mkdir(parents=True, exist_ok=True)
|
|
226
|
+
|
|
227
|
+
binary_name = "cerebrium.exe" if os_name == "windows" else "cerebrium"
|
|
228
|
+
binary_path = bin_dir / binary_name
|
|
229
|
+
|
|
230
|
+
print(f" Extracting to {binary_path}...")
|
|
231
|
+
|
|
232
|
+
binary_found = False
|
|
233
|
+
|
|
234
|
+
if ext == "zip":
|
|
235
|
+
with zipfile.ZipFile(io.BytesIO(data)) as zf:
|
|
236
|
+
for member in zf.namelist():
|
|
237
|
+
if member.endswith(binary_name) or member == binary_name:
|
|
238
|
+
with zf.open(member) as src, open(binary_path, "wb") as dst:
|
|
239
|
+
dst.write(src.read())
|
|
240
|
+
binary_found = True
|
|
241
|
+
break
|
|
242
|
+
else:
|
|
243
|
+
with tarfile.open(fileobj=io.BytesIO(data), mode="r:gz") as tf:
|
|
244
|
+
for member in tf.getmembers():
|
|
245
|
+
if member.name.endswith(binary_name) or member.name == binary_name:
|
|
246
|
+
src = tf.extractfile(member)
|
|
247
|
+
if src is None:
|
|
248
|
+
continue
|
|
249
|
+
with src, open(binary_path, "wb") as dst:
|
|
250
|
+
dst.write(src.read())
|
|
251
|
+
binary_found = True
|
|
252
|
+
break
|
|
253
|
+
|
|
254
|
+
if not binary_found or not binary_path.exists():
|
|
255
|
+
raise RuntimeError(
|
|
256
|
+
f"Failed to extract binary '{binary_name}' from archive.\n"
|
|
257
|
+
f"Please install manually from:\n"
|
|
258
|
+
f"https://github.com/{GITHUB_REPO}/releases"
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
# Make executable (Unix only)
|
|
262
|
+
if os_name != "windows":
|
|
263
|
+
binary_path.chmod(binary_path.stat().st_mode | stat.S_IEXEC)
|
|
264
|
+
|
|
265
|
+
# Save the installed version
|
|
266
|
+
save_installed_version(version)
|
|
267
|
+
|
|
268
|
+
print(f" Cerebrium CLI v{version} installed successfully!\n")
|
|
269
|
+
return binary_path
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
def ensure_binary() -> Path:
|
|
273
|
+
"""Ensure the binary is installed, downloading if necessary."""
|
|
274
|
+
binary_path = get_binary_path()
|
|
275
|
+
installed_version = get_installed_version()
|
|
276
|
+
|
|
277
|
+
# Check if we need to download/update
|
|
278
|
+
if binary_path.exists() and installed_version == VERSION:
|
|
279
|
+
return binary_path
|
|
280
|
+
|
|
281
|
+
# Binary missing or version mismatch
|
|
282
|
+
if not binary_path.exists():
|
|
283
|
+
print("Cerebrium CLI binary not found. Installing...\n")
|
|
284
|
+
elif installed_version != VERSION:
|
|
285
|
+
print(f"Updating Cerebrium CLI from v{installed_version} to v{VERSION}...\n")
|
|
286
|
+
|
|
287
|
+
try:
|
|
288
|
+
return download_binary(VERSION)
|
|
289
|
+
except RuntimeError as e:
|
|
290
|
+
print(f"Error: {e}", file=sys.stderr)
|
|
291
|
+
sys.exit(1)
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
def main():
|
|
295
|
+
"""Execute the Go binary with the provided arguments."""
|
|
296
|
+
binary = ensure_binary()
|
|
297
|
+
|
|
298
|
+
# Pass through all arguments to the Go binary
|
|
299
|
+
try:
|
|
300
|
+
result = subprocess.run([str(binary)] + sys.argv[1:])
|
|
301
|
+
sys.exit(result.returncode)
|
|
302
|
+
except KeyboardInterrupt:
|
|
303
|
+
sys.exit(130)
|
|
304
|
+
except Exception as e:
|
|
305
|
+
print(f"Error executing Cerebrium CLI: {e}", file=sys.stderr)
|
|
306
|
+
sys.exit(1)
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
if __name__ == "__main__":
|
|
310
|
+
main()
|
cerebrium/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.39.6"
|
cerebrium/__main__.py
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
|
|
3
|
-
from cerebrium.main import cli
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
def main():
|
|
7
|
-
package_name = "cerebrium"
|
|
8
|
-
|
|
9
|
-
path_dirs = os.environ["PATH"].split(os.pathsep)
|
|
10
|
-
found = False
|
|
11
|
-
for dir in path_dirs:
|
|
12
|
-
if os.path.exists(os.path.join(dir, package_name)):
|
|
13
|
-
print(f"{package_name} found in PATH at {dir}")
|
|
14
|
-
found = True
|
|
15
|
-
break
|
|
16
|
-
if not found:
|
|
17
|
-
print(f"{package_name} not found in PATH.")
|
|
18
|
-
|
|
19
|
-
cli()
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if __name__ == "__main__":
|
|
23
|
-
main()
|