Skip to content

Commit

Permalink
fix: add line endings for python_packages(...)
Browse files Browse the repository at this point in the history
Signed-off-by: Frost Ming <[email protected]>
  • Loading branch information
frostming committed Feb 7, 2025
1 parent cdbc29c commit 684730a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/_bentoml_sdk/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ def python_packages(self, *packages: str) -> t.Self:
.python_packages("numpy", "pandas")\
.requirements_file("requirements.txt")
"""
self.python_requirements += "\n".join(packages)
if not packages:
raise BentoMLConfigException("No packages provided")
self.python_requirements += "\n".join(packages) + "\n"
self._after_pip_install = True
return self

Expand All @@ -82,7 +84,14 @@ def run(self, command: str) -> t.Self:
return self

def run_script(self, script: str) -> t.Self:
"""Run a script in the image. Supports chaining call."""
"""Run a script in the image. Supports chaining call.
Example:
.. code-block:: python
image = Image("debian:latest").run_script("script.sh")
"""
commands = self.post_commands if self._after_pip_install else self.commands
script = Path(script).resolve().as_posix()
# Files under /env/docker will be copied into the env image layer
Expand Down

0 comments on commit 684730a

Please sign in to comment.