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 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/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( 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