[ci][python][build] Modernize Python dependency management with uv an…#50
Merged
HuangXingBo merged 1 commit intoJul 7, 2025
Merged
Conversation
…d pyproject.toml - Replace multiple *-requirements.txt files with modern pyproject.toml - Add optional dependency groups: dev, build, lint, test, all - Integrate uv tool for faster dependency resolution - Add intelligent fallback to pip in tool scripts - Update CI to use actions/setup-python@v4 and actions/setup-java@v4 - Add astral-sh/setup-uv@v4 for modern dependency management - Restrict Python version to 3.9-3.11 (PyFlink 1.20.1 limitation) - Maintain full backward compatibility with existing workflows Linked issue: apache#29
HuangXingBo
approved these changes
Jul 7, 2025
Contributor
HuangXingBo
left a comment
There was a problem hiding this comment.
@Sucran Thanks a lot for the contribution. The PR looks very good.
Contributor
|
@Sucran Thank you very much for this beautiful and thorough analysis, documentation and PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Solution Summary for Issue #29: Modernize Python Dependency Management
Linked issue: #29 - Use modern pyproject.toml and uv setup instead of multiple *-requirements.txt files
Purpose of Change
🎯 Objective
Replace multiple
*-requirements.txtfiles with modernpyproject.tomlconfiguration and integrateuvas the primary dependency management tool, while maintaining full backward compatibility.🔧 Key Improvements
Modern Dependency Management
pyproject.tomloptional dependenciesuvtool for faster and more reliable dependency resolutionpipapproachPython Version Compatibility
requires-python = ">=3.9,<3.12"to reflect actual PyFlink limitationsdistutilsremoval and upstream dependenciesEnhanced Tooling
tools/lint.shandtools/ut.shwith smart detectionuvtopipwhen neededCI/CD Modernization
actions/setup-python@v2→actions/setup-python@v4actions/setup-java@v2→actions/setup-java@v4astral-sh/setup-uv@v4for modern dependency managementuv['3.9', '3.10', '3.11']Tests
✅ Validation Results
uv) and traditional (pip) methods workactions/setup-python@v4: Successfully sets up Python 3.9-3.11 environmentsactions/setup-java@v4: Properly configures JDK 11 for Java componentsastral-sh/setup-uv@v4: Correctly installs and configures uv tool🧪 Test Coverage
🔍 Compatibility Matrix
API
🔄 Dependency Groups Migration
build_requirements.txt[build]uv sync --extra buildlinter_requirements.txt[lint]uv sync --extra linttest_requirements.txt[test]uv sync --extra testall_requirements.txt[all]uv sync --extra all📦 New pyproject.toml Structure
🛠️ Tool Integration
Smart Detection Logic:
Documentation
📚 Comprehensive Documentation
PYTHON_VERSION_COMPATIBILITY.md
MIGRATION_GUIDE.md
requirements/DEPRECATED.md
🚀 Usage Examples
Modern Workflow (Recommended):
Traditional Workflow (Backward Compatible):
Python Version Limitation:
GitHub Actions Modernization:
Migration Strategy:
Future Proofing:
🎉 Summary
This solution successfully addresses all requirements from Issue #29:
The implementation provides a solid foundation for modern Python dependency management while respecting ecosystem limitations and maintaining reliability for all users.