Skip to content

Commit

Permalink
chore(type): use TypedDict for inferred stubs (#4577)
Browse files Browse the repository at this point in the history
chore(stub): use TypedDict

Signed-off-by: Aaron <[email protected]>
  • Loading branch information
aarnphm authored Mar 15, 2024
1 parent 573ba07 commit 100c1cc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/bentoml/_internal/bento/build_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,12 @@ class BentoBuildConfig:
# dict[str, t.Any] since our converter will handle the conversion.
# There is no way to tell type checker signatures of the converter from attrs
# if given attribute is alrady has a type annotation.
from typing_extensions import TypedDict

class EnvironmentEntry(TypedDict):
name: str
value: str

def __init__(
self,
service: str,
Expand All @@ -796,7 +802,7 @@ def __init__(
labels: dict[str, t.Any] | None = ...,
include: list[str] | None = ...,
exclude: list[str] | None = ...,
envs: list[dict[str, str]] | None = ...,
envs: list[EnvironmentEntry] | None = ...,
docker: DockerOptions | dict[str, t.Any] | None = ...,
python: PythonOptions | dict[str, t.Any] | None = ...,
conda: CondaOptions | dict[str, t.Any] | None = ...,
Expand Down

0 comments on commit 100c1cc

Please sign in to comment.