Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
First step of upathtools.fs (docs/design/core-fs-plan.md, Step 1): FileInfo (frozen, slots, kw_only; from_fsspec_dict/to_fsspec_dict), GrepMatch, the error hierarchy, runtime-checkable capability protocols and FSSPEC_SYNC_VERSION / FsspecSyncNote. Written by Gemini 4 Neon (agy), reviewed by Claude. Changed in review: - FileInfo is hashable (extra excluded from the hash, still compared). - from_fsspec_dict keeps an unparsable timestamp in extra instead of raising. - ty's override rules are re-enabled for src/upathtools/fs (pyproject override). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #14 +/- ##
===========================================
+ Coverage 39.95% 51.02% +11.06%
===========================================
Files 82 104 +22
Lines 12415 15760 +3345
===========================================
+ Hits 4960 8041 +3081
- Misses 7455 7719 +264 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Step 2 of docs/design/core-fs-plan.md: paths.py (split/strip_protocol, normalize/parent/join, unchain, check_contained, infer_storage_options, tokenize), glob.py (glob_translate, compile_glob, has_magic, other_paths), batch.py (run_bounded: TaskGroup worker pool, ordered results, first error cancels the rest) and cache.py (DirCache: lock-guarded, TTL, LRU, prefix invalidation). Each ported module carries __fsspec_sync__; the tests use fsspec's own functions as the oracle. Written by Gemini 4 Neon (agy), reviewed by Claude. Changed in review: - run_bounded(return_exceptions=True) captures Exception only, so KeyboardInterrupt / SystemExit are not turned into results. - DirCache.invalidate(path) also drops the parent's listing (it lists path). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…oryFS Step 3a of docs/design/core-fs-plan.md (as split in its review notes): - AsyncFS[TInfo]: three required primitives (info, ls, read_bytes), optional mutation primitives raising UnsupportedOperation, and derived operations (exists/is_file/is_dir that only catch FileNotFoundError and NotADirectoryError, level-parallel walk, find, fsspec-style glob, single-pass du, read_many, touch, copy/move with pathlib exact-target semantics and pre-flight conflict checks, recursive remove, get/put_file, grep, diff, open). - streams.py: stream protocols, AsyncBufferedReader (block reads over read_bytes ranges, seek/readline/iteration), AsyncBufferedWriter (commits on close, discards when the async-with body raises; wb/xb/ab). - MemoryFS: per-instance MemoryStore (optionally shared), one lock never held across an await, explicit directories, implicit parents on write, atomic native move of files and subtrees. - tests/fs/contract.py: AsyncFSContract, the backend-independent suite (incl. fsspec's GLOB_EDGE_CASES_TESTS), run against MemoryFS; base tests with a read-only minimal backend, error propagation and cancellation. Written by Gemini 4 Neon (agy), reviewed by Claude. Changed in review: - capabilities lists only native primitives (write_bytes, mkdir, rmdir, remove_file, move, grep); derived helpers like copy or touch work everywhere and no longer count as a capability when a subclass overrides them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Step 3b of docs/design/core-fs-plan.md (review notes: no fs.sync property, an explicit SyncFS(fs, runner=...)): - LoopRunner: a private loop on a lazily started daemon thread, run() with Future.result(timeout) (FSTimeoutError, the coroutine is cancelled), KeyboardInterrupt cancels the future, a clear RuntimeError on re-entry from the runner's own loop, idempotent close(). Fork-safe: every runner and the module locks are reset in the child (fsspec's reset_after_fork resets the wrong global). get_default_runner() for scripts. - SyncFS: a hand-written, typed 1:1 mirror of the AsyncFS methods (a test guards names, parameters and defaults against drift); open() returns SyncFileBridge (io.BufferedIOBase) or a TextIOWrapper for text modes. Written by Gemini 4 Neon (agy), reviewed by Claude (no changes needed). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ol, UPath bridge Step 4 of docs/design/core-fs-plan.md: - to_fsspec / AsFsspecFileSystem: any AsyncFS as an fsspec AsyncFileSystem (cachable=False; the sync API runs on a LoopRunner, never on fsspec's global fsspecIO thread; glob/find delegate to the core; buffered _open). register_fsspec_bridge / register_upath_bridge make fsspec.open(), fsspec.filesystem() and plain UPath(...) resolve a core filesystem (an fsspec class plus a UPath subclass whose _fs_factory builds the adapter); nothing is registered at import time. - from_fsspec / FsspecAdapter: any fsspec filesystem as an AsyncFS (awaits the coroutine hooks of asynchronous=True filesystems, threads for everything else, the backend's own path rules, core error semantics on top); ensure_async_fs caches one adapter per instance and unwraps to_fsspec. - ProtocolRegistry (own factories, entry points "upathtools.filesystems", fsspec fallback with skip_instance_cache) and FilesystemPool (one instance per loop and options, closed and collected loops drop out, aclose_loop). - fsspec's own abstract suite (copy/get/put/open/pipe incl. the glob edge cases) passes against to_fsspec(MemoryFS()) and the round trip to_fsspec(from_fsspec(fsspec memory)): 272 passed, no xfails. (fsspec 2026.9.0 ships mv tests only as functions bound to the local fs.) - The AsyncFSContract runs against from_fsspec(memory) and from_fsspec(local); 3 strict xfails, all fsspec backend quirks (error types; mkdir without parents not checked by MemoryFileSystem). Written by Gemini 4 Neon (agy), reviewed by Claude (no changes needed). Small base changes: remove(recursive) tolerates implied directories that vanished, copy() compares against root_marker instead of "/". Co-Authored-By: Claude Opus 5.5 <[email protected]>
Rest of Step 5 of docs/design/core-fs-plan.md:
- LocalFS (protocols file, local): LocalFSInfo (uid, gid, ino, nlink), all
blocking calls in threads, lstat-based symlink metadata, ranged reads via
seek, atomic overwrites (temp file + replace) and O_EXCL creates,
per-instance auto_mkdir, native move (rename; base copy+remove across
devices or when merging into an existing directory), ripgrep-rs fast paths
for grep and for find with hidden/no_ignore filters (falling back to the
base where ripgrep can't give identical results).
- DirFS: a root-jailed prefix over any AsyncFS[TInfo] (PathEscapeError
before any I/O, TInfo preserved via dataclasses.replace, native move/find/
glob/grep of the wrapped fs delegated, no asynchronous flag).
- walk() no longer descends into directory symlinks; remove() unlinks them.
- LocalFS registered as "file"/"local" in the core registry (not in fsspec's).
- fsspec's abstract suite now also passes against to_fsspec(LocalFS()) and
to_fsspec(DirFS(MemoryFS(), "/root")): 4 x 136 passed, no xfails.
Written by Gemini 4 Neon (agy), reviewed by Claude. Changed in review:
- Atomic writes created the temp file with mkstemp (0600), so every written
file ended up 0600 and overwrites dropped the file's permissions: the temp
file is now created with 0666 & ~umask and takes the existing file's mode.
- Writing onto a symlink writes through to its target instead of replacing
the link (like open("wb")); tests for both.
- DirFS documents that its jail is lexical (symlinks are not resolved).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ync-note gate Rest of Step 6 of docs/design/core-fs-plan.md: - tests/fs/conformance/DIVERGENCES.md: every fsspec behaviour upathtools.fs intentionally does not replicate, why, and the test pinning it; test_divergences.py fails when a referenced test disappears or an xfail of test_from_fsspec.py is undocumented. - test_free_threading.py: 8 threads hammering MemoryFS, LocalFS, DirCache, ProtocolRegistry, FilesystemPool, LoopRunner and SyncFS at once (no torn files, only the documented races, no leaked threads); reports whether the GIL is enabled so a free-threaded run is visible. - test_sync_notes.py + scripts/check_fsspec_sync.py: every ported module's __fsspec_sync__ matches FSSPEC_SYNC_VERSION == uv.lock == installed fsspec, and each upstream symbol still resolves in the installed fsspec; the script prints the compare URL and exits 1 on drift. Written by Gemini 4 Neon (agy), reviewed by Claude (no changes needed). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Typed, async-first filesystem core in
upathtools.fs, built step by step on this branch. Design:docs/design/core-fs-plan.md(its "Review notes" section overrides the body). Everything is additive: existing modules are untouched until plan Step 7.Each step: written by Gemini 4 Neon (agy), reviewed and fixed by Claude.
AsyncFSbase + streams +MemoryFSLoopRunner+SyncFSfrom_fsspec/to_fsspec/ registry /FilesystemPool+ UPath bridge,fsspec.tests.abstractonto_fsspec(MemoryFS())LocalFS,DirFS(+ conformance)Status: 1344 passed, 3 strict xfails (fsspec backend quirks, see
tests/fs/conformance/DIVERGENCES.md). fsspec's own abstract suite (copy/get/put/open/pipe incl. glob edge cases) passes againstto_fsspec(MemoryFS()),to_fsspec(LocalFS()),to_fsspec(DirFS(MemoryFS(), "/root"))and the round tripto_fsspec(from_fsspec(fsspec memory)): 4 x 136 passed, 0 xfails. CI minutes are out until 2026-12-01; verified locally.Decided (owner, 2026-11-26):
corememalias: dropped,MemoryFSanswers tomemoryonly (a9e8de1).copy/move: keeppathlib.Path.copysemantics (exact target, trees, norecursive);to_fsspeckeeps fsspec's cp/mv.ci_free_threading(copier-phil65 v2.16.1: a 3.14t job on ubuntu, allowed to fail, syncs without extras that lack a free-threaded wheel); on for this repo (0b9311b).reset_after_fork: no upstream PR needed, fsspec master already fixed it (reset_lock()); not in a release yet (2026.9.0 still has it).Still open before merging: the Windows job fails (70 tests, all
LocalFS: get/put/copy conformance and the free-threading stress tests).Not in this PR: plan Step 7 and later (rewiring existing modules).
🤖 Generated with Claude Code