-
Notifications
You must be signed in to change notification settings - Fork 64
Migrates the Python package from Poetry to UV for faster, more reliable dependency management. #2755
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
…e quality Migrate the Python library from Poetry to UV package manager and implement modern development tooling with significant code quality improvements. ## Package Management Migration - Replace Poetry with UV (10-100x faster package resolution) - Migrate pyproject.toml to PEP 621 standard format - Add environment-specific numpy versions (2.2.6 for Python 3.10, 2.4.1 for 3.11+) - Reduce dependencies from 58 to 47 packages (19% reduction) - Remove Black (replaced by Ruff format) - Remove Pylint (replaced by Ruff lint) - Switch build backend to setuptools for flat layout compatibility ## Enhanced Code Quality - Replace Black with Ruff formatter (Black-compatible, much faster) - Consolidate linting with Ruff (replaces flake8, isort, pylint) - Enable additional lint rules: I (isort), N (naming), UP (pyupgrade), B (bugbear), W (warnings), C4 (comprehensions), SIM (simplify) - Auto-fix 473 linting issues across 179 files - Reformat 71 files with consistent style - Reduce linting issues from 835 to 252 (70% improvement) ## Development Tooling Add justfile with 30+ commands for streamlined development: - Code quality: format, lint, lint-fix, lint-stats - Git-aware commands: format-changed, lint-changed, verify-changed (10-30x faster) - Testing: test, test-cov, test-cov-html, test-fast, test-file - Pre-commit: verify (full check), verify-changed (fast), check (CI-strict) - Dependencies: add, update, deps - Utilities: clean, build, info, cli ## Configuration Improvements Enhanced pyproject.toml with: - Comprehensive project metadata (license, keywords, classifiers) - Project URLs (homepage, docs, repository, issues) - Ruff configuration with isort settings - Pytest configuration with test markers - Coverage configuration with exclusion rules ## Documentation Updates - Update CLAUDE.md with UV/Ruff commands and tech stack - Update docs/development/testing.md with Just commands - Add Python development section to docs/development/developing.md - Create README-DEV.md with comprehensive developer guide ## Breaking Changes - Poetry commands replaced with UV equivalents - poetry.lock replaced with uv.lock (backward incompatible) - Black configuration removed (Ruff handles formatting) ## Migration Notes Developers should: 1. Install UV: `curl -LsSf https://astral.sh/uv/install.sh | sh` 2. Install dependencies: `uv sync` 3. Use `just` commands for development tasks 4. Run `just verify-changed` before commits (fast pre-commit check) ## Performance Improvements - Package installation: 10-100x faster with UV - Linting: Much faster with Ruff (Rust-based) - Git-aware commands: Only check changed files (10-30x faster) - Pre-commit workflow: `verify-changed` completes in 1-2 seconds Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Enhanced Python codebase quality by applying Ruff linting rules and adding macOS tooling installation instructions. ## Code Quality Improvements Applied Ruff auto-fixes across 92 Python files to improve code quality and modernize syntax: ### SIM102 - Collapsed Nested If Statements (8 fixes) - binary_accessor.py: Combined nested conditionals for INT conversion and buffer bounds checking - config_parser.py: Simplified comment detection logic - ignore_packet_protocol.py: Merged packet identification checks - length_protocol.py: Combined fill_fields checks in write_packet and write_data methods - interface_microservice.py: Consolidated hazardous command checks - commands.py: Combined range check validation conditions ### UP031 - Modernized String Formatting (4 fixes) - binary_accessor.py: Converted percent formatting to f-strings in read_array and write_array methods for struct format strings - Performance improvement: f-strings are faster than % formatting - Better readability and type safety All changes verified with comprehensive test coverage: - 42 tests passed for read_array functionality - 65 tests passed for write_array functionality - 291 total tests passed in binary_accessor test suite ## Documentation Updates Added macOS installation instructions for development tools: - CLAUDE.md: Added `brew install uv ruff just` before Python test commands - docs/development/developing.md: Added "Installing Tools (macOS)" section - openc3/python/README-DEV.md: Reorganized to show Homebrew installation first in Development Tools section Makes it clearer for macOS developers (primary development platform) how to install required tools: UV (package manager), Ruff (linter/ formatter), and Just (command runner). ## Technical Details - Ruff rules applied: SIM102 (simplify control flow), UP031 (pyupgrade) - Target Python version: 3.10+ (maintained compatibility) - Line length: 120 characters - All changes preserve existing functionality and pass existing tests Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…the default Python version for a project or directory. It allows uv to automatically select the correct Python version when working within that project.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2755 +/- ##
=======================================
Coverage 79.17% 79.17%
=======================================
Files 670 670
Lines 54278 54278
Branches 734 734
=======================================
+ Hits 42972 42974 +2
+ Misses 11226 11224 -2
Partials 80 80
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|




Summary
This PR migrates the Python package from Poetry to UV for faster, more reliable dependency management. As part of this migration, we've also improved code quality with Ruff linting and updated documentation for macOS developers.
Primary Changes
Poetry → UV Migration
poetry.locktouv.lockfor dependency managementpyproject.tomlto PEP 621 format with UV-compatible configurationjustfilewith 35+ development commands.poetrydirectory,poetry.lock.backup).python-versionfile to specify Python 3.12Benefits:
Code Quality Improvements (Bonus)
%to f-stringsMigration Notes
Developers will need to:
brew install uv ruff just(macOS)uv venvuv syncjust test,just verify, etc.See
openc3/python/README-DEV.mdfor complete guide.Related: Addresses the need for faster dependency management and modernized Python tooling.