Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
dynamo
Commits
f6b4da08
Unverified
Commit
f6b4da08
authored
Mar 05, 2026
by
jh-nv
Committed by
GitHub
Mar 05, 2026
Browse files
chore: mypy typing for python bindings (#6857)
parent
49fa25e2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
17 deletions
+36
-17
lib/bindings/python/src/dynamo/_core.pyi
lib/bindings/python/src/dynamo/_core.pyi
+30
-11
lib/bindings/python/src/dynamo/runtime/logging.py
lib/bindings/python/src/dynamo/runtime/logging.py
+6
-6
No files found.
lib/bindings/python/src/dynamo/_core.pyi
View file @
f6b4da08
...
...
@@ -13,8 +13,6 @@ from typing import (
Tuple,
)
from ._prometheus_names import prometheus_names
# Import from specialized modules
from .prometheus_metrics import RuntimeMetrics as PyRuntimeMetrics
...
...
@@ -1088,6 +1086,36 @@ def lora_name_to_id(lora_name: str) -> int:
"""Generate a deterministic integer ID from a LoRA name using blake3 hash."""
...
class LoRADownloader:
"""Unified interface for LoRA downloading and caching (local file:// and S3 s3:// URIs)."""
def __init__(self, cache_path: Optional[str] = None) -> None: ...
def download_if_needed(self, lora_uri: str) -> Awaitable[str]: ...
def get_cache_path(self, cache_key: str) -> str: ...
def is_cached(self, cache_key: str) -> bool: ...
def validate_cached(self, cache_key: str) -> bool: ...
@staticmethod
def uri_to_cache_key(uri: str) -> str: ...
class MediaDecoder:
"""Media decoder for image and video preprocessing."""
def __init__(self) -> None: ...
def enable_image(self, decoder_options: Dict[str, Any]) -> None: ...
class MediaFetcher:
"""Media fetcher for loading remote image/video URLs."""
def __init__(self) -> None: ...
def user_agent(self, user_agent: str) -> None: ...
def allow_direct_ip(self, allow: bool) -> None: ...
def allow_direct_port(self, allow: bool) -> None: ...
def allowed_media_domains(self, domains: List[str]) -> None: ...
def timeout_ms(self, timeout_ms: int) -> None: ...
async def fetch_model(remote_name: str, ignore_weights: bool = False) -> str:
"""
Download a model from Hugging Face, returning its local path.
...
...
@@ -1618,12 +1646,3 @@ class VirtualConnectorClient:
"""Blocks until there is a new decision to fetch using 'get'"""
...
__all__ = [
"Client",
"Context",
"KserveGrpcService",
"ModelDeploymentCard",
"PythonAsyncEngine",
"prometheus_names",
"ModelCardInstanceId",
]
lib/bindings/python/src/dynamo/runtime/logging.py
View file @
f6b4da08
...
...
@@ -28,7 +28,7 @@ class LogHandler(logging.Handler):
Custom logging handler that sends log messages to the Rust env_logger
"""
def
emit
(
self
,
record
)
:
def
emit
(
self
,
record
:
logging
.
LogRecord
)
->
None
:
"""
Emit a log record
"""
...
...
@@ -78,7 +78,7 @@ class VllmColorFormatter(logging.Formatter):
_DIM
=
"
\033
[2m"
_RESET
=
"
\033
[0m"
def
format
(
self
,
record
)
:
def
format
(
self
,
record
:
logging
.
LogRecord
)
->
str
:
ts
=
datetime
.
fromtimestamp
(
record
.
created
,
tz
=
timezone
.
utc
).
strftime
(
"%Y-%m-%dT%H:%M:%S.%fZ"
)
...
...
@@ -98,7 +98,7 @@ class VllmColorFormatter(logging.Formatter):
# Configure the Python logger to use the NimLogHandler
def
configure_logger
(
service_name
:
str
|
None
,
worker_id
:
int
|
None
):
def
configure_logger
(
service_name
:
str
|
None
,
worker_id
:
int
|
None
)
->
None
:
"""
Called once to configure the Python logger to use the LogHandler
"""
...
...
@@ -129,7 +129,7 @@ def construct_formatter_prefix(service_name: str | None, worker_id: int | None)
def
configure_dynamo_logging
(
service_name
:
str
|
None
=
None
,
worker_id
:
int
|
None
=
None
):
)
->
None
:
"""
A single place to configure logging for Dynamo.
"""
...
...
@@ -181,7 +181,7 @@ def log_level_mapping(level: str) -> int:
return
logging
.
INFO
def
configure_sglang_logging
(
dyn_level
:
int
):
def
configure_sglang_logging
(
dyn_level
:
int
)
->
None
:
"""
SGLang allows us to create a custom logging config file
"""
...
...
@@ -213,7 +213,7 @@ def configure_sglang_logging(dyn_level: int):
os
.
environ
[
"SGLANG_LOGGING_CONFIG_PATH"
]
=
f
.
name
def
configure_vllm_logging
(
dyn_level
:
int
):
def
configure_vllm_logging
(
dyn_level
:
int
)
->
None
:
"""
Configure vLLM logging for the main process and subprocesses.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment