-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: implement uv for locked requirements.txt generation and Docker builds #3026
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
base: main
Are you sure you want to change the base?
Conversation
…builds - Add uv-based requirements.txt generation from pyproject.toml - Update Dockerfile to use uv for faster Python package installation with hash verification - Create comprehensive tooling: Python script, Bash script, and Makefile targets - Add Docker build testing capabilities for validation - Include detailed documentation for the new dependency management approach This implementation provides: - Faster Docker builds with uv''s parallel installation capabilities - Enhanced security through hash verification of all packages - Seamless integration with existing Poetry development workflow - Multiple interfaces (scripts, Makefile) for different use cases - Comprehensive testing and validation tools The approach maintains Poetry for development while using uv-generated requirements.txt for production Docker builds, combining the best of both tools. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
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.
Caution
Changes requested ❌
Reviewed everything up to 18df84e in 2 minutes and 3 seconds. Click for details.
- Reviewed
458
lines of code in6
files - Skipped
0
files when reviewing. - Skipped posting
3
draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. Dockerfile:6
- Draft comment:
Consider pinning the 'uv' package version to ensure reproducible builds. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% While version pinning is generally good practice, 'uv' is just a build tool here, not a runtime dependency. The actual dependencies are managed through pyproject.toml/poetry.lock and installed with hash verification. If uv had breaking changes, the build would fail obviously. The comment feels overly cautious. Version pinning could prevent unexpected build failures if uv introduces breaking changes. The build tool's stability does affect build reproducibility. However, uv is a mature build tool, and the actual dependencies are properly locked. A build failure from uv would be immediately obvious and fixable. The comment is overly cautious about build reproducibility when the critical dependencies are already properly managed. The comment should be removed.
2. scripts/test_docker_build.sh:25
- Draft comment:
Avoid using double quotes inside command substitution. Use single quotes for the grep regex pattern to prevent potential syntax issues. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% While using single quotes for regex patterns is generally good practice in bash, the current pattern is very simple and doesn't contain any characters that would cause issues with double quotes. The pattern "^[a-zA-Z]" works perfectly fine as is. This seems like an overly pedantic suggestion that doesn't address any real problem. Single quotes could prevent potential issues if the regex pattern becomes more complex in the future. It's technically a best practice for regex patterns. The current pattern is extremely simple and stable - it's just counting package lines. The change would not provide any tangible benefit and could be seen as unnecessary churn. This comment should be deleted as it suggests a change that provides no real benefit and doesn't address any actual issues in the code.
3. scripts/test_docker_build.sh:25
- Draft comment:
The command substitution in this line uses double quotes for the grep pattern, which might cause issues with nested quoting. Consider changing the pattern to use single quotes (e.g.grep -c '^[a-zA-Z]' requirements.txt || echo '0'
) to avoid potential parsing problems. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The current code using double quotes works fine - there's no actual quoting issue here since ^ is treated the same in both single and double quotes in grep patterns. The suggestion is overly pedantic and doesn't fix any real problem. Shell scripting often uses both quote styles interchangeably when there's no interpolation needed. Maybe there could be some edge case where double quotes cause issues that I'm not thinking of? The commenter may have specific shell scripting best practices in mind. Even if there were edge cases, the current code works correctly as-is. The suggestion is a style preference rather than a functional improvement or bug fix. Delete this comment as it suggests a style change that doesn't improve functionality or fix any actual issues.
Workflow ID: wflow_xKDphvsjPEx1F9o5
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
str(project_dir / "pyproject.toml"), | ||
"--output-file", str(project_dir / "requirements.txt"), | ||
"--generate-hashes", | ||
"--no-deps" # Don't include dev dependencies |
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.
The use of '--no-deps' may be ambiguous. Clarify if it excludes only dev dependencies or all transitive dependencies.
"--no-deps" # Don't include dev dependencies | |
"--no-deps" # Exclude all transitive dependencies, not just dev dependencies |
Summary
This PR implements uv-based dependency management for generating locked requirements.txt files and optimizing Docker builds. The implementation maintains the existing Poetry development workflow while providing faster, more secure Docker builds.
• Faster Docker builds: uv provides significantly faster dependency resolution and parallel installation
• Enhanced security: Hash verification for all packages ensures integrity and reproducibility
• Seamless integration: Works alongside existing Poetry workflow without disruption
• Comprehensive tooling: Multiple interfaces (Python script, Bash script, Makefile) for different use cases
Changes Made
Core Implementation
Dockerfile
to use uv for requirements generation and package installationgenerate_requirements.py
Python script for programmatic requirements generationscripts/generate_requirements.sh
for shell-based workflowsMakefile
with convenient development commandsDocumentation & Testing
docs/DEPENDENCY_MANAGEMENT.md
with complete usage guidescripts/test_docker_build.sh
for Docker build validationTechnical Details
poetry export
withuv pip compile
for faster, more reliable requirements generation--generate-hashes
) for enhanced securityuv pip install --system
for faster Docker package installationBenefits
Test plan
Changes that Break Backward Compatibility
N/A - The changes maintain full backward compatibility with existing Poetry development workflows while adding new uv-based production build capabilities.
Documentation
Comprehensive documentation has been added including:
docs/DEPENDENCY_MANAGEMENT.md
- Complete guide for the new dependency management approach🤖 Generated with Claude Code
Created with Palmier
Important
Implement
uv
for generating lockedrequirements.txt
and optimizing Docker builds, replacingpoetry export
.Dockerfile
to useuv
for generatingrequirements.txt
and installing packages.generate_requirements.py
for programmatic requirements generation.scripts/generate_requirements.sh
for shell-based requirements generation.Makefile
with commands for generating requirements, building Docker images, and testing.docs/DEPENDENCY_MANAGEMENT.md
with usage guide foruv
.scripts/test_docker_build.sh
to validate Docker builds withuv
.poetry export
withuv pip compile
for faster requirements generation.uv pip install --system
for faster package installation with hash verification.This description was created by
for 18df84e. You can customize this summary. It will automatically update as commits are pushed.