-
Notifications
You must be signed in to change notification settings - Fork 113
RHAIENG-304: tests(pytests): add check for the pylock.toml integrity with respect to pyproject.toml #2233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…with respect to pyproject.toml
Skipping CI for Draft Pull Request. |
WalkthroughUpdates tests in tests/test_main.py to parse pyproject.toml and pylock.toml, build an index of locked packages, and cross-validate declared dependencies against locked versions using packaging.requirements. Adds subtests, additional assertions, and minor typing aids. Switches tomllib.load to tomllib.loads with read_text(). Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@coderabbitai full review |
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (1)
tests/test_main.py (1)
32-41
: Prefer binary load and spec-based version check for robustness.
- Use tomllib.load(...) to avoid locale-dependent decoding; or specify encoding explicitly.
- Compare Python version via SpecifierSet rather than string equality.
Apply this diff:
- pyproject = tomllib.loads(file.read_text()) + pyproject = tomllib.load(file.open("rb")) @@ - assert pyproject["project"]["requires-python"] == f"=={python}.*", ( - "pyproject.toml does not declare the expected Python version" - ) + # Accepts '=={python}.*' or any spec matching that interpreter (e.g., '>=3.12,<3.13') + assert SpecifierSet(pyproject["project"]["requires-python"]).contains(f"{python}.0"), ( + f"pyproject.toml does not declare a spec compatible with Python {python}" + )
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
tests/test_main.py
(2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: jiridanek
PR: opendatahub-io/notebooks#0
File: :0-0
Timestamp: 2025-08-27T18:58:27.554Z
Learning: jiridanek requested GitHub issue creation for comment pattern standardization during PR #2145 review, identifying inconsistent references to pylock.toml vs requirements.txt and mixed terminology across migrated Dockerfiles. Issue was created with comprehensive repository-wide audit strategy, standardized comment templates, implementation phases, and clear acceptance criteria for consistent comment patterns across all pylock.toml usage, continuing the established pattern of systematic code quality improvements through detailed issue tracking.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#1325
File: jupyter/pytorch/ubi9-python-3.12/Pipfile:42-42
Timestamp: 2025-07-09T14:22:14.553Z
Learning: jiridanek requested GitHub issue creation for Pipfile.lock verification script implementation during PR #1325 review, specifically to systematize the manual verification process for dependency version consistency across all lock files using jq. Issue #1367 was created with comprehensive problem description covering manual verification challenges, detailed solution with jq-based verification script, enhanced features for CI integration, clear acceptance criteria, implementation areas breakdown, benefits analysis, and proper context linking, continuing the established pattern of systematic code quality improvements through detailed issue tracking.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#1259
File: jupyter/rocm/tensorflow/ubi9-python-3.12/kustomize/base/service.yaml:5-15
Timestamp: 2025-07-02T18:59:15.788Z
Learning: jiridanek creates targeted GitHub issues for specific test quality improvements identified during PR reviews in opendatahub-io/notebooks. Issue #1268 demonstrates this by converting a review comment about insufficient tf2onnx conversion test validation into a comprehensive improvement plan with clear acceptance criteria, code examples, and ROCm-specific context.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#0
File: :0-0
Timestamp: 2025-08-27T18:58:27.554Z
Learning: jiridanek requested GitHub issue creation for comment pattern standardization during PR #2145 review, identifying inconsistent references to pylock.toml vs requirements.txt and mixed terminology across migrated Dockerfiles. Issue #2165 was created with comprehensive repository-wide audit strategy, standardized comment templates, implementation phases, and clear acceptance criteria for consistent comment patterns across all pylock.toml usage, continuing the established pattern of systematic code quality improvements through detailed issue tracking.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#0
File: :0-0
Timestamp: 2025-08-27T18:58:27.554Z
Learning: jiridanek requested GitHub issue creation for comment pattern standardization during PR #2145 review, identifying inconsistent references to pylock.toml vs requirements.txt and mixed terminology across migrated Dockerfiles. Issue #2165 was created with comprehensive repository-wide audit strategy, standardized comment templates, implementation phases, and clear acceptance criteria for consistent comment patterns across all pylock.toml usage, continuing the established pattern of systematic code quality improvements through detailed issue tracking.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#0
File: :0-0
Timestamp: 2025-07-11T11:16:05.131Z
Learning: jiridanek requested GitHub issue creation for RStudio py311 Tekton push pipelines during PR #1379 review. Issue #1384 was successfully created covering two RStudio variants (CPU and CUDA) found in manifests/base/params-latest.env, with comprehensive problem description, implementation requirements following the same pattern as other workbench pipelines, clear acceptance criteria, and proper context linking, continuing the established pattern of systematic code quality improvements through detailed issue tracking.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#2145
File: runtimes/tensorflow/ubi9-python-3.12/Dockerfile.cuda:161-167
Timestamp: 2025-08-27T15:35:10.919Z
Learning: jiridanek requested GitHub issue creation for --no-deps flag assessment with pylock.toml lockfiles during PR #2145 review. Issue #2159 was created addressing the systematic usage of --no-deps flag across 22 Dockerfiles migrated to pylock.toml format. The issue includes comprehensive risk assessment framework covering uv behavior analysis, roadmap research, multiple solution options with pros/cons, clear acceptance criteria for informed decision making, detailed scope analysis covering all affected files, and proper context linking to PR #2145 review comment, assigned to jiridanek.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#1995
File: jupyter/rocm/tensorflow/ubi9-python-3.11/Dockerfile.rocm:0-0
Timestamp: 2025-08-19T06:31:05.424Z
Learning: jiridanek requested GitHub issue creation for ROCm device detection test during PR #1995 review. The issue covers comprehensive test requirements for validating that device_lib.list_local_devices() successfully detects ROCm/HIP devices after ROCm package optimizations, including multiple solution options (pytest, shell script, notebook-based), detailed acceptance criteria for core requirements and test coverage, implementation guidance for test framework selection and CI integration, example test code for TensorFlow device detection validation, and proper context linking to PR #1995 and review comment, continuing the established pattern of systematic code quality improvements through detailed issue tracking.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#1972
File: runtimes/pytorch+llmcompressor/ubi9-python-3.12/Pipfile:44-45
Timestamp: 2025-08-18T12:37:25.956Z
Learning: jiridanek requested GitHub issue creation for comprehensive functionality testing of all packages in the LLMCompressor Pipfile during PR #1972 review. Issue #1984 was created with detailed testing framework covering 30+ packages across 8 categories (PyTorch, LLMCompressor, data science, cloud storage, model conversion, database connectors, messaging, conflict resolution), 3-phase implementation plan, comprehensive acceptance criteria for CI/CD integration, and specific code examples for each testing domain, continuing the established pattern of systematic code quality improvements through detailed issue tracking.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#1333
File: runtimes/rocm-pytorch/ubi9-python-3.12/Pipfile:42-48
Timestamp: 2025-07-09T08:07:29.331Z
Learning: jiridanek requested GitHub issue creation for MarkupSafe package name casing inconsistency during PR #1333 review. Issue #1355 was created with comprehensive problem description covering duplicate lock entries and reproducible build concerns, affected files analysis, clear solution with code examples, detailed acceptance criteria, implementation guidance with specific commands, and proper context linking, continuing the established pattern of systematic code quality improvements through detailed issue tracking.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#2185
File: jupyter/pytorch/ubi9-python-3.12/Dockerfile.cuda:109-117
Timestamp: 2025-08-29T08:48:55.985Z
Learning: jiridanek prefers to implement systematic cleanup improvements through dedicated GitHub issues (like #2076) rather than applying individual point fixes during PR reviews, maintaining consistency with their established pattern of comprehensive code quality improvements.
🔇 Additional comments (2)
tests/test_main.py (2)
16-17
: LGTM: typing import under TYPE_CHECKING.Appropriate with postponed annotations; no runtime import cost.
42-44
: LGTM: dependency section presence check.Good guard to fail fast when dependencies are missing.
import packaging.requirements | ||
import pytest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Canonicalize names and import directly to avoid false negatives.
Lock/package name casing and hyphen/underscore differences can cause mismatches (e.g., MarkupSafe vs markupsafe). Canonicalize both sides and switch to direct imports to simplify call sites.
Apply this diff:
-import packaging.requirements
+from packaging.requirements import Requirement
+from packaging.specifiers import SpecifierSet
+from packaging.utils import canonicalize_name
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
import packaging.requirements | |
import pytest | |
from packaging.requirements import Requirement | |
from packaging.specifiers import SpecifierSet | |
from packaging.utils import canonicalize_name | |
import pytest |
🤖 Prompt for AI Agents
In tests/test_main.py around lines 10-11, the test currently imports
packaging.requirements and risks false negatives due to name casing/hyphen vs
underscore differences; replace that import with a direct import of the
utilities and use canonicalize_name to compare package names: import
canonicalize_name from packaging.utils (and use importlib.import_module to
import the target package/module directly), then compare
canonicalize_name(lock_name) to canonicalize_name(imported_module.__name__) (or
package metadata) so names are normalized before assertion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'll consider this for subsequent pr, thanks; will be checking if imagestream yamls also correspond to the lock file, it will be useful there, both SpecifierSet and canonicalize_name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jiridanek, understood! That makes perfect sense to defer this for a subsequent PR, especially since you'll be extending the validation to imagestream yamls as well. The canonicalize_name and SpecifierSet utilities will indeed be very helpful for ensuring consistent package name matching across different file formats and naming conventions.
✏️ Learnings added
Learnt from: jiridanek
PR: opendatahub-io/notebooks#2233
File: tests/test_main.py:10-11
Timestamp: 2025-09-02T07:57:23.155Z
Learning: jiridanek plans to extend pylock.toml validation to check correspondence with imagestream yamls in a future PR, and noted that packaging.utils.canonicalize_name and packaging.specifiers.SpecifierSet will be useful for that work to handle name casing and specifier differences.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
🧠 Learnings used
Learnt from: jiridanek
PR: opendatahub-io/notebooks#1333
File: runtimes/rocm-pytorch/ubi9-python-3.12/Pipfile:42-48
Timestamp: 2025-07-09T08:07:29.331Z
Learning: jiridanek requested GitHub issue creation for MarkupSafe package name casing inconsistency during PR #1333 review. Issue #1355 was created with comprehensive problem description covering duplicate lock entries and reproducible build concerns, affected files analysis, clear solution with code examples, detailed acceptance criteria, implementation guidance with specific commands, and proper context linking, continuing the established pattern of systematic code quality improvements through detailed issue tracking.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#1269
File: codeserver/ubi9-python-3.12/kustomize/base/pod.yaml:11-11
Timestamp: 2025-07-03T16:17:17.301Z
Learning: jiridanek requested GitHub issue creation for renaming placeholder image reference in codeserver/ubi9-python-3.12/kustomize/base/pod.yaml during PR #1269 review to improve code self-documentation. Issue #1313 was created with comprehensive problem description, multiple implementation options (UPPERCASE_WITH_UNDERSCORES, lowercase-with-dashes, environment variable style), acceptance criteria, and proper context linking, continuing the established pattern of systematic code quality improvements through detailed issue tracking.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#0
File: :0-0
Timestamp: 2025-08-27T18:58:27.554Z
Learning: jiridanek requested GitHub issue creation for comment pattern standardization during PR #2145 review, identifying inconsistent references to pylock.toml vs requirements.txt and mixed terminology across migrated Dockerfiles. Issue was created with comprehensive repository-wide audit strategy, standardized comment templates, implementation phases, and clear acceptance criteria for consistent comment patterns across all pylock.toml usage, continuing the established pattern of systematic code quality improvements through detailed issue tracking.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#1306
File: jupyter/trustyai/ubi9-python-3.12/kustomize/base/kustomization.yaml:8-12
Timestamp: 2025-07-08T19:09:48.746Z
Learning: jiridanek requested GitHub issue creation for misleading CUDA prefix in TrustyAI image tags during PR #1306 review, affecting both Python 3.11 and 3.12 versions. Issue #1338 was created with comprehensive problem description covering both affected images, repository pattern analysis comparing correct vs incorrect naming conventions, clear solution with code examples, detailed acceptance criteria, and proper context linking, continuing the established pattern of systematic code quality improvements through detailed issue tracking.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#2233
File: tests/test_main.py:46-56
Timestamp: 2025-09-02T07:55:31.800Z
Learning: jiridanek deferred a suggestion for enhanced pyproject.toml/pylock.toml validation in PR #2233 tests/test_main.py. The current test implementation works fine, but future enhancements may need: name normalization using canonicalize_name() to handle case/separator mismatches, environment markers evaluation to skip dependencies not applicable to the image's Python/OS, and handling non-PEP440 versions from VCS/URL dependencies by checking if locked_version exists before asserting specifier.contains(). The deferred implementation includes evaluating markers against image environment (_env = {"python_version": python, "sys_platform": "linux", "platform_system": "Linux"}) and using tomllib.load() with binary mode for consistency.
Learnt from: atheo89
PR: opendatahub-io/notebooks#1972
File: manifests/overlays/additional/runtime-pytorch-llmcompressor-cuda-py312-ubi9-imagestream.yaml:33-36
Timestamp: 2025-08-14T11:43:47.431Z
Learning: atheo89 confirmed that n_PLACEHOLDER pattern in imagestream YAML files is the standard approach used consistently across the opendatahub-io/notebooks project, with 34+ files using this same placeholder convention for from.name references, and changes to this pattern should maintain seamless consistency with existing project structure.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#2185
File: jupyter/pytorch/ubi9-python-3.12/Dockerfile.cuda:109-117
Timestamp: 2025-08-29T08:48:55.985Z
Learning: jiridanek prefers to implement systematic cleanup improvements through dedicated GitHub issues (like #2076) rather than applying individual point fixes during PR reviews, maintaining consistency with their established pattern of comprehensive code quality improvements.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#1325
File: jupyter/pytorch/ubi9-python-3.12/Pipfile:42-42
Timestamp: 2025-07-09T14:22:14.553Z
Learning: jiridanek requested GitHub issue creation for Pipfile.lock verification script implementation during PR #1325 review, specifically to systematize the manual verification process for dependency version consistency across all lock files using jq. Issue #1367 was created with comprehensive problem description covering manual verification challenges, detailed solution with jq-based verification script, enhanced features for CI integration, clear acceptance criteria, implementation areas breakdown, benefits analysis, and proper context linking, continuing the established pattern of systematic code quality improvements through detailed issue tracking.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#1259
File: jupyter/rocm/tensorflow/ubi9-python-3.12/kustomize/base/service.yaml:5-15
Timestamp: 2025-07-02T18:59:15.788Z
Learning: jiridanek creates targeted GitHub issues for specific test quality improvements identified during PR reviews in opendatahub-io/notebooks. Issue #1268 demonstrates this by converting a review comment about insufficient tf2onnx conversion test validation into a comprehensive improvement plan with clear acceptance criteria, code examples, and ROCm-specific context.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#0
File: :0-0
Timestamp: 2025-08-27T18:58:27.554Z
Learning: jiridanek requested GitHub issue creation for comment pattern standardization during PR #2145 review, identifying inconsistent references to pylock.toml vs requirements.txt and mixed terminology across migrated Dockerfiles. Issue #2165 was created with comprehensive repository-wide audit strategy, standardized comment templates, implementation phases, and clear acceptance criteria for consistent comment patterns across all pylock.toml usage, continuing the established pattern of systematic code quality improvements through detailed issue tracking.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#0
File: :0-0
Timestamp: 2025-08-27T18:58:27.554Z
Learning: jiridanek requested GitHub issue creation for comment pattern standardization during PR #2145 review, identifying inconsistent references to pylock.toml vs requirements.txt and mixed terminology across migrated Dockerfiles. Issue #2165 was created with comprehensive repository-wide audit strategy, standardized comment templates, implementation phases, and clear acceptance criteria for consistent comment patterns across all pylock.toml usage, continuing the established pattern of systematic code quality improvements through detailed issue tracking.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#0
File: :0-0
Timestamp: 2025-07-11T11:16:05.131Z
Learning: jiridanek requested GitHub issue creation for RStudio py311 Tekton push pipelines during PR #1379 review. Issue #1384 was successfully created covering two RStudio variants (CPU and CUDA) found in manifests/base/params-latest.env, with comprehensive problem description, implementation requirements following the same pattern as other workbench pipelines, clear acceptance criteria, and proper context linking, continuing the established pattern of systematic code quality improvements through detailed issue tracking.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#2145
File: runtimes/tensorflow/ubi9-python-3.12/Dockerfile.cuda:161-167
Timestamp: 2025-08-27T15:35:10.919Z
Learning: jiridanek requested GitHub issue creation for --no-deps flag assessment with pylock.toml lockfiles during PR #2145 review. Issue #2159 was created addressing the systematic usage of --no-deps flag across 22 Dockerfiles migrated to pylock.toml format. The issue includes comprehensive risk assessment framework covering uv behavior analysis, roadmap research, multiple solution options with pros/cons, clear acceptance criteria for informed decision making, detailed scope analysis covering all affected files, and proper context linking to PR #2145 review comment, assigned to jiridanek.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#1995
File: jupyter/rocm/tensorflow/ubi9-python-3.11/Dockerfile.rocm:0-0
Timestamp: 2025-08-19T06:31:05.424Z
Learning: jiridanek requested GitHub issue creation for ROCm device detection test during PR #1995 review. The issue covers comprehensive test requirements for validating that device_lib.list_local_devices() successfully detects ROCm/HIP devices after ROCm package optimizations, including multiple solution options (pytest, shell script, notebook-based), detailed acceptance criteria for core requirements and test coverage, implementation guidance for test framework selection and CI integration, example test code for TensorFlow device detection validation, and proper context linking to PR #1995 and review comment, continuing the established pattern of systematic code quality improvements through detailed issue tracking.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#1972
File: runtimes/pytorch+llmcompressor/ubi9-python-3.12/Pipfile:44-45
Timestamp: 2025-08-18T12:37:25.956Z
Learning: jiridanek requested GitHub issue creation for comprehensive functionality testing of all packages in the LLMCompressor Pipfile during PR #1972 review. Issue #1984 was created with detailed testing framework covering 30+ packages across 8 categories (PyTorch, LLMCompressor, data science, cloud storage, model conversion, database connectors, messaging, conflict resolution), 3-phase implementation plan, comprehensive acceptance criteria for CI/CD integration, and specific code examples for each testing domain, continuing the established pattern of systematic code quality improvements through detailed issue tracking.
pylock = tomllib.loads(file.with_name("pylock.toml").read_text()) | ||
pylock_packages: dict[str, dict[str, Any]] = {p["name"]: p for p in pylock["packages"]} | ||
with subtests.test(msg="checking pylock.toml consistency with pyproject.toml", pyproject=file): | ||
for d in pyproject["project"]["dependencies"]: | ||
requirement = packaging.requirements.Requirement(d) | ||
|
||
assert requirement.name in pylock_packages, f"Dependency {d} is not in pylock.toml" | ||
version = pylock_packages[requirement.name]["version"] | ||
assert requirement.specifier.contains(version), ( | ||
f"Version of {d} in pyproject.toml does not match {version=} in pylock.toml" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Handle name normalization, markers, and non-PEP440 (VCS/URL) locks.
- Normalize names to avoid case/sep mismatches.
- Respect environment markers so we don’t require lock entries for deps that don’t apply to the image’s Python/OS.
- Some locked entries may not have a PEP 440 version (e.g., VCS/URL); gate the specifier check accordingly.
Apply this diff:
- pylock = tomllib.loads(file.with_name("pylock.toml").read_text())
- pylock_packages: dict[str, dict[str, Any]] = {p["name"]: p for p in pylock["packages"]}
+ pylock = tomllib.load(file.with_name("pylock.toml").open("rb"))
+ assert "packages" in pylock, "pylock.toml missing [packages] list"
+ pylock_packages: dict[str, dict[str, Any]] = {
+ canonicalize_name(p["name"]): p for p in pylock["packages"]
+ }
with subtests.test(msg="checking pylock.toml consistency with pyproject.toml", pyproject=file):
- for d in pyproject["project"]["dependencies"]:
- requirement = packaging.requirements.Requirement(d)
-
- assert requirement.name in pylock_packages, f"Dependency {d} is not in pylock.toml"
- version = pylock_packages[requirement.name]["version"]
- assert requirement.specifier.contains(version), (
- f"Version of {d} in pyproject.toml does not match {version=} in pylock.toml"
- )
+ # Evaluate markers against the image environment (Linux) and parsed Python version.
+ _env = {"python_version": python, "sys_platform": "linux", "platform_system": "Linux"}
+ for d in pyproject["project"]["dependencies"]:
+ requirement = Requirement(d)
+ if requirement.marker and not requirement.marker.evaluate(_env):
+ continue # not applicable to this image
+ name = canonicalize_name(requirement.name)
+ assert name in pylock_packages, f"Dependency {d} is not in pylock.toml"
+ locked = pylock_packages[name]
+ locked_version = locked.get("version")
+ # Only assert specifier if we have a PEP 440 version (skip VCS/URL-only pins)
+ if locked_version is not None:
+ assert requirement.specifier.contains(locked_version), (
+ f"{d} does not satisfy locked version {locked_version} in pylock.toml"
+ )
Committable suggestion skipped: line range outside the PR's diff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this does not seem to be necessary for now, the test is passing just fine
@coderabbitai please remember this suggestion for later, if I ever encounter problems with the current code and may need to implement it this way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jiridanek, understood! I've noted that the current implementation is working well for your use case. I'll remember the suggestion for future reference in case you encounter edge cases that require the more robust handling.
✏️ Learnings added
Learnt from: jiridanek
PR: opendatahub-io/notebooks#2233
File: tests/test_main.py:46-56
Timestamp: 2025-09-02T07:55:31.800Z
Learning: jiridanek deferred a suggestion for enhanced pyproject.toml/pylock.toml validation in PR #2233 tests/test_main.py. The current test implementation works fine, but future enhancements may need: name normalization using canonicalize_name() to handle case/separator mismatches, environment markers evaluation to skip dependencies not applicable to the image's Python/OS, and handling non-PEP440 versions from VCS/URL dependencies by checking if locked_version exists before asserting specifier.contains(). The deferred implementation includes evaluating markers against image environment (_env = {"python_version": python, "sys_platform": "linux", "platform_system": "Linux"}) and using tomllib.load() with binary mode for consistency.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
🧠 Learnings used
Learnt from: jiridanek
PR: opendatahub-io/notebooks#0
File: :0-0
Timestamp: 2025-08-27T18:58:27.554Z
Learning: jiridanek requested GitHub issue creation for comment pattern standardization during PR #2145 review, identifying inconsistent references to pylock.toml vs requirements.txt and mixed terminology across migrated Dockerfiles. Issue was created with comprehensive repository-wide audit strategy, standardized comment templates, implementation phases, and clear acceptance criteria for consistent comment patterns across all pylock.toml usage, continuing the established pattern of systematic code quality improvements through detailed issue tracking.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#1333
File: runtimes/rocm-pytorch/ubi9-python-3.12/Pipfile:42-48
Timestamp: 2025-07-09T08:07:29.331Z
Learning: jiridanek requested GitHub issue creation for MarkupSafe package name casing inconsistency during PR #1333 review. Issue #1355 was created with comprehensive problem description covering duplicate lock entries and reproducible build concerns, affected files analysis, clear solution with code examples, detailed acceptance criteria, implementation guidance with specific commands, and proper context linking, continuing the established pattern of systematic code quality improvements through detailed issue tracking.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#0
File: :0-0
Timestamp: 2025-08-27T18:58:27.554Z
Learning: jiridanek requested GitHub issue creation for comment pattern standardization during PR #2145 review, identifying inconsistent references to pylock.toml vs requirements.txt and mixed terminology across migrated Dockerfiles. Issue #2165 was created with comprehensive repository-wide audit strategy, standardized comment templates, implementation phases, and clear acceptance criteria for consistent comment patterns across all pylock.toml usage, continuing the established pattern of systematic code quality improvements through detailed issue tracking.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#0
File: :0-0
Timestamp: 2025-08-27T18:58:27.554Z
Learning: jiridanek requested GitHub issue creation for comment pattern standardization during PR #2145 review, identifying inconsistent references to pylock.toml vs requirements.txt and mixed terminology across migrated Dockerfiles. Issue #2165 was created with comprehensive repository-wide audit strategy, standardized comment templates, implementation phases, and clear acceptance criteria for consistent comment patterns across all pylock.toml usage, continuing the established pattern of systematic code quality improvements through detailed issue tracking.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#2145
File: runtimes/tensorflow/ubi9-python-3.12/Dockerfile.cuda:161-167
Timestamp: 2025-08-27T15:35:10.919Z
Learning: jiridanek requested GitHub issue creation for --no-deps flag assessment with pylock.toml lockfiles during PR #2145 review. Issue #2159 was created addressing the systematic usage of --no-deps flag across 22 Dockerfiles migrated to pylock.toml format. The issue includes comprehensive risk assessment framework covering uv behavior analysis, roadmap research, multiple solution options with pros/cons, clear acceptance criteria for informed decision making, detailed scope analysis covering all affected files, and proper context linking to PR #2145 review comment, assigned to jiridanek.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#1998
File: runtimes/pytorch+llmcompressor/ubi9-python-3.11/Dockerfile.cuda:159-161
Timestamp: 2025-08-19T11:45:12.501Z
Learning: jiridanek requested GitHub issue creation for duplicated micropipenv installation cleanup in pytorch+llmcompressor images during PR #1998 review. Issue addresses redundant installations occurring twice in both affected Dockerfiles: early unpinned install for Pipfile.lock deployment and later pinned install in requirements.txt block. Solution involves removing duplicate installations while maintaining version pinning (1.9.0) and ensuring micropipenv install --dev functionality remains intact. Issue includes comprehensive problem analysis, multiple solution options, detailed acceptance criteria covering build testing and deduplication verification, and proper context linking to PR #1998 review comment.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#2145
File: jupyter/trustyai/ubi9-python-3.12/Dockerfile.cpu:134-140
Timestamp: 2025-08-27T15:05:31.656Z
Learning: jiridanek requested GitHub issue creation for CUDA wheel optimization in TrustyAI CPU image during PR #2145 review. The CPU Dockerfile currently uses pylock.toml with CUDA-enabled PyTorch wheels (torch==2.6.0+cu126) which was previously discussed with harshad16 and grdryn but deferred. Issue created with comprehensive problem analysis covering unnecessary CUDA wheels in CPU-only image, multiple solution options including lock regeneration and separate CPU/CUDA files, clear acceptance criteria for wheel optimization verification, and proper context linking to PR #2145 review comment.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#1325
File: jupyter/pytorch/ubi9-python-3.12/Pipfile:42-42
Timestamp: 2025-07-09T14:22:14.553Z
Learning: jiridanek requested GitHub issue creation for Pipfile.lock verification script implementation during PR #1325 review, specifically to systematize the manual verification process for dependency version consistency across all lock files using jq. Issue #1367 was created with comprehensive problem description covering manual verification challenges, detailed solution with jq-based verification script, enhanced features for CI integration, clear acceptance criteria, implementation areas breakdown, benefits analysis, and proper context linking, continuing the established pattern of systematic code quality improvements through detailed issue tracking.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#1396
File: runtimes/tensorflow/ubi9-python-3.12/Dockerfile.cuda:124-127
Timestamp: 2025-07-21T15:06:04.114Z
Learning: jiridanek requested GitHub issue creation for multi-platform dependency locking investigation during PR #1396 review. Issue #1423 was successfully created with comprehensive problem description covering ARM64 wheel availability but being ignored due to AMD64-only dependency locking, root cause analysis of platform-specific pipenv limitations, immediate conditional installation solution, multi-platform locking ecosystem analysis, broader affected areas investigation, clear acceptance criteria, and proper context linking, continuing the established pattern of systematic code quality improvements through detailed issue tracking.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#2215
File: runtimes/datascience/ubi9-python-3.12/pyproject.toml:18-18
Timestamp: 2025-08-29T14:57:11.189Z
Learning: jiridanek requested GitHub issue creation for quote style standardization in pyproject.toml dependencies during PR #2215 review. Repository analysis revealed most pyproject.toml files lack [project.dependencies] sections, making the scope more targeted than initially assessed. Issue #2222 was created with corrected analysis showing limited scope but valid concern for consistency, recommending single quotes by default with double quotes only when necessary for constraint conflicts like platform markers.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#2185
File: jupyter/pytorch/ubi9-python-3.12/Dockerfile.cuda:109-117
Timestamp: 2025-08-29T08:48:55.985Z
Learning: jiridanek prefers to implement systematic cleanup improvements through dedicated GitHub issues (like #2076) rather than applying individual point fixes during PR reviews, maintaining consistency with their established pattern of comprehensive code quality improvements.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#1259
File: jupyter/rocm/tensorflow/ubi9-python-3.12/kustomize/base/service.yaml:5-15
Timestamp: 2025-07-02T18:59:15.788Z
Learning: jiridanek creates targeted GitHub issues for specific test quality improvements identified during PR reviews in opendatahub-io/notebooks. Issue #1268 demonstrates this by converting a review comment about insufficient tf2onnx conversion test validation into a comprehensive improvement plan with clear acceptance criteria, code examples, and ROCm-specific context.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#0
File: :0-0
Timestamp: 2025-07-11T11:16:05.131Z
Learning: jiridanek requested GitHub issue creation for RStudio py311 Tekton push pipelines during PR #1379 review. Issue #1384 was successfully created covering two RStudio variants (CPU and CUDA) found in manifests/base/params-latest.env, with comprehensive problem description, implementation requirements following the same pattern as other workbench pipelines, clear acceptance criteria, and proper context linking, continuing the established pattern of systematic code quality improvements through detailed issue tracking.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#1995
File: jupyter/rocm/tensorflow/ubi9-python-3.11/Dockerfile.rocm:0-0
Timestamp: 2025-08-19T06:31:05.424Z
Learning: jiridanek requested GitHub issue creation for ROCm device detection test during PR #1995 review. The issue covers comprehensive test requirements for validating that device_lib.list_local_devices() successfully detects ROCm/HIP devices after ROCm package optimizations, including multiple solution options (pytest, shell script, notebook-based), detailed acceptance criteria for core requirements and test coverage, implementation guidance for test framework selection and CI integration, example test code for TensorFlow device detection validation, and proper context linking to PR #1995 and review comment, continuing the established pattern of systematic code quality improvements through detailed issue tracking.
Learnt from: jiridanek
PR: opendatahub-io/notebooks#1972
File: runtimes/pytorch+llmcompressor/ubi9-python-3.12/Pipfile:44-45
Timestamp: 2025-08-18T12:37:25.956Z
Learning: jiridanek requested GitHub issue creation for comprehensive functionality testing of all packages in the LLMCompressor Pipfile during PR #1972 review. Issue #1984 was created with detailed testing framework covering 30+ packages across 8 categories (PyTorch, LLMCompressor, data science, cloud storage, model conversion, database connectors, messaging, conflict resolution), 3-phase implementation plan, comprehensive acceptance criteria for CI/CD integration, and specific code examples for each testing domain, continuing the established pattern of systematic code quality improvements through detailed issue tracking.
@jiridanek: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
/lgtm |
Description
How Has This Been Tested?
Merge criteria:
Summary by CodeRabbit