← Back to issue list

Migrate to pathlib

View original Github issue

Metadata

Project
craft-parts
Number
#1317
Type
issue
State
open
Author
lengau
Labels
Type: Refactor Status: Triaged
Created
Updated
Closed

Current evaluation

Refactor to replace legacy os.path usage with pathlib. Triaged; a contributor took it on in Oct 2025 but no PR has landed since. PR #1424 partially migrated the codebase, yet ~59 os.path usages remain, so the work is incomplete.

Suggested action: keep open

Reason: The issue is triaged (Status: Triaged label) and maintainer lengau explicitly accepted contributor EdmilsonRodrigues's offer on 2025-10-23, so it has maintainer buy-in. The task remains genuinely applicable: os.path still appears in ~59 places (collisions.py, organize.py, apt_cache.py, etc.) even after PR #1424 'refactor: use pathlib internally' was merged. Inactivity for ~9 months is notable, but the work is unfinished and still valid, so it should stay open rather than be closed as stale.

Impact: 20 Quick Win: 11.0 Staleness: 60 Complexity: 45 Confidence: 80 Support Request: 0

Issue body

### What needs to get done We have many places where we use older `os.path` tools, which we should move to using `pathlib` ### Why it needs to get done Modern Python, yo!

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 20
Quick Win: 11.0
Staleness: 60
Complexity: 45
Confidence: 80
Support Request: 0
keep open Refactor to replace legacy os.path usage with pathlib. Triaged; a contributor took it on in Oct 2025 but no PR has landed since. PR #1424 partially migrated the codebase, yet ~59 os.path usages remain, so the work is incomplete.
qwen/qwen3.6-35b-a3b
Staleness: 65
Complexity: 20
Confidence: 90
Support Request: 5
keep open Refactor codebase to replace legacy os.path usage with modern pathlib. Issue is triaged, accepted by a contributor, and awaiting implementation.
qwen3.6-35b-a3b-mtp-q6
Staleness: 70
Complexity: 40
Confidence: 75
Support Request: 0
keep open Refactor issue to replace os.path with pathlib. Triaged and assigned to a contributor in October 2025, but has seen no updates or PRs for over seven months.
qwen3.6-35b-a3b-mtp-q6
Staleness: 65
Complexity: 30
Confidence: 85
Support Request: 0
keep open Replace legacy os.path usage with pathlib across the codebase. The refactor is triaged and assigned to EdmilsonRodrigues, who is preparing to implement the changes. No bounty is attached.

Update history

No update history recorded yet.

Related work

  • Related To: craft-parts#1424 (confidence 85%)

    PR #1424 'refactor: use pathlib internally' (commit cfdabafc) partially performed this migration, but ~59 os.path usages remain in the codebase, so it does not fully close the issue.

  • Related To: craft-parts#1288 (confidence 60%)

    'style: fix ruff PTH211 errors' addressed os.path.join lint findings, an adjacent step toward the pathlib migration.

Related issues

Issue Project State Summary Similarity
#1572 Breaking migrations to pathlib craft-parts closed Resolved via PR #1424. The pathlib migration is stable, using custom YAML serializers to convert Path objects to strings and back in MigrationState. Path set deserialization is verified.
71%