-
Notifications
You must be signed in to change notification settings - Fork 110
Open
Description
Problem Description
During PR #2145 migration from requirements.txt to pylock.toml across multiple notebooks and runtimes, all Dockerfiles currently use:
uv pip install --strict --no-deps --no-cache --no-config --no-progress --verify-hashes --compile-bytecode --index-strategy=unsafe-best-match --requirements=./pylock.toml
This approach has several suboptimal characteristics when working with lock files:
- Drift Risk:
uv pip install
allows additional packages beyond those in the lock file - Redundant Flags:
--no-deps
is unnecessary when installing from a complete lock file - Inexact Environment: Does not enforce the exact locked environment state
Current State Analysis
Affected Files (34+ Dockerfiles migrated in PR #2145):
jupyter/minimal/ubi9-python-3.12/Dockerfile.cpu
jupyter/minimal/ubi9-python-3.12/Dockerfile.cuda
jupyter/minimal/ubi9-python-3.12/Dockerfile.rocm
jupyter/datascience/ubi9-python-3.12/Dockerfile.cpu
jupyter/pytorch+llmcompressor/ubi9-python-3.12/Dockerfile.cuda
jupyter/pytorch/ubi9-python-3.12/Dockerfile.cuda
jupyter/rocm/pytorch/ubi9-python-3.12/Dockerfile.rocm
jupyter/rocm/tensorflow/ubi9-python-3.12/Dockerfile.rocm
jupyter/tensorflow/ubi9-python-3.12/Dockerfile.cuda
jupyter/trustyai/ubi9-python-3.12/Dockerfile.cpu
codeserver/ubi9-python-3.12/Dockerfile.cpu
rstudio/c9s-python-3.11/Dockerfile.cpu
rstudio/c9s-python-3.11/Dockerfile.cuda
rstudio/rhel9-python-3.11/Dockerfile.cpu
rstudio/rhel9-python-3.11/Dockerfile.cuda
runtimes/datascience/ubi9-python-3.12/Dockerfile.cpu
runtimes/minimal/ubi9-python-3.12/Dockerfile.cpu
runtimes/pytorch+llmcompressor/ubi9-python-3.12/Dockerfile.cuda
runtimes/pytorch/ubi9-python-3.12/Dockerfile.cuda
runtimes/rocm-pytorch/ubi9-python-3.12/Dockerfile.rocm
runtimes/rocm-tensorflow/ubi9-python-3.12/Dockerfile.rocm
runtimes/tensorflow/ubi9-python-3.12/Dockerfile.cuda
Solution
Replace uv pip install --requirements=
with uv pip sync
for exact lock file enforcement:
- uv pip install --strict --no-deps --no-cache --no-config --no-progress --verify-hashes --compile-bytecode --index-strategy=unsafe-best-match --requirements=./pylock.toml
+ uv pip sync --strict --no-cache --no-config --no-progress --verify-hashes --compile-bytecode --index-strategy=unsafe-best-match ./pylock.toml
Benefits of uv pip sync:
- Exact Environment: Installs precisely what's in the lock file, no more, no less
- Drift Prevention: Removes any packages not specified in the lock file
- Cleaner Syntax: No need for
--no-deps
or--requirements
flags - Lock File Semantics: Designed specifically for lock file consumption
Acceptance Criteria
- All 34+ Dockerfiles from PR RHAIENG-304: add uv pyproject.tomls for multiple notebooks and runtimes across Jupyter, RStudio, and VSCode #2145 updated to use
uv pip sync
instead ofuv pip install --requirements=
- Remove
--no-deps
and--requirements=
flags (unnecessary with sync) - Retain all other flags (
--strict
,--no-cache
,--no-config
,--no-progress
,--verify-hashes
,--compile-bytecode
,--index-strategy=unsafe-best-match
) - Verify no remaining
requirements.txt
references in affected files - Test build success for representative samples (CPU, CUDA, ROCm variants)
- Confirm exact dependency installation behavior matches expectations
Context
- PR: RHAIENG-304: add uv pyproject.tomls for multiple notebooks and runtimes across Jupyter, RStudio, and VSCode #2145 (pylock.toml migration)
- Review Comment: RHAIENG-304: add uv pyproject.tomls for multiple notebooks and runtimes across Jupyter, RStudio, and VSCode #2145 (comment)
- Identified During: CodeRabbit review of
jupyter/minimal/ubi9-python-3.12/Dockerfile.cpu
Implementation Notes
This optimization should be applied systematically across all Dockerfiles migrated in PR #2145. Consider creating a script to automate the replacement pattern for consistency.
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
📋 Backlog