Add comprehensive type annotations to scripts module#2979
Merged
jonathangreen merged 2 commits intomainfrom Jan 15, 2026
Merged
Add comprehensive type annotations to scripts module#2979jonathangreen merged 2 commits intomainfrom
jonathangreen merged 2 commits intomainfrom
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2979 +/- ##
==========================================
- Coverage 92.81% 92.79% -0.02%
==========================================
Files 454 454
Lines 42954 43095 +141
Branches 6000 6017 +17
==========================================
+ Hits 39866 39992 +126
- Misses 2018 2032 +14
- Partials 1070 1071 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
46dbf87 to
ef38be6
Compare
Member
Author
|
I'm going to move this back to draft, I need to look into why the coverage dropped here before it gets reviewed. |
Add comprehensive type annotations to all script classes in palace.manager.scripts and related integration modules. Remove 24 script modules from mypy exclusion list to enable strict type checking. Key changes: - Add type hints to all function signatures and class methods - Update arg_parser() methods to accept _db: Session parameter - Migrate from generic exceptions to Palace-specific exceptions - Modernize code with f-strings and improved error messages - Fix availability.py to work with updated API signatures requiring collection parameter Breaking change: arg_parser() methods now require _db parameter for consistency across all script classes.
dd25ca1 to
f9a2f46
Compare
Add comprehensive test coverage for script error paths and initialization logic: - Add test for ShowLibrariesScript with nonexistent library name - Add test for ShowCollectionsScript with nonexistent collection name - Add tests for WorkProcessingScript.__init__ covering all initialization paths - Fix missing newline in ShowCollectionsScript error message for consistency The WorkProcessingScript tests cover: - Default initialization with no arguments - Initialization with identifier type filtering - Error validation when identifier strings provided without type - Initialization with specific identifier IDs - Custom batch_size and force parameters - Data source filtering
Member
Author
|
Okay, I added a few additional test. The rest of the test coverage reduction is are some of the defensive checks that strict type hints necessitated. I think the patch coverage is all pre-existing coverage gaps. |
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.
Description
Adds complete type annotations to the
scriptsmodule, removing 25+ modules from the mypy ignore list. This enables full type checking for all scripts, improving code quality and maintainability.Key Changes:
_normalize_cmd_args()helper to eliminate code duplicationfrom __future__ import annotationsfor modern type syntaxPalaceValueErrorMotivation and Context
The scripts module was excluded from mypy type checking. This PR brings it up to the same type safety standards as the rest of the codebase, catching type errors at development time instead of runtime.
How Has This Been Tested?
Checklist