Migrate importer path APIs and state to `pathlib.Path`
Author: snejusCreated Sep 1, 2026Updated Sep 1, 2026
Part of: #1409
Depends on: the library-directory Path migration.
Problem
Importer code still passes paths through sessions, tasks, factories, and persisted import state using byte-oriented contracts. That keeps byte conversions scattered across import flow code and blocks tests from treating importer-owned paths as normal Path values.
Expected behavior
ImportSession, import tasks, task factories, and importer stages usePathfor filesystem paths.ImportTask.pathsand related task state exposePathvalues at runtime.sorted_walkandalbums_in_dirusePathduring importer directory discovery.- Persisted import state decodes legacy byte/string values when loading and stores only through an explicit serialization boundary.
- Import UI and plugin event payloads receive
Pathvalues where they describe filesystem paths. - Existing behavior for resumable imports, duplicate detection, art lookup, and plugin hooks is preserved.
Suggested fix
Migrate importer state and task types together so each importer path has one runtime representation. Keep encoding and decoding local to state persistence and any external format that still requires primitive values.
Acceptance criteria
- Importer path APIs no longer require caller-side
os.fsencodeoros.fsdecode. - Importer directory discovery works with Path-based
sorted_walkandalbums_in_dir. - Legacy import state remains readable.
- Importer tests and affected plugin tests use
Pathat the runtime boundary. poe testandpoe lintpass with coverage at or above 80%.
Source: beetbox/beets