boto3-s3 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
boto3_s3-0.1.0/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may accept and charge a
167
+ fee for, or grant warranty, support, indemnity, or other liability
168
+ obligations and/or rights consistent with this License. However,
169
+ in accepting such obligations, You may act solely on Your own
170
+ behalf and on Your sole responsibility, not on behalf of any other
171
+ Contributor, and only if You agree to indemnify, defend, and hold
172
+ each Contributor harmless for any liability incurred by, or claims
173
+ asserted against, such Contributor by reason of your accepting any
174
+ such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Masanao Izumo
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,353 @@
1
+ Metadata-Version: 2.4
2
+ Name: boto3-s3
3
+ Version: 0.1.0
4
+ Summary: A Python library providing `aws s3` operations with a boto3-like API.
5
+ Keywords: aws,s3,boto3
6
+ Author: Masanao Izumo
7
+ Author-email: Masanao Izumo <ngc.izumo@gmail.com>
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
15
+ Classifier: Typing :: Typed
16
+ Requires-Dist: boto3>=1.28
17
+ Requires-Dist: s3transfer>=0.6.2
18
+ Requires-Dist: typing-extensions>=4.6
19
+ Requires-Dist: boto3[crt]>=1.28 ; extra == 'crt'
20
+ Requires-Python: >=3.10
21
+ Project-URL: Homepage, https://github.com/izumo-m/boto3-s3
22
+ Project-URL: Repository, https://github.com/izumo-m/boto3-s3
23
+ Project-URL: Documentation, https://github.com/izumo-m/boto3-s3#readme
24
+ Project-URL: Issues, https://github.com/izumo-m/boto3-s3/issues
25
+ Provides-Extra: crt
26
+ Description-Content-Type: text/markdown
27
+
28
+ # boto3-s3
29
+
30
+ A complete library version of the `aws s3` command, with a faithful `aws s3 sync`
31
+ at its core. Every subcommand — `cp` / `ls` / `mb` / `mv` / `presign` / `rb` /
32
+ `rm` / `sync` / `website` — runs in-process from Python, not by shelling out to
33
+ the CLI. Byte transfers run on the same `s3transfer` engine as `aws s3`, so
34
+ transfer performance keeps pace with the command.
35
+
36
+ Each command is a method on a single `S3` object, taking ordinary keyword
37
+ arguments; bring a boto3 client when you need a specific profile, region, or
38
+ endpoint.
39
+
40
+ **Status:** early development (pre-1.0) — all subcommands are implemented; the
41
+ public API may still change.
42
+ **Python:** 3.10+ · **License:** Apache-2.0
43
+
44
+ Two packages:
45
+
46
+ - **`boto3-s3`** — the library. Run `aws s3`-equivalent operations from Python
47
+ with your own boto3 clients and credentials.
48
+ - **`boto3-s3-cli`** — the `boto3-s3` command, a drop-in for `aws s3`
49
+ ([details](https://github.com/izumo-m/boto3-s3/blob/main/cli/README.md)).
50
+
51
+ ## Why
52
+
53
+ Much of `aws s3` is easy to do straight from boto3 — a one-off `cp` or `rm` is a
54
+ few lines, and recursive copies or multipart via `s3transfer` take only a bit
55
+ more effort. What's genuinely hard is matching `aws s3` faithfully: its path and
56
+ naming rules, recursive and include/exclude semantics, and above all a `sync` that
57
+ compares and transfers exactly like the command — fiddly to reproduce and easy to
58
+ get subtly wrong. The usual fallbacks are shelling out to the `aws s3` command and
59
+ parsing its output, or a partial reimplementation that drifts from it. boto3-s3 is
60
+ neither: it reproduces `aws s3`'s behavior across the whole command set — sync
61
+ included — as a library you call directly.
62
+
63
+ - **A faithful `aws s3 sync`.** Mirror local trees and buckets in any direction —
64
+ upload, download, or S3-to-S3 — with `--delete`, the same size/timestamp
65
+ comparison as aws-cli, include/exclude, and dry-run.
66
+ - **Every `aws s3` command.** `cp` / `ls` / `mb` / `mv` / `presign` / `rb` /
67
+ `rm` / `website` complete the set.
68
+ - **A library, not a CLI wrapper.** Runs in-process: no `subprocess`, no scraping
69
+ stdout, no `aws` on `PATH`. You pass boto3 clients directly and get structured,
70
+ per-item results back — not text to parse.
71
+ - **Light enough for a Lambda.** The Python runtime already ships boto3 (and its
72
+ `botocore` / `s3transfer` deps), so adding boto3-s3 costs well under a megabyte
73
+ for the full `aws s3` feature set in-process — where bundling aws-cli (250 MB+)
74
+ overruns the deployment size limit and shelling out isn't practical.
75
+ - **Transfer speed on par with aws-cli.** Byte transfers use the same engine as
76
+ `aws s3` (`s3transfer`, or the optional CRT engine), so large transfers run at
77
+ the same speed — no penalty for being a library.
78
+ - **Familiar behavior.** Path rules, options, and (for the CLI) exit codes
79
+ follow `aws s3`, so what you know from the command carries over.
80
+
81
+ ## Install
82
+
83
+ ```bash
84
+ pip install boto3-s3 # the library
85
+ pip install boto3-s3-cli # the `boto3-s3` command (also installs boto3-s3)
86
+ ```
87
+
88
+ Optional extra — the AWS Common Runtime (CRT) transfer engine and CRT-family
89
+ checksums:
90
+
91
+ ```bash
92
+ pip install "boto3-s3[crt]"
93
+ ```
94
+
95
+ ## Quick start
96
+
97
+ Create the `S3` object once — it holds no connection of its own (nothing to
98
+ close) and is safe to share across threads — then call what you need:
99
+
100
+ ```python
101
+ from boto3_s3 import S3
102
+
103
+ s3 = S3()
104
+
105
+ # Sync a directory tree up to S3, removing remote extras (mirror).
106
+ s3.sync("./site", "s3://my-bucket/site/", delete=True)
107
+
108
+ # Copy a single object up or down.
109
+ s3.cp("./report.csv", "s3://my-bucket/report.csv")
110
+ s3.cp("s3://my-bucket/report.csv", "./report.csv")
111
+
112
+ # List objects lazily; each item is a FileInfo (key, size, …).
113
+ for info in s3.ls("s3://my-bucket/site/", recursive=True):
114
+ print(info.key, info.size)
115
+
116
+ # Delete everything under a prefix.
117
+ s3.rm("s3://my-bucket/tmp/", recursive=True)
118
+
119
+ # A presigned URL (no request is sent).
120
+ url = s3.presign("s3://my-bucket/report.csv", expires_in=900)
121
+ ```
122
+
123
+ For `cp` / `mv` / `sync` the **direction is inferred from the two endpoints**:
124
+ local-to-S3 is an upload, S3-to-local a download, S3-to-S3 a copy. A
125
+ local-to-local pair is rejected, like `aws s3`.
126
+
127
+ ## Sync
128
+
129
+ `sync` is the heart of the library — a faithful re-creation of `aws s3 sync`,
130
+ callable from Python, in every direction:
131
+
132
+ ```python
133
+ s3.sync("./site", "s3://my-bucket/site/") # upload
134
+ s3.sync("s3://my-bucket/site/", "./site") # download
135
+ s3.sync("s3://src/data/", "s3://dst/data/") # S3-to-S3
136
+ ```
137
+
138
+ It supports the flags you know from the command:
139
+
140
+ - **`delete=True`** — remove destination entries the source no longer has. Items
141
+ hidden by a filter stay out of deletion too, exactly like `aws s3 sync`.
142
+ - **`copy_filter=`** — how the source and destination are compared:
143
+ `DefaultCopyFilter(size_only=True)` / `(exact_timestamps=True)` tune the
144
+ default; `True` copies everything, `False` copies nothing.
145
+ - **`filter=`** — include/exclude matching; **`dryrun=True`** to
146
+ preview every transfer and deletion first.
147
+
148
+ Because it runs in-process, sync hands back **structured results that `aws s3`
149
+ can't**: `on_result` fires once per item as the run proceeds, so you know exactly
150
+ what changed without parsing any output. Each result carries a `kind`
151
+ (upload / download / copy / delete) and an `outcome`
152
+ (succeeded / failed / warned / skipped):
153
+
154
+ ```python
155
+ from boto3_s3 import OpKind, OpOutcome
156
+
157
+ uploaded = []
158
+
159
+ def track(r):
160
+ if r.kind is OpKind.UPLOAD and r.outcome is OpOutcome.SUCCEEDED:
161
+ uploaded.append(r.key)
162
+
163
+ s3.sync("./site", "s3://my-bucket/site/", delete=True, on_result=track)
164
+ print(f"{len(uploaded)} files uploaded")
165
+ ```
166
+
167
+ ## Operations
168
+
169
+ `S3` is the entry point: create one with `s3 = S3()`, then call the methods
170
+ below — each mirrors an `aws s3` subcommand.
171
+
172
+ | Method | `aws s3` | What it does |
173
+ | --- | --- | --- |
174
+ | `ls(target="s3://", *, recursive, page_size, request_payer, bucket_name_prefix, bucket_region)` | `ls` | List objects and common prefixes under an S3 target — or, at the bare service root, every bucket. Returns a lazy `Iterator[FileInfo]`. |
175
+ | `cp(src, dst, *, recursive, filter, dryrun, …, **options)` | `cp` | Copy bytes (upload / download / S3-to-S3 copy). `src` / `dst` may be a path/URI or a binary stream for streaming. |
176
+ | `mv(src, dst, *, recursive, …, **options)` | `mv` | `cp`, then delete each source once its copy succeeds. |
177
+ | `sync(src, dst, *, delete, filter, copy_filter, …, **options)` | `sync` | Recursively synchronize `src` into `dst`. |
178
+ | `rm(target, *, recursive, filter, dryrun, request_payer, …)` | `rm` | Delete objects (a single key, a recursive prefix, or the folder-marker sweep). |
179
+ | `mb(target, *, tags)` | `mb` | Create the bucket of `target`. |
180
+ | `rb(target)` | `rb` | Delete the (empty) bucket of `target`. |
181
+ | `presign(target, *, expires_in=3600, method="get_object")` | `presign` | Return a presigned URL. No request is sent. |
182
+ | `website(target, *, index_document, error_document)` | `website` | Set the bucket website configuration. |
183
+
184
+ ## Choosing the client (profile, region, endpoint, cross-account)
185
+
186
+ A path argument is a `str`, an `os.PathLike`, or an `S3Storage`. A bare
187
+ `"s3://..."` string uses a default `boto3.client("s3")`.
188
+
189
+ To pick a specific **profile, region, or endpoint** (e.g. MinIO), or a
190
+ **second account** for an S3-to-S3 copy, build the client yourself and wrap the
191
+ URL in an `S3Storage`:
192
+
193
+ ```python
194
+ import boto3
195
+ from boto3_s3 import S3, S3Storage
196
+
197
+ session = boto3.Session(profile_name="prod")
198
+ client = session.client("s3", region_name="eu-west-1")
199
+
200
+ s3 = S3()
201
+ s3.cp("./artifact.tar.gz", S3Storage("s3://prod-bucket/artifacts/", client=client))
202
+ ```
203
+
204
+ An S3-compatible endpoint such as MinIO is just a differently-built client:
205
+
206
+ ```python
207
+ minio = boto3.client(
208
+ "s3",
209
+ endpoint_url="http://localhost:9000",
210
+ aws_access_key_id="minioadmin",
211
+ aws_secret_access_key="minioadmin",
212
+ )
213
+ for info in S3().ls(S3Storage("s3://bucket/", client=minio)):
214
+ print(info.key)
215
+ ```
216
+
217
+ A cross-account S3-to-S3 copy uses one client per side:
218
+
219
+ ```python
220
+ s3.cp(
221
+ S3Storage("s3://src-bucket/data/", client=src_client),
222
+ S3Storage("s3://dst-bucket/data/", client=dst_client),
223
+ recursive=True,
224
+ )
225
+ ```
226
+
227
+ The bucket part of an S3 URI may also be an access-point ARN (plain or
228
+ Outposts), passed through as the `Bucket`, like `aws s3`.
229
+
230
+ ## Options
231
+
232
+ `cp` / `mv` / `sync` take the `aws s3` transfer options as snake_case keyword
233
+ arguments, grouped here by what they control:
234
+
235
+ - **Metadata & headers:** `metadata`, `metadata_directive`, `copy_props`,
236
+ `cache_control`, `content_type` / `content_disposition` / `content_encoding` /
237
+ `content_language`, `expires`, `website_redirect`, `guess_mime_type`
238
+ - **Access & storage class:** `acl`, `grants`, `storage_class`, `request_payer`
239
+ - **Encryption:** `sse`, `sse_kms_key_id`, `sse_c` / `sse_c_key` (and the
240
+ copy-source pair)
241
+ - **Integrity & write control:** `checksum_algorithm`, `checksum_mode`,
242
+ `no_overwrite`, `case_conflict`
243
+ - **Glacier:** `force_glacier_transfer` / `ignore_glacier_warnings`
244
+
245
+ ```python
246
+ s3.cp(
247
+ "./photo.jpg",
248
+ "s3://my-bucket/photo.jpg",
249
+ storage_class="STANDARD_IA",
250
+ content_type="image/jpeg",
251
+ metadata={"reviewed": "yes"},
252
+ acl="bucket-owner-full-control",
253
+ )
254
+ ```
255
+
256
+ Multipart tuning (thresholds, concurrency, bandwidth, the classic/CRT engine
257
+ choice) is a `TransferConfig` passed as `transfer_config=`; its defaults match
258
+ `aws s3`.
259
+
260
+ ## Filtering
261
+
262
+ `cp` / `mv` / `rm` / `sync` take a `filter=` that decides which items stay in the
263
+ operation. The common form is an `aws s3`-style include/exclude matcher (last
264
+ match wins, default-include):
265
+
266
+ ```python
267
+ from boto3_s3 import globsieve
268
+
269
+ keep = globsieve.compile([
270
+ globsieve.GlobPattern.exclude("*"),
271
+ globsieve.GlobPattern.include("*.tar.gz"),
272
+ ])
273
+ s3.cp("./build", "s3://artifacts/", recursive=True, filter=keep)
274
+ ```
275
+
276
+ `filter=` also accepts a plain `Callable[[FileInfo], bool]` for arbitrary
277
+ per-item gating. `sync` adds `copy_filter=` and `delete=` (`True` to remove all
278
+ extras, or a filter to remove only matching ones). The two filters answer
279
+ different questions: `filter=` decides **which items take part at all**, while
280
+ `copy_filter=` then decides, for each matched source/destination pair,
281
+ **whether it actually needs copying**.
282
+
283
+ ## Progress, results, cancellation, dry run
284
+
285
+ Batch operations stream their per-item outcomes instead of returning a list:
286
+
287
+ - `on_result(OpResult)` — fires once per item as the run proceeds. Each
288
+ `OpResult` carries a `kind` (upload / download / copy / delete) and an
289
+ `outcome` (succeeded / failed / warned / skipped). It is called from worker
290
+ threads, so keep it fast and non-raising.
291
+ - `on_progress(TransferProgress)` — byte-level transfer progress.
292
+ - `cancel_token` — a `CancelToken` whose `cancel()` cooperatively stops the run.
293
+ - `dryrun=True` — reports every would-be action without any mutating call.
294
+
295
+ ## Errors
296
+
297
+ Every failure is a `Boto3S3Error` subclass — catch the root to catch them all.
298
+
299
+ | Exception | Raised when |
300
+ | --- | --- |
301
+ | `Boto3S3Error` | Root of the hierarchy. Carries `operation` / `bucket` / `key`. |
302
+ | `ValidationError` | A supplied value, precondition, or path is invalid. |
303
+ | `ConfigurationError` | Credentials / region / profile / endpoint missing or unresolvable. |
304
+ | `NotFoundError` | The target does not exist (S3 404, local `FileNotFoundError`). |
305
+ | `AccessDeniedError` | Permission denied (S3 403, local `PermissionError`). |
306
+ | `TransportError` | Network or local I/O failure (connection, timeout, `OSError`). |
307
+ | `CancelledError` | Cancelled via `CancelToken`. |
308
+ | `BatchError` | Raised once at the end of a batch op (`cp -r` / `mv -r` / `rm -r` / `sync`) when at least one item failed. |
309
+
310
+ `BatchError` carries summary counts (`succeeded` / `failed` / `warned` /
311
+ `skipped` / `total`); the per-item detail arrives live through `on_result`.
312
+
313
+ ## Debug logging
314
+
315
+ `boto3` / `botocore` debug logs leak signed headers, signatures, and session
316
+ tokens. `set_stream_logger` mirrors `boto3.set_stream_logger` but redacts those
317
+ by default:
318
+
319
+ ```python
320
+ from boto3_s3 import set_stream_logger
321
+
322
+ set_stream_logger("botocore") # credentials masked unless mask_secrets=False
323
+ ```
324
+
325
+ ## Compatibility
326
+
327
+ - **Python:** 3.10 and later.
328
+ - **OS:** Linux, macOS, Windows (path-separator and case-sensitivity behavior is
329
+ matched to `aws s3` on each).
330
+ - **AWS SDK:** `boto3` >= 1.28, `botocore` >= 1.31, `s3transfer` >= 0.6.2. A few
331
+ options need a newer SDK and are simply unavailable below it rather than
332
+ emulated — conditional writes (`no_overwrite`), the `CRC64NVME` checksum, and
333
+ the `ls` bucket-name / bucket-region filters. CRT features need the `crt`
334
+ extra. Everything else works at the minimum.
335
+
336
+ ## In short
337
+
338
+ Every `aws s3` operation as an in-process Python call — no `subprocess`, no
339
+ stdout to scrape, structured per-item results back.
340
+
341
+ ## Contributing
342
+
343
+ Bug reports, questions, and ideas are welcome on the
344
+ [issue tracker](https://github.com/izumo-m/boto3-s3/issues). To work on the code,
345
+ [`CONTRIBUTING.md`](https://github.com/izumo-m/boto3-s3/blob/main/CONTRIBUTING.md)
346
+ covers local setup (uv), the test suite, and the coding and commit conventions.
347
+
348
+ ## License
349
+
350
+ Apache-2.0. See
351
+ [`LICENSE`](https://github.com/izumo-m/boto3-s3/blob/main/LICENSE).
352
+
353
+ Source and issues: <https://github.com/izumo-m/boto3-s3>.