Repository navigation
feat(files): colab upload/download -r (upstream #267) with its review applied - #22
Merged
Merged
Conversation
Add recursive directory transfer support to `colab upload` and `colab download` via the Jupyter Contents API and reuse a persistent requests.Session in ContentsClient for HTTP keep-alive. - Add ContentsClient.mkdir, _ensure_dir, upload_dir, and download_dir, preserving empty directories, skipping symlinks on upload, normalizing remote paths, and validating remote entry names, local canonical symlink/containment safety, and recursion depth - Support single-file download -r targets (including existing or trailing-slash local directories) and reject missing file content - Reuse a persistent requests.Session in ContentsClient with close()/context-manager cleanup (reopening a fresh client after $EDITOR in colab edit) and redact colab-runtime-proxy-token from HTTPError messages - Update README, design doc, and unit tests
… transfers Google's review of googlecolab#267 asked for these changes; the fork takes the PR before Google merges it, so it applies them here: - No `ntpath` import. A drive-prefixed entry name ("C:x") is still refused on Windows through os.path.splitdrive, which is ntpath there and a no-op elsewhere (on Windows "C:x" would have been written as "x"). - `posixpath.join` without the empty-path special cases. - `_is_local_symlink`: on POSIX islink("link/") is False because the slash resolves the link, so a symlinked destination given with a trailing slash was written through. - HTTP errors keep the fork's message without the URL, which carries the runtime proxy token. Tested live on a Colab web UI runtime: a tree with subfolders and an empty folder uploaded with -r and downloaded back identical. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
arlinamid
added a commit
that referenced
this pull request
Nov 20, 2026
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.
Takes upstream googlecolab#267 (
-r/--recursiveforcolab uploadandcolab download, by Koji Shukawa, kept as the commit author) before Google merges it, and applies the review comments from Google on it:ntpathimport; a drive-prefixed entry name is still refused on Windows viaos.path.splitdrive(the fork runs on Windows, whereC:xwould have been written asx);posixpath.join;_is_local_symlink: on POSIXislink("link/")is False, so a symlinked destination with a trailing slash was written through;Conflicts with the fork were resolved keeping the fork's behavior (token-free errors,
colab editcreating an empty file when the download fails); the fork's tests now patchrequests.Session.request, sinceContentsClientreuses one session.Tests: full suite 1337 passed. Live on a Colab web UI runtime: a tree with subfolders and an empty folder uploaded with
-rand downloaded back identical.🤖 Generated with Claude Code