Skip to content

refactor: replace os.path with pathlib#388

Merged
Jammy2211 merged 1 commit intomainfrom
feature/use-pathlib
May 7, 2026
Merged

refactor: replace os.path with pathlib#388
Jammy2211 merged 1 commit intomainfrom
feature/use-pathlib

Conversation

@Jammy2211
Copy link
Copy Markdown
Collaborator

Summary

Mechanical refactor replacing all os.path.* and bare path.* (from from os import path) usages with pathlib.Path. Part of cross-repo issue PyAutoLabs/PyAutoFit#1257 — the codebase already used pathlib extensively in newer code; this sweeps up the remaining legacy usages for consistency.

API Changes

None — internal changes only. All public function signatures unchanged. Implementation switches from string-style joins to Path objects, but returned values, accepted argument types, and external behaviour are unchanged. Some test fixtures (PlotPatch) now stringify recorded paths to keep assertions stable.

See full details below.

Test Plan

  • python -m pytest test_<repo>/ passes (CI)
  • Verified locally as part of cross-repo sweep (3,188 tests across PyAutoConf/PyAutoFit/PyAutoArray/PyAutoGalaxy/PyAutoLens)
  • No public API changed — workspace scripts should be unaffected (separate workspace PR follows for tutorial/example consistency)
Full API Changes (for automation & release notes)

Removed

  • None — no public symbols removed

Added

  • None — no new public symbols

Renamed

  • None

Changed Signature

  • None

Changed Behaviour

  • None observable. Internal helpers now build paths with Path / "..." instead of os.path.join, but consumers that accept str | os.PathLike see the same effective path.

Migration

  • No user migration needed.

Refs PyAutoLabs/PyAutoFit#1257.

🤖 Generated with Claude Code

Drop legacy `from os import path` and `os.path.X` usages in favour of
`pathlib.Path`. Internal-only refactor; no public API changes.

Refs PyAutoLabs/PyAutoFit#1257.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Jammy2211
Copy link
Copy Markdown
Collaborator Author

Workspace PR: PyAutoLabs/autogalaxy_workspace#59

@Jammy2211
Copy link
Copy Markdown
Collaborator Author

Workspace PR: PyAutoLabs/autolens_workspace#128

@Jammy2211
Copy link
Copy Markdown
Collaborator Author

@Jammy2211
Copy link
Copy Markdown
Collaborator Author

Workspace PR: Jammy2211/autofit_workspace_developer#15

@Jammy2211
Copy link
Copy Markdown
Collaborator Author

@Jammy2211 Jammy2211 deleted the feature/use-pathlib branch May 7, 2026 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending-release PR queued for the next release build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant