From 64a9b1da99a4e1c608c3f21be18252ddb9ff0bce Mon Sep 17 00:00:00 2001 From: Frost Ming Date: Tue, 10 Sep 2024 10:44:10 +0800 Subject: [PATCH 1/3] fix: dev version Signed-off-by: Frost Ming --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index bd028a41f04..be8776e3181 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -135,7 +135,6 @@ git_describe_command = [ "--long", "--first-parent", ] -version_scheme = "post-release" fallback_version = "0.0.0" [tool.hatch.metadata] allow-direct-references = true From f74d9ca714dd5e54da19bbcf2b1979b366408b5b Mon Sep 17 00:00:00 2001 From: Frost Ming Date: Tue, 10 Sep 2024 10:59:58 +0800 Subject: [PATCH 2/3] fix: on_deployment hook failed on serve_grpc Signed-off-by: Frost Ming --- src/bentoml/serving.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/bentoml/serving.py b/src/bentoml/serving.py index 260e6016391..891bf888c33 100644 --- a/src/bentoml/serving.py +++ b/src/bentoml/serving.py @@ -1,6 +1,5 @@ from __future__ import annotations -import asyncio import contextlib import json import logging @@ -683,8 +682,7 @@ def serve_grpc_production( close_child_stdin: bool = False if development_mode else True - loop = asyncio.get_event_loop() - loop.run_until_complete(on_service_deployment(svc)) + on_service_deployment(svc) with contextlib.ExitStack() as port_stack: api_port = port_stack.enter_context( From 416fd92810d7b1640ecfd6483ec419649d16564e Mon Sep 17 00:00:00 2001 From: Frost Ming Date: Tue, 10 Sep 2024 11:21:22 +0800 Subject: [PATCH 3/3] fix: clean bentoml version Signed-off-by: Frost Ming --- src/bentoml/_internal/bento/build_config.py | 2 +- src/bentoml/_internal/configuration/__init__.py | 6 +++--- src/bentoml/testing/pytest/plugin.py | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/bentoml/_internal/bento/build_config.py b/src/bentoml/_internal/bento/build_config.py index 9f6fa5864eb..791e93331b2 100644 --- a/src/bentoml/_internal/bento/build_config.py +++ b/src/bentoml/_internal/bento/build_config.py @@ -580,7 +580,7 @@ def write_to_bento( args.extend(pip_args) f.write( self._jinja_environment.get_template("install.sh.j2").render( - bentoml_version=clean_bentoml_version(BENTOML_VERSION), + bentoml_version=clean_bentoml_version(), pip_args=shlex.join(args), ) ) diff --git a/src/bentoml/_internal/configuration/__init__.py b/src/bentoml/_internal/configuration/__init__.py index 05d21c6719e..24083233c8f 100644 --- a/src/bentoml/_internal/configuration/__init__.py +++ b/src/bentoml/_internal/configuration/__init__.py @@ -56,10 +56,10 @@ def expand_env_var(env_var: str) -> str: env_var = interpolated -def clean_bentoml_version(bentoml_version: str) -> str: - post_version = ".".join(bentoml_version.split(".")[:3]) +@lru_cache(maxsize=1) +def clean_bentoml_version() -> str: try: - version = Version(post_version) + version = Version(BENTOML_VERSION).base_version return str(version) except ValueError: raise BentoMLException("Errors while parsing BentoML version.") from None diff --git a/src/bentoml/testing/pytest/plugin.py b/src/bentoml/testing/pytest/plugin.py index 232a14e0f26..18604034bbb 100644 --- a/src/bentoml/testing/pytest/plugin.py +++ b/src/bentoml/testing/pytest/plugin.py @@ -12,7 +12,6 @@ from pytest import MonkeyPatch import bentoml -from bentoml._internal.configuration import BENTOML_VERSION from bentoml._internal.configuration import clean_bentoml_version from bentoml._internal.configuration.containers import BentoMLContainer from bentoml._internal.models import ModelContext @@ -46,7 +45,7 @@ @pytest.mark.tryfirst def pytest_report_header(config: Config) -> list[str]: - return [f"bentoml: version={clean_bentoml_version(BENTOML_VERSION)}"] + return [f"bentoml: version={clean_bentoml_version()}"] @pytest.hookimpl