-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathversion.py
More file actions
40 lines (27 loc) · 1002 Bytes
/
version.py
File metadata and controls
40 lines (27 loc) · 1002 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""Version utilities for flash-worker boot logging."""
import platform
from importlib.metadata import PackageNotFoundError, version
__version__ = "1.4.0" # x-release-please-version
def _get_version(package_name: str) -> str:
try:
return version(package_name)
except PackageNotFoundError:
return "unknown"
def get_worker_version() -> str:
return __version__
def get_flash_version() -> str:
"""Read bundled flash version, falling back to pip metadata."""
try:
from runpod_flash import __version__ as flash_ver
return str(flash_ver)
except (ImportError, AttributeError):
return _get_version("runpod-flash")
def get_runpod_version() -> str:
return _get_version("runpod")
def format_version_banner() -> str:
return (
f"Starting Flash Worker {get_worker_version()} | "
f"Python {platform.python_version()} | "
f"runpod-flash {get_flash_version()} | "
f"runpod {get_runpod_version()}"
)