Repository navigation
v1.6.0 — Python Quality Refactoring
What's Changed
Structural refactoring for code quality — no behavioral changes.
Highlights
- Generic field syncer —
_sync_performers,_sync_tags,_sync_collectionunified into a singlesync_field()function withFieldSyncSpecdataclass, eliminating ~160 lines of duplication - Decomposed processor.py — Extracted
MetadataUpdaterclass (261 lines) andfield_syncmodule (151 lines), reducingprocessor.pyfrom 1293 to 854 lines - DRY Pydantic validators — Three near-identical sanitize validators replaced with a factory function
- Import consolidation — Pure-function imports moved to module level; remaining lazy imports annotated with reasons
- Test modernization — Builder factories (
make_plex_item,make_config,make_job,make_stash_scene) replace rigid fixtures; parametrized field sync tests cover all three field types
Stats
| Metric | Before | After |
|---|---|---|
processor.py lines |
1293 | 854 |
| Test coverage | ~88% | 90% |
| Tests | 1223 | 1212 |
Test count decreased by 11 (redundant tests removed, 45 new tests added for extracted modules).
New Files
worker/field_sync.py— Generic field sync logicworker/metadata_updater.py— Metadata update orchestrationworker/errors.py— Base error classes (extracted to break circular import)tests/factories.py— Reusable test object builders