Skip to content

feat: add native pylock.toml support for container dependency resolution#5634

Open
TemidayoA wants to merge 2 commits into
bentoml:mainfrom
TemidayoA:feature/5466-pylock-toml-support
Open

feat: add native pylock.toml support for container dependency resolution#5634
TemidayoA wants to merge 2 commits into
bentoml:mainfrom
TemidayoA:feature/5466-pylock-toml-support

Conversation

@TemidayoA

Copy link
Copy Markdown

What does this PR address?

Fixes #5466

This PR introduces native support for pylock.toml in the Bento containerization build process, allowing users to strictly lock down and resolve Python dependencies using uv (bypassing current limitations with requirements.txt extra-index-urls).

Implementation Details:

  1. Configuration Schema (build_config.py): Added pylock_toml to the PythonOptions schema and implemented the file copy logic to stage the lockfile in the env/python/ build context.
  2. Container Generation (generate.py): Injected a _has_pylock boolean flag into the Jinja templating context by evaluating the existence of the staged lockfile.
  3. Dockerfile Templates (base.j2): Updated the base Dockerfile template to conditionally execute uv pip sync /home/bentoml/bento/env/python/pylock.toml when _has_pylock is true, safely falling back to the standard install.sh pipeline if no lockfile is present.

This ensures that deployments requiring complex or isolated package indexes can rely entirely on standard lockfiles during the Docker build step without breaking existing backwards compatibility.

@TemidayoA TemidayoA requested a review from a team as a code owner June 7, 2026 14:35
@TemidayoA TemidayoA requested review from bojiang and removed request for a team June 7, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature: support for pylock.toml

1 participant