Repository navigation
Description
Current scope (2026-12-01): after (a1) #1615 and before #1491 (a2); see the order decision. Earlier: scope (2026-11-29): bucket// writes the key /; see the decisions and the cross-track order, which take precedence over the text below.
Part of #1493 (defects 4 and 10 of the audit; decision 3). After #1491.
Current state (master 23e2a43)
The methods that act on one object disagree on a trailing slash:
s3://bucket/dir/ |
addresses |
|---|---|
cat_file, rm_file, touch, cp_file (destination), tags, metadata, xattrs, sign, non-recursive chmod |
the key dir/ |
pipe_file, put_file (through open), get_file |
the key dir |
So pipe_file("s3://bucket/dir/", b"x") writes dir, and cat_file("s3://bucket/dir/") then reads the marker dir/. docs/filesystem.md:343-351 documents the stripping; test_pipe_file_trailing_slash (GH-1037, tests/pyathena/filesystem/test_s3.py:4398) made pipe_file strip as open() does. s3fs 2026.9.0 addresses the key as written in all of these methods (split_path keeps the trailing slash).
bucket// is the bucket for the lookups and listings and the key / for the single-object methods. touch("bucket//") writes the key /, while docs/filesystem.md:727 says that a write to it raises ValueError; pipe_file and put_file raise.
Decided (maintainer, on #1493)
The single-object methods (cat_file, rm_file, touch, cp_file, pipe_file, put_file, get_file, tags, ACL, sign, metadata, xattrs) address the key as written. Lookups and listings, open() included, address dir. The batch methods keep fsspec's meaning of the slash.
Proposal
pipe_file,put_fileandget_filepass theS3Pathof Parse caller-supplied S3 paths with one parser in every filesystem method #1491's entry point to_open_path(), which already accepts one, instead of a stripped string; pipe_file() rejects compression for small values and uploads an empty object when a compressed write fails #1037's test changes.bucket//: one rule for the writes (touch,pipe_file,put_file, thecp_filedestination), settled in the PR, and the docs follow it.- Ranged
cat_fileof a marker (dir/) sizes the marker, notdir(s3.py:3873-3878), which today raisesFileNotFoundErrorfor a negative range; the docs change with it. docs/filesystem.md: one table of the three groups replaces the paragraphs at:343-351and:720-727.open("…/dir/", "wb")writingdirwhilepipe_filewritesdir/is stated.
The differential check of #1491 is rerun, with the rows of these methods as the intended differences.
Compatibility
Breaking for 5.0.0 (release note): a caller that passes dir/ to pipe_file, put_file or get_file addresses a different key. Master only.
Activity
laughingman7743 commentedon Nov 29, 2026
Decision on item 2 (maintainer, 2026-11-29, after consulting Codex and Fable 5.2): the single-object writes to
bucket//(touch,pipe_file,put_file, thecp_filedestination) write the key/, as the rule "the single-object methods address the key as written" gives.pipe_fileandput_filestop raising for it; the docs atdocs/filesystem.md:720-727change accordingly.State which single-object writes to bucket// write the key "/" (GH-1491)
laughingman7743 commentedon Nov 30, 2026
Decision (maintainer, 2026-12-01), for the 5.0.0 milestone: #1511 no longer waits for #1491 (a2).
pipe_file,put_fileandget_fileconvert their argument into anS3Pathonce, with (a1)'s protocol remover, and pass it to_open_path(), which already accepts anS3Path. That is the only part of (a2) that Address the key as written in the single-object methods, pipe_file, put_file and get_file included #1511 needs; the predecessors of (a2) (Run the aio batch operations with the sync failure policy (GH-1456) #1555, Share the single-object copy and copy every annotation of a committed destination (GH-1520) #1587, Decode the keys of URL-encoded listings in S3Core (GH-1529) #1599, Evict a missing bucket's cached entries, check mkdir() uncached, and keep max_paths entries (GH-1492) #1561) are merged.s3.pyedits run one at a time: Remove one protocol, s3:: included, from the paths of every method, and reject an S3Path version without a key (GH-1491) #1615 → Address the key as written in the single-object methods, pipe_file, put_file and get_file included #1511 → (a2).State which single-object writes to bucket// write the key "/" (GH-1491)
laughingman7743 commentedon Nov 30, 2026
Notes for this issue from #1491 (a1) (#1615, merged as 3597987). They are not decisions.
bucket//docs. Remove one protocol, s3:: included, from the paths of every method, and reject an S3Path version without a key (GH-1491) #1615 corrected the sentence indocs/filesystem.md("Bucket paths with a trailing double slash"). It now says thattouch()and the destination ofcp_file()write the key/, whilepipe_file()andput_file()raiseValueError. Item 2 of this issue (the decision in issuecomment-7253297419) still changespipe_file/put_fileand rewrites the section.cat_file()with a version (item 3). Since Remove one protocol, s3:: included, from the paths of every method, and reject an S3Path version without a key (GH-1491) #1615, a negative or empty range of a version given byversion_idis sized by the key as written, as a version in the path already was.cat_file("s3://bucket/dir/", start=-2, end=-1, version_id="v1")sendsHeadObject dir/ v1.test_cat_file_range_version_argument_ending_in_slashcovers it. Without a version, the range ofdir/is still sized through the stripped namedir, which is what item 3 changes.info("s3://bucket//", version_id="v1")raisesValueError(a bucket has no versions), whilecat_file()of the same arguments reads versionv1of the key/. This follows decision 3 of Settle one contract for caller-supplied S3 path strings #1493 (lookups stripbucket//to the bucket), andtest_info_version_of_bucketpins the lookup side. Keep it in mind when the docs table of the three groups is written.S3Pathproperty (see issuecomment-7284595087), so this issue mostly drops that property frompipe_file/put_file/get_file.pipe_file/put_file/get_filefordir/andbucket//as the expected differences.Separate the two ways of giving a version of bucket// in the docs (GH…
Repair the independent review findings of the key-as-written change (G…
Document and test the paired sources of get() as written (GH-1511)
laughingman7743 commentedon Dec 1, 2026
Decision (maintainer, 2026-12-01), for #1645, after consulting Codex and Claude Fable 5.2 (both recommended it):
get()with a list of sources paired with a list of destinations downloads each source at its key as written, asget_file(), pairedcopy()/mv(), fsspec and s3fs do:get(["s3://bucket/dir/"], ["out"])downloads the folder markerdir/, andget(["s3://bucket/dir"], ["out"])the objectdir. On master the first downloadeddir, becauseget_file()stripped the slash. Release note in Address the key as written in pipe_file, put_file and get_file (GH-1511) #1645./evicts the cached bucket listing, and pairedput()destinations are stripped whileput_file()and pairedcopy()write the key as written.Wrap the paragraph on trailing slashes (GH-1511)
Repair the follow-up review findings of the key-as-written change (GH…
Repair the second follow-up review findings of the key-as-written cha…
Name the trailing-slash cases of ls() and the paired lists exactly (G…
Qualify two trailing-slash statements of the docs (GH-1511)
Address the key as written in pipe_file, put_file and get_file (GH-1511)
Strip the single destination of the aio pipe() (GH-1511)
Separate the two ways of giving a version of bucket// in the docs (GH…
Repair the independent review findings of the key-as-written change (G…
Document and test the paired sources of get() as written (GH-1511)
Wrap the paragraph on trailing slashes (GH-1511)
Repair the follow-up review findings of the key-as-written change (GH…
Repair the second follow-up review findings of the key-as-written cha…
Name the trailing-slash cases of ls() and the paired lists exactly (G…
Qualify two trailing-slash statements of the docs (GH-1511)