|
7 | 7 | import logging
|
8 | 8 | import typing as t
|
9 | 9 |
|
| 10 | +import attr |
10 | 11 | from simple_di import Provide
|
11 | 12 | from simple_di import inject
|
12 | 13 |
|
|
25 | 26 | from _bentoml_sdk import Service as NewService
|
26 | 27 |
|
27 | 28 | from ._internal.bento import BentoStore
|
| 29 | + from ._internal.bento.build_config import BentoEnvSchema |
28 | 30 | from ._internal.bento.build_config import CondaOptions
|
29 | 31 | from ._internal.bento.build_config import DockerOptions
|
30 |
| - from ._internal.bento.build_config import EnvironmentEntry |
31 | 32 | from ._internal.bento.build_config import ModelSpec
|
32 | 33 | from ._internal.bento.build_config import PythonOptions
|
33 | 34 | from ._internal.cloud import BentoCloudClient
|
@@ -279,7 +280,7 @@ def build(
|
279 | 280 | description: str | None = None,
|
280 | 281 | include: t.List[str] | None = None,
|
281 | 282 | exclude: t.List[str] | None = None,
|
282 |
| - envs: t.List[EnvironmentEntry] | None = None, |
| 283 | + envs: t.List[BentoEnvSchema] | None = None, |
283 | 284 | docker: DockerOptions | dict[str, t.Any] | None = None,
|
284 | 285 | python: PythonOptions | dict[str, t.Any] | None = None,
|
285 | 286 | conda: CondaOptions | dict[str, t.Any] | None = None,
|
@@ -378,6 +379,7 @@ def build_bentofile(
|
378 | 379 | bentofile: str | None = None,
|
379 | 380 | *,
|
380 | 381 | service: str | None = None,
|
| 382 | + name: str | None = None, |
381 | 383 | version: str | None = None,
|
382 | 384 | labels: dict[str, str] | None = None,
|
383 | 385 | build_ctx: str | None = None,
|
@@ -421,10 +423,14 @@ def build_bentofile(
|
421 | 423 | else:
|
422 | 424 | build_config = BentoBuildConfig(service=service or "")
|
423 | 425 |
|
| 426 | + new_attrs = {} |
| 427 | + if name is not None: |
| 428 | + new_attrs["name"] = name |
424 | 429 | if labels:
|
425 |
| - if not build_config.labels: |
426 |
| - object.__setattr__(build_config, "labels", labels) |
427 |
| - build_config.labels.update(labels) |
| 430 | + new_attrs["labels"] = {**(build_config.labels or {}), **labels} |
| 431 | + |
| 432 | + if new_attrs: |
| 433 | + build_config = attr.evolve(build_config, **new_attrs) |
428 | 434 |
|
429 | 435 | bento = Bento.create(
|
430 | 436 | build_config=build_config,
|
|
0 commit comments