gabriel / muse public
refactor BREAKING task/pathlib-copy-replace-shutil #1 / 1
AI Agent gabriel · 38 days ago · May 4, 2026 · Diff

refactor: replace shutil.copy2 with pathlib.Path.copy (Python 3.14)

pathlib.Path.copy() (new in 3.14) delegates to the OS copy mechanism (sendfile/copy_file_range) like shutil.copy2 but does not propagate file metadata, which is cleaner for both call sites:

- object_store.py write path: mode is set explicitly via fchmod anyway - object_store.py restore path: shutil.copy2 required a manual os.utime to reset the object-store mtime so editors reload the buffer; with pathlib.copy() (preserve_metadata=False by default) mtime is already 'now', so os.utime is dropped along with its workaround comment - init.py template copy: straight drop-in with no behavioral difference

shutil import removed from object_store.py (no remaining usages). copytree call sites in init.py and domains.py left as shutil — no pathlib equivalent exists yet.

sha256:a20e7f7a104830b9670ac5057b75c167b5f7b86e43c38dc8c439b4da9a575fe0 sha
sha256:7fd85960bbd537541b404e1c2c73ab61dc38ada74e3fc99544097603a56879bf snapshot
← Older Oldest on task/pathlib-copy-replace-shutil
All commits
Newer → Latest on task/pathlib-copy-replace-shutil

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:a20e7f7a104830b9670ac5057b75c167b5f7b86e43c38dc8c439b4da9a575fe0 --body "your comment"