swarmauri_gitfilter_s3fs 0.3.0.dev46__tar.gz → 0.11.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.
@@ -0,0 +1,7 @@
1
+ swarmauri_gitfilter_s3fs
2
+
3
+ Distribution: swarmauri_gitfilter_s3fs
4
+ Repository: https://github.com/swarmauri/swarmauri-sdk
5
+
6
+ Author attribution: Jacob Stewart.
7
+ Licensed under Apache-2.0; see LICENSE.
@@ -0,0 +1,409 @@
1
+ Metadata-Version: 2.4
2
+ Name: swarmauri_gitfilter_s3fs
3
+ Version: 0.11.0
4
+ Summary: S3 git filter for Peagen using s3fs
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ License-File: NOTICE
8
+ Keywords: swarmauri,sdk,standards,gitfilter,s3fs
9
+ Author: Jacob Stewart
10
+ Author-email: jacob@swarmauri.com
11
+ Requires-Python: >=3.10,<3.15
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Requires-Dist: s3fs
22
+ Requires-Dist: swarmauri_base
23
+ Requires-Dist: swarmauri_core
24
+ Requires-Dist: swarmauri_standard
25
+ Description-Content-Type: text/markdown
26
+
27
+ # swarmauri_gitfilter_s3fs
28
+
29
+ <!-- readme-standards:begin branding -->
30
+ <p align="center"><a href="https://github.com/swarmauri/swarmauri-sdk"><img src="https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri.brand.theme.svg" alt="Swarmauri SDK" width="300"></a></p>
31
+ <p align="center"><strong>swarmauri_gitfilter_s3fs</strong></p>
32
+ <p align="center">S3 git filter for Peagen using s3fs</p>
33
+ <p align="center">
34
+ <a href="https://pypi.org/project/swarmauri_gitfilter_s3fs/"><img alt="pypi: swarmauri_gitfilter_s3fs" src="https://img.shields.io/pypi/v/swarmauri_gitfilter_s3fs?labelColor=1E293B&amp;color=1D4ED8"></a>
35
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/pyproject.toml"><img alt="Source version: 0.11.0" src="https://img.shields.io/static/v1?label=Source%20version&amp;message=0.11.0&amp;labelColor=1E293B&amp;color=4338CA"></a>
36
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/pyproject.toml"><img alt="Python: &gt;=3.10,&lt;3.15" src="https://img.shields.io/static/v1?label=Python&amp;message=%3E%3D3.10%2C%3C3.15&amp;labelColor=1E293B&amp;color=0F766E"></a>
37
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/pyproject.toml"><img alt="Layer: standards" src="https://img.shields.io/static/v1?label=Layer&amp;message=standards&amp;labelColor=1E293B&amp;color=6D28D9"></a>
38
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/README.md#lifecycle-and-migration"><img alt="Lifecycle: active" src="https://img.shields.io/static/v1?label=Lifecycle&amp;message=active&amp;labelColor=1E293B&amp;color=166534"></a>
39
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/static/v1?label=License&amp;message=Apache-2.0&amp;labelColor=1E293B&amp;color=86198F"></a>
40
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/NOTICE"><img alt="Notice: attribution" src="https://img.shields.io/static/v1?label=Notice&amp;message=attribution&amp;labelColor=1E293B&amp;color=86198F"></a>
41
+ </p>
42
+ <p align="center">
43
+ <a href="https://pypi.org/project/swarmauri_gitfilter_s3fs/"><img alt="Monthly PyPI downloads: swarmauri_gitfilter_s3fs" src="https://img.shields.io/pypi/dm/swarmauri_gitfilter_s3fs?labelColor=1E293B&amp;color=0E7490"></a>
44
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/README.md"><img alt="README hits: swarmauri_gitfilter_s3fs" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/pkgs/40-standards/swarmauri_gitfilter_s3fs/README.md.svg?label=README%20hits&amp;labelColor=1E293B&amp;color=0E7490"></a>
45
+ </p>
46
+ <p align="center">
47
+ <a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="README standards: CI gate" src="https://img.shields.io/static/v1?label=README%20standards&amp;message=CI%20gate&amp;labelColor=1E293B&amp;color=1D4ED8"></a>
48
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/tests/unit/test_readme_sources.py"><img alt="Tests: example source" src="https://img.shields.io/static/v1?label=Tests&amp;message=example%20source&amp;labelColor=1E293B&amp;color=0F766E"></a>
49
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/README.md#certification-status"><img alt="Certification: not certified" src="https://img.shields.io/static/v1?label=Certification&amp;message=not%20certified&amp;labelColor=1E293B&amp;color=92400E"></a>
50
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/tools/readme/POLICY.md"><img alt="Governance: repository policy" src="https://img.shields.io/static/v1?label=Governance&amp;message=repository%20policy&amp;labelColor=1E293B&amp;color=4338CA"></a>
51
+ <a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="Evidence: source and CI" src="https://img.shields.io/static/v1?label=Evidence&amp;message=source%20and%20CI&amp;labelColor=1E293B&amp;color=6D28D9"></a>
52
+ </p>
53
+ <p align="center"><a href="#overview">Overview</a> · <a href="#installation">Installation</a> · <a href="#quick-start">Quick Start</a> · <a href="#usage">Usage</a> · <a href="#public-api-and-import-surfaces">API</a> · <a href="#contributing">Contributing</a> · <a href="#governance">Governance</a> · <a href="#license">License</a></p>
54
+ <!-- readme-standards:end branding -->
55
+
56
+ ---
57
+
58
+ ## Overview
59
+
60
+ ### Summary
61
+
62
+ Git filter implementation for Peagen that streams artifacts to Amazon S3 (or
63
+ S3-compatible services) through ``s3fs``. The filter registers as a
64
+ ``StorageAdapter`` named ``S3FSFilter`` and supports the full git clean/smudge
65
+ cycle by delegating reads and writes to the configured S3 bucket.
66
+
67
+ ### Why This Package
68
+
69
+ `swarmauri_gitfilter_s3fs` isolates this responsibility: S3 git filter for Peagen using s3fs. Its [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/swarmauri_gitfilter_s3fs/__init__.py) exposes `S3FSFilter`, allowing consumers to select this package without treating adjacent packages as part of its public contract.
70
+
71
+ ### When to Use
72
+
73
+ Choose `swarmauri_gitfilter_s3fs` when your integration needs s3 git filter for Peagen using s3fs. Match the imports below to your application boundary and install its declared dependencies before using the example.
74
+
75
+ ### Features
76
+
77
+ - Implements :class:`~swarmauri_base.storage.StorageAdapterBase` and
78
+ :class:`~swarmauri_base.git_filters.GitFilterBase` to provide streaming
79
+ ``upload`` and ``download`` operations.
80
+ - Recursively uploads local directories via ``upload_dir`` and reconstructs
81
+ prefixes back onto disk with ``download_prefix``.
82
+ - Lists existing objects under a prefix with ``iter_prefix`` to back git
83
+ history reconstruction.
84
+ - Reads configuration from ``peagen.toml`` (``[storage.filters.s3fs]``) or the
85
+ ``AWS_*`` environment variables when instantiated through
86
+ :meth:`S3FSFilter.from_uri`.
87
+
88
+ ### Non-Goals
89
+
90
+ `swarmauri_gitfilter_s3fs` owns s3 git filter for Peagen using s3fs. Its imports do not by themselves configure credentials, deploy a service, or certify the behavior of its consumers. Dependencies and neighboring packages retain their own documented responsibilities.
91
+
92
+ ---
93
+
94
+ ## Getting Started
95
+
96
+ ### Prerequisites
97
+
98
+ Python `>=3.10,<3.15` is required. The [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/pyproject.toml) declares runtime dependencies including `swarmauri-core`, `swarmauri-base`, `swarmauri-standard`, `s3fs`. Read the example’s inputs and service requirements before execution.
99
+
100
+ ### Installation
101
+
102
+ Install the package with your preferred Python packaging tool:
103
+
104
+ ```bash
105
+ pip install swarmauri_gitfilter_s3fs
106
+ ```
107
+
108
+ ```bash
109
+ poetry add swarmauri_gitfilter_s3fs
110
+ ```
111
+
112
+ ```bash
113
+ uv pip install swarmauri_gitfilter_s3fs
114
+ ```
115
+
116
+ #### uv
117
+
118
+ <!-- readme-standards:begin installation.uv -->
119
+ ```bash
120
+ uv add swarmauri_gitfilter_s3fs
121
+ ```
122
+ <!-- readme-standards:end installation.uv -->
123
+
124
+ #### pip
125
+
126
+ <!-- readme-standards:begin installation.pip -->
127
+ ```bash
128
+ python -m pip install swarmauri_gitfilter_s3fs
129
+ ```
130
+ <!-- readme-standards:end installation.pip -->
131
+
132
+ #### Poetry
133
+
134
+ <!-- readme-standards:begin installation.poetry -->
135
+ ```bash
136
+ poetry add swarmauri_gitfilter_s3fs
137
+ ```
138
+ <!-- readme-standards:end installation.poetry -->
139
+
140
+ ### Quick Start
141
+
142
+ #### Example
143
+
144
+ <!-- readme-standards:begin example.quick-start -->
145
+ Source: [docs/readme/quick_start.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/docs/readme/quick_start.py).
146
+
147
+ ```python
148
+ from contextlib import nullcontext
149
+ from io import BytesIO
150
+ from unittest.mock import MagicMock, patch
151
+
152
+ from swarmauri_gitfilter_s3fs import S3FSFilter
153
+
154
+ with patch("swarmauri_gitfilter_s3fs.s3fs_filter.s3fs.S3FileSystem") as fs_cls:
155
+ fake_fs = MagicMock()
156
+ buffer = BytesIO()
157
+ fake_fs.open.return_value = nullcontext(buffer)
158
+ fs_cls.return_value = fake_fs
159
+
160
+ filt = S3FSFilter.from_uri("s3://demo-bucket/models")
161
+ location = filt.upload("artifacts/model.bin", BytesIO(b"model-weights"))
162
+
163
+ assert location == "s3://demo-bucket/models/artifacts/model.bin"
164
+ fake_fs.open.assert_called_with(
165
+ "demo-bucket/models/artifacts/model.bin",
166
+ "wb",
167
+ )
168
+ assert buffer.getvalue() == b"model-weights"
169
+ ```
170
+ <!-- readme-standards:end example.quick-start -->
171
+
172
+ #### Expected Result
173
+
174
+ The example demonstrates the documented `swarmauri_gitfilter_s3fs` source boundary or workflow. Complete its required configuration first. README CI checks the maintained source’s syntax and declarations; it does not claim that external services or the application workflow were exercised.
175
+
176
+ ---
177
+
178
+ ## Usage
179
+
180
+ ### Common Workflows
181
+
182
+ <!-- readme-standards:begin example.usage -->
183
+ Source: [docs/readme/usage.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/docs/readme/usage.py).
184
+
185
+ ```python
186
+ from contextlib import nullcontext
187
+ from io import BytesIO
188
+ from unittest.mock import MagicMock, patch
189
+
190
+ from swarmauri_gitfilter_s3fs import S3FSFilter
191
+
192
+ with patch("swarmauri_gitfilter_s3fs.s3fs_filter.s3fs.S3FileSystem") as fs_cls:
193
+ fake_fs = MagicMock()
194
+ buffer = BytesIO()
195
+ fake_fs.open.return_value = nullcontext(buffer)
196
+ fs_cls.return_value = fake_fs
197
+
198
+ filt = S3FSFilter.from_uri("s3://demo-bucket/models")
199
+ location = filt.upload("artifacts/model.bin", BytesIO(b"model-weights"))
200
+
201
+ assert location == "s3://demo-bucket/models/artifacts/model.bin"
202
+ fake_fs.open.assert_called_with(
203
+ "demo-bucket/models/artifacts/model.bin",
204
+ "wb",
205
+ )
206
+ assert buffer.getvalue() == b"model-weights"
207
+ ```
208
+ <!-- readme-standards:end example.usage -->
209
+
210
+ The example below patches ``s3fs`` with an in-memory stub so it can run without
211
+ network access. The logic mirrors how ``S3FSFilter`` writes data to S3 and
212
+ returns the URI of the uploaded object.
213
+
214
+
215
+ In a production workflow you do not need to patch ``s3fs`` ? instantiate the
216
+ filter with your credentials and bucket, then use ``clean``/``smudge`` or
217
+ ``upload``/``download`` to move artifacts between git and S3.
218
+
219
+ ### Configuration
220
+
221
+ Create the filter by supplying your bucket name and optional connection
222
+ parameters:
223
+
224
+ - ``bucket`` ? Target bucket name (required).
225
+ - ``prefix`` ? Optional key prefix to scope uploads.
226
+ - ``key`` / ``secret`` ? Credentials for the S3 endpoint. ``SecretStr``
227
+ instances are supported.
228
+ - ``endpoint_url`` ? Custom S3-compatible endpoint (useful for MinIO or
229
+ LocalStack).
230
+ - ``region_name`` ? Region for the endpoint.
231
+
232
+ When using :meth:`S3FSFilter.from_uri`, the URI sets the ``bucket`` and
233
+ ``prefix`` while credentials are loaded from ``peagen.toml`` at
234
+ ``[storage.filters.s3fs]`` (``key``, ``secret``, ``endpoint_url``, and
235
+ ``region``). Missing configuration falls back to
236
+ ``AWS_ACCESS_KEY_ID``, ``AWS_SECRET_ACCESS_KEY``, ``AWS_ENDPOINT_URL``, and
237
+ ``AWS_REGION`` respectively.
238
+
239
+ ### Error Handling
240
+
241
+ The inspected `swarmauri_gitfilter_s3fs` source raises `ValueError`. Handle these at the calling boundary and consult the implementation for the triggering conditions.
242
+
243
+ ### Best Practices
244
+
245
+ Use the explicit `swarmauri_gitfilter_s3fs` imports documented below and keep collaborator configuration with the caller. Run the package’s relevant tests after changing `S3FSFilter`; an import or successful installation alone does not establish its runtime guarantees.
246
+
247
+ ---
248
+
249
+ ## Package Boundary
250
+
251
+ ### What It Owns
252
+
253
+ `swarmauri_gitfilter_s3fs` is located in `standards` and owns s3 git filter for Peagen using s3fs. Source-declared APIs include `S3FSFilter`. The [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/pyproject.toml) records its direct dependency boundary.
254
+
255
+ ### Public API and Import Surfaces
256
+
257
+ Import namespace: `swarmauri_gitfilter_s3fs`.
258
+
259
+ Source-declared exports or types: `S3FSFilter`.
260
+
261
+ Inspect [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/swarmauri_gitfilter_s3fs/__init__.py) for exact signatures; this inventory does not designate every internal module as stable.
262
+
263
+ ### Entry Points
264
+
265
+ <!-- readme-standards:begin entry-points -->
266
+ - `peagen.plugins.git_filters` → `s3` → `swarmauri_gitfilter_s3fs.s3fs_filter:S3FSFilter`
267
+ - `swarmauri.git_filters` → `S3FSFilter` → `swarmauri_gitfilter_s3fs.s3fs_filter:S3FSFilter`
268
+ <!-- readme-standards:end entry-points -->
269
+
270
+ ### Injected Dependencies
271
+
272
+ The direct installation dependencies of `swarmauri_gitfilter_s3fs` are `swarmauri-core`, `swarmauri-base`, `swarmauri-standard`, `s3fs`. These declarations do not imply automatic provider selection. Pass collaborators through the explicit constructors or call signatures in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/swarmauri_gitfilter_s3fs/__init__.py).
273
+
274
+ ### Protocol Consumers
275
+
276
+ No direct package-manifest dependency on `swarmauri_gitfilter_s3fs` was found in the audited three-repository inventory. External consumers may still use its documented imports or commands.
277
+
278
+ ### Extensions
279
+
280
+ For `swarmauri_gitfilter_s3fs`, use the source-declared public interfaces (`S3FSFilter`) when composing or extending behavior. Its entry-point section below is authoritative for registered plugins; no additional extension loader is inferred from the package name.
281
+
282
+ ---
283
+
284
+ ## Operations and Readiness
285
+
286
+ ### Operational Requirements
287
+
288
+ Operate `swarmauri_gitfilter_s3fs` according to its actual entry points and collaborators. The dependency and Python requirements in the [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/pyproject.toml) are prerequisites; deployment topology, credentials, and readiness remain the responsibility of the consuming application unless explicitly documented above.
289
+
290
+ ### Health and Observability
291
+
292
+ This README does not establish a standalone health endpoint for `swarmauri_gitfilter_s3fs`. Observe the concrete caller’s results, exceptions, and existing test reports. An application that embeds this package must define its own health and telemetry contract.
293
+
294
+ ### Security and Resource Limits
295
+
296
+ Apply the input, credential, and resource constraints implemented in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/swarmauri_gitfilter_s3fs/__init__.py). The `swarmauri_gitfilter_s3fs` README gate is a documentation check, not a security review or a substitute for the implementation’s limits and caller authorization.
297
+
298
+ ### Compatibility
299
+
300
+ This source version of `swarmauri_gitfilter_s3fs` declares Python `>=3.10,<3.15`. Consult its dependency constraints before upgrading. Source-version and registry-version badges have separate meanings; this migration makes no additional platform or interoperability certification claim.
301
+
302
+ ---
303
+
304
+ ## Verification
305
+
306
+ ### Tests
307
+
308
+ Run `python -m pytest tests/unit/test_readme_sources.py` from the `swarmauri_gitfilter_s3fs` package directory for the maintained example source checks (Python compilation and non-Python file presence). Existing package tests include:
309
+
310
+ - [tests/example/test_readme_example.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/tests/example/test_readme_example.py)
311
+ - [tests/i9n/test_i9n__init__.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/tests/i9n/test_i9n__init__.py)
312
+ - [tests/unit/test_s3fs_filter.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/tests/unit/test_s3fs_filter.py)
313
+
314
+ The repository README gate also checks the required heading tree, metadata, managed fragments, and referenced files.
315
+
316
+ ### Certification Status
317
+
318
+ No external certification is asserted for `swarmauri_gitfilter_s3fs` by this documentation migration. README conformance, example syntax, runtime tests, and protocol or security certification are distinct evidence scopes.
319
+
320
+ ### Evidence
321
+
322
+ The [README standards CI](https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml) records mechanical documentation results for its tested commit. The [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/swarmauri_gitfilter_s3fs/__init__.py) and example sources support the package-boundary description; external runtime behavior requires its own test evidence.
323
+
324
+ ---
325
+
326
+ ## FAQ
327
+
328
+ ### Why
329
+
330
+ **Why select this package?** `swarmauri_gitfilter_s3fs` provides s3 git filter for Peagen using s3fs; use its own API boundary rather than assuming neighboring packages are bundled or configured automatically.
331
+
332
+ ### How
333
+
334
+ **How do I start?** Install or synchronize the environment under Getting Started, follow the maintained example for `swarmauri_gitfilter_s3fs`, and consult [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/swarmauri_gitfilter_s3fs/__init__.py) for the exact types and signatures involved.
335
+
336
+ ### When
337
+
338
+ **When should I validate an upgrade?** Recheck `swarmauri_gitfilter_s3fs` whenever its source version, declared collaborators, configuration, or caller changes. Run relevant behavioral tests in addition to the README gate before promotion.
339
+
340
+ ---
341
+
342
+ ## Documentation and Related Packages
343
+
344
+ ### More Documentation
345
+
346
+ The [repository contribution guide](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md), [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/swarmauri_gitfilter_s3fs/__init__.py), and [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/pyproject.toml) provide the supporting context for `swarmauri_gitfilter_s3fs`. The [README policy](https://github.com/groupsum/readme-standards/blob/master/docs/outline.md) defines the common document structure.
347
+
348
+ ### Related Packages
349
+
350
+ - [swarmauri_base](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/20-bases/swarmauri_base/README.md): Reusable Swarmauri base classes, mixins, and dynamic Pydantic component models for composable intelligence infrastructure.
351
+ - [swarmauri_core](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/10-interfaces/swarmauri_core/README.md): Core interface contracts and shared types for Swarmauri composable intelligence infrastructure components.
352
+ - [swarmauri_standard](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/30-standard-kernel/swarmauri_standard/README.md): First-party Swarmauri standard components for agents, tools, parsers, vectors, model adapters, and composable intelligence workflows.
353
+
354
+ ### Project Links
355
+
356
+ <!-- readme-standards:begin project-links -->
357
+ - [pypi: swarmauri_gitfilter_s3fs](https://pypi.org/project/swarmauri_gitfilter_s3fs/)
358
+ <!-- readme-standards:end project-links -->
359
+
360
+ ---
361
+
362
+ ## Contributing
363
+
364
+ ### How to Contribute
365
+
366
+ If you want to contribute to swarmauri-sdk, read up on our
367
+ [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
368
+ that will help you get started.
369
+
370
+ ### Development Setup
371
+
372
+ Work from the `pkgs/40-standards/swarmauri_gitfilter_s3fs` checkout. Synchronize its declared development environment with uv, then run the relevant package tests and `python -m pytest tests/unit/test_readme_sources.py`. The repository’s dedicated README job installs `readme-standards==0.1.3` without resolving unrelated runtime packages.
373
+
374
+ ### Notes for Maintainers
375
+
376
+ Edit authored prose directly in this `swarmauri_gitfilter_s3fs` README. Update source examples in `docs/readme/`, then run `readme-standards render --root . --write` from the package directory and review the diff. Required headings and generated blocks come from package-guide-v1.
377
+
378
+ ---
379
+
380
+ ## Governance
381
+
382
+ ### Ownership and Decision Making
383
+
384
+ Changes to `swarmauri_gitfilter_s3fs` follow the maintainer review process of [swarmauri/swarmauri-sdk](https://github.com/swarmauri/swarmauri-sdk) and its contribution guide. Author attribution remains in the [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/pyproject.toml); this README does not assign new publishing or administrative authority.
385
+
386
+ ### Standards and Policies
387
+
388
+ `swarmauri_gitfilter_s3fs` follows the versioned [package-guide-v1 outline](https://github.com/groupsum/readme-standards/blob/master/docs/outline.md). All fixed headings, hierarchy, order, separators, and package-specific branding are checked by CI; reviewers assess the accuracy and usefulness of authored claims.
389
+
390
+ ### Lifecycle and Migration
391
+
392
+ The `swarmauri_gitfilter_s3fs` source version is `0.11.0`.
393
+
394
+ ---
395
+
396
+ ## License and Attribution
397
+
398
+ ### License
399
+
400
+ <!-- readme-standards:begin license -->
401
+ Licensed under `Apache-2.0`. See [LICENSE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/LICENSE).
402
+ <!-- readme-standards:end license -->
403
+
404
+ ### Notices
405
+
406
+ <!-- readme-standards:begin notices -->
407
+ See [NOTICE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/NOTICE) for attribution.
408
+ <!-- readme-standards:end notices -->
409
+
@@ -0,0 +1,382 @@
1
+ # swarmauri_gitfilter_s3fs
2
+
3
+ <!-- readme-standards:begin branding -->
4
+ <p align="center"><a href="https://github.com/swarmauri/swarmauri-sdk"><img src="https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri.brand.theme.svg" alt="Swarmauri SDK" width="300"></a></p>
5
+ <p align="center"><strong>swarmauri_gitfilter_s3fs</strong></p>
6
+ <p align="center">S3 git filter for Peagen using s3fs</p>
7
+ <p align="center">
8
+ <a href="https://pypi.org/project/swarmauri_gitfilter_s3fs/"><img alt="pypi: swarmauri_gitfilter_s3fs" src="https://img.shields.io/pypi/v/swarmauri_gitfilter_s3fs?labelColor=1E293B&amp;color=1D4ED8"></a>
9
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/pyproject.toml"><img alt="Source version: 0.11.0" src="https://img.shields.io/static/v1?label=Source%20version&amp;message=0.11.0&amp;labelColor=1E293B&amp;color=4338CA"></a>
10
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/pyproject.toml"><img alt="Python: &gt;=3.10,&lt;3.15" src="https://img.shields.io/static/v1?label=Python&amp;message=%3E%3D3.10%2C%3C3.15&amp;labelColor=1E293B&amp;color=0F766E"></a>
11
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/pyproject.toml"><img alt="Layer: standards" src="https://img.shields.io/static/v1?label=Layer&amp;message=standards&amp;labelColor=1E293B&amp;color=6D28D9"></a>
12
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/README.md#lifecycle-and-migration"><img alt="Lifecycle: active" src="https://img.shields.io/static/v1?label=Lifecycle&amp;message=active&amp;labelColor=1E293B&amp;color=166534"></a>
13
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/static/v1?label=License&amp;message=Apache-2.0&amp;labelColor=1E293B&amp;color=86198F"></a>
14
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/NOTICE"><img alt="Notice: attribution" src="https://img.shields.io/static/v1?label=Notice&amp;message=attribution&amp;labelColor=1E293B&amp;color=86198F"></a>
15
+ </p>
16
+ <p align="center">
17
+ <a href="https://pypi.org/project/swarmauri_gitfilter_s3fs/"><img alt="Monthly PyPI downloads: swarmauri_gitfilter_s3fs" src="https://img.shields.io/pypi/dm/swarmauri_gitfilter_s3fs?labelColor=1E293B&amp;color=0E7490"></a>
18
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/README.md"><img alt="README hits: swarmauri_gitfilter_s3fs" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/pkgs/40-standards/swarmauri_gitfilter_s3fs/README.md.svg?label=README%20hits&amp;labelColor=1E293B&amp;color=0E7490"></a>
19
+ </p>
20
+ <p align="center">
21
+ <a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="README standards: CI gate" src="https://img.shields.io/static/v1?label=README%20standards&amp;message=CI%20gate&amp;labelColor=1E293B&amp;color=1D4ED8"></a>
22
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/tests/unit/test_readme_sources.py"><img alt="Tests: example source" src="https://img.shields.io/static/v1?label=Tests&amp;message=example%20source&amp;labelColor=1E293B&amp;color=0F766E"></a>
23
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/README.md#certification-status"><img alt="Certification: not certified" src="https://img.shields.io/static/v1?label=Certification&amp;message=not%20certified&amp;labelColor=1E293B&amp;color=92400E"></a>
24
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/tools/readme/POLICY.md"><img alt="Governance: repository policy" src="https://img.shields.io/static/v1?label=Governance&amp;message=repository%20policy&amp;labelColor=1E293B&amp;color=4338CA"></a>
25
+ <a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="Evidence: source and CI" src="https://img.shields.io/static/v1?label=Evidence&amp;message=source%20and%20CI&amp;labelColor=1E293B&amp;color=6D28D9"></a>
26
+ </p>
27
+ <p align="center"><a href="#overview">Overview</a> · <a href="#installation">Installation</a> · <a href="#quick-start">Quick Start</a> · <a href="#usage">Usage</a> · <a href="#public-api-and-import-surfaces">API</a> · <a href="#contributing">Contributing</a> · <a href="#governance">Governance</a> · <a href="#license">License</a></p>
28
+ <!-- readme-standards:end branding -->
29
+
30
+ ---
31
+
32
+ ## Overview
33
+
34
+ ### Summary
35
+
36
+ Git filter implementation for Peagen that streams artifacts to Amazon S3 (or
37
+ S3-compatible services) through ``s3fs``. The filter registers as a
38
+ ``StorageAdapter`` named ``S3FSFilter`` and supports the full git clean/smudge
39
+ cycle by delegating reads and writes to the configured S3 bucket.
40
+
41
+ ### Why This Package
42
+
43
+ `swarmauri_gitfilter_s3fs` isolates this responsibility: S3 git filter for Peagen using s3fs. Its [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/swarmauri_gitfilter_s3fs/__init__.py) exposes `S3FSFilter`, allowing consumers to select this package without treating adjacent packages as part of its public contract.
44
+
45
+ ### When to Use
46
+
47
+ Choose `swarmauri_gitfilter_s3fs` when your integration needs s3 git filter for Peagen using s3fs. Match the imports below to your application boundary and install its declared dependencies before using the example.
48
+
49
+ ### Features
50
+
51
+ - Implements :class:`~swarmauri_base.storage.StorageAdapterBase` and
52
+ :class:`~swarmauri_base.git_filters.GitFilterBase` to provide streaming
53
+ ``upload`` and ``download`` operations.
54
+ - Recursively uploads local directories via ``upload_dir`` and reconstructs
55
+ prefixes back onto disk with ``download_prefix``.
56
+ - Lists existing objects under a prefix with ``iter_prefix`` to back git
57
+ history reconstruction.
58
+ - Reads configuration from ``peagen.toml`` (``[storage.filters.s3fs]``) or the
59
+ ``AWS_*`` environment variables when instantiated through
60
+ :meth:`S3FSFilter.from_uri`.
61
+
62
+ ### Non-Goals
63
+
64
+ `swarmauri_gitfilter_s3fs` owns s3 git filter for Peagen using s3fs. Its imports do not by themselves configure credentials, deploy a service, or certify the behavior of its consumers. Dependencies and neighboring packages retain their own documented responsibilities.
65
+
66
+ ---
67
+
68
+ ## Getting Started
69
+
70
+ ### Prerequisites
71
+
72
+ Python `>=3.10,<3.15` is required. The [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/pyproject.toml) declares runtime dependencies including `swarmauri-core`, `swarmauri-base`, `swarmauri-standard`, `s3fs`. Read the example’s inputs and service requirements before execution.
73
+
74
+ ### Installation
75
+
76
+ Install the package with your preferred Python packaging tool:
77
+
78
+ ```bash
79
+ pip install swarmauri_gitfilter_s3fs
80
+ ```
81
+
82
+ ```bash
83
+ poetry add swarmauri_gitfilter_s3fs
84
+ ```
85
+
86
+ ```bash
87
+ uv pip install swarmauri_gitfilter_s3fs
88
+ ```
89
+
90
+ #### uv
91
+
92
+ <!-- readme-standards:begin installation.uv -->
93
+ ```bash
94
+ uv add swarmauri_gitfilter_s3fs
95
+ ```
96
+ <!-- readme-standards:end installation.uv -->
97
+
98
+ #### pip
99
+
100
+ <!-- readme-standards:begin installation.pip -->
101
+ ```bash
102
+ python -m pip install swarmauri_gitfilter_s3fs
103
+ ```
104
+ <!-- readme-standards:end installation.pip -->
105
+
106
+ #### Poetry
107
+
108
+ <!-- readme-standards:begin installation.poetry -->
109
+ ```bash
110
+ poetry add swarmauri_gitfilter_s3fs
111
+ ```
112
+ <!-- readme-standards:end installation.poetry -->
113
+
114
+ ### Quick Start
115
+
116
+ #### Example
117
+
118
+ <!-- readme-standards:begin example.quick-start -->
119
+ Source: [docs/readme/quick_start.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/docs/readme/quick_start.py).
120
+
121
+ ```python
122
+ from contextlib import nullcontext
123
+ from io import BytesIO
124
+ from unittest.mock import MagicMock, patch
125
+
126
+ from swarmauri_gitfilter_s3fs import S3FSFilter
127
+
128
+ with patch("swarmauri_gitfilter_s3fs.s3fs_filter.s3fs.S3FileSystem") as fs_cls:
129
+ fake_fs = MagicMock()
130
+ buffer = BytesIO()
131
+ fake_fs.open.return_value = nullcontext(buffer)
132
+ fs_cls.return_value = fake_fs
133
+
134
+ filt = S3FSFilter.from_uri("s3://demo-bucket/models")
135
+ location = filt.upload("artifacts/model.bin", BytesIO(b"model-weights"))
136
+
137
+ assert location == "s3://demo-bucket/models/artifacts/model.bin"
138
+ fake_fs.open.assert_called_with(
139
+ "demo-bucket/models/artifacts/model.bin",
140
+ "wb",
141
+ )
142
+ assert buffer.getvalue() == b"model-weights"
143
+ ```
144
+ <!-- readme-standards:end example.quick-start -->
145
+
146
+ #### Expected Result
147
+
148
+ The example demonstrates the documented `swarmauri_gitfilter_s3fs` source boundary or workflow. Complete its required configuration first. README CI checks the maintained source’s syntax and declarations; it does not claim that external services or the application workflow were exercised.
149
+
150
+ ---
151
+
152
+ ## Usage
153
+
154
+ ### Common Workflows
155
+
156
+ <!-- readme-standards:begin example.usage -->
157
+ Source: [docs/readme/usage.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/docs/readme/usage.py).
158
+
159
+ ```python
160
+ from contextlib import nullcontext
161
+ from io import BytesIO
162
+ from unittest.mock import MagicMock, patch
163
+
164
+ from swarmauri_gitfilter_s3fs import S3FSFilter
165
+
166
+ with patch("swarmauri_gitfilter_s3fs.s3fs_filter.s3fs.S3FileSystem") as fs_cls:
167
+ fake_fs = MagicMock()
168
+ buffer = BytesIO()
169
+ fake_fs.open.return_value = nullcontext(buffer)
170
+ fs_cls.return_value = fake_fs
171
+
172
+ filt = S3FSFilter.from_uri("s3://demo-bucket/models")
173
+ location = filt.upload("artifacts/model.bin", BytesIO(b"model-weights"))
174
+
175
+ assert location == "s3://demo-bucket/models/artifacts/model.bin"
176
+ fake_fs.open.assert_called_with(
177
+ "demo-bucket/models/artifacts/model.bin",
178
+ "wb",
179
+ )
180
+ assert buffer.getvalue() == b"model-weights"
181
+ ```
182
+ <!-- readme-standards:end example.usage -->
183
+
184
+ The example below patches ``s3fs`` with an in-memory stub so it can run without
185
+ network access. The logic mirrors how ``S3FSFilter`` writes data to S3 and
186
+ returns the URI of the uploaded object.
187
+
188
+
189
+ In a production workflow you do not need to patch ``s3fs`` ? instantiate the
190
+ filter with your credentials and bucket, then use ``clean``/``smudge`` or
191
+ ``upload``/``download`` to move artifacts between git and S3.
192
+
193
+ ### Configuration
194
+
195
+ Create the filter by supplying your bucket name and optional connection
196
+ parameters:
197
+
198
+ - ``bucket`` ? Target bucket name (required).
199
+ - ``prefix`` ? Optional key prefix to scope uploads.
200
+ - ``key`` / ``secret`` ? Credentials for the S3 endpoint. ``SecretStr``
201
+ instances are supported.
202
+ - ``endpoint_url`` ? Custom S3-compatible endpoint (useful for MinIO or
203
+ LocalStack).
204
+ - ``region_name`` ? Region for the endpoint.
205
+
206
+ When using :meth:`S3FSFilter.from_uri`, the URI sets the ``bucket`` and
207
+ ``prefix`` while credentials are loaded from ``peagen.toml`` at
208
+ ``[storage.filters.s3fs]`` (``key``, ``secret``, ``endpoint_url``, and
209
+ ``region``). Missing configuration falls back to
210
+ ``AWS_ACCESS_KEY_ID``, ``AWS_SECRET_ACCESS_KEY``, ``AWS_ENDPOINT_URL``, and
211
+ ``AWS_REGION`` respectively.
212
+
213
+ ### Error Handling
214
+
215
+ The inspected `swarmauri_gitfilter_s3fs` source raises `ValueError`. Handle these at the calling boundary and consult the implementation for the triggering conditions.
216
+
217
+ ### Best Practices
218
+
219
+ Use the explicit `swarmauri_gitfilter_s3fs` imports documented below and keep collaborator configuration with the caller. Run the package’s relevant tests after changing `S3FSFilter`; an import or successful installation alone does not establish its runtime guarantees.
220
+
221
+ ---
222
+
223
+ ## Package Boundary
224
+
225
+ ### What It Owns
226
+
227
+ `swarmauri_gitfilter_s3fs` is located in `standards` and owns s3 git filter for Peagen using s3fs. Source-declared APIs include `S3FSFilter`. The [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/pyproject.toml) records its direct dependency boundary.
228
+
229
+ ### Public API and Import Surfaces
230
+
231
+ Import namespace: `swarmauri_gitfilter_s3fs`.
232
+
233
+ Source-declared exports or types: `S3FSFilter`.
234
+
235
+ Inspect [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/swarmauri_gitfilter_s3fs/__init__.py) for exact signatures; this inventory does not designate every internal module as stable.
236
+
237
+ ### Entry Points
238
+
239
+ <!-- readme-standards:begin entry-points -->
240
+ - `peagen.plugins.git_filters` → `s3` → `swarmauri_gitfilter_s3fs.s3fs_filter:S3FSFilter`
241
+ - `swarmauri.git_filters` → `S3FSFilter` → `swarmauri_gitfilter_s3fs.s3fs_filter:S3FSFilter`
242
+ <!-- readme-standards:end entry-points -->
243
+
244
+ ### Injected Dependencies
245
+
246
+ The direct installation dependencies of `swarmauri_gitfilter_s3fs` are `swarmauri-core`, `swarmauri-base`, `swarmauri-standard`, `s3fs`. These declarations do not imply automatic provider selection. Pass collaborators through the explicit constructors or call signatures in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/swarmauri_gitfilter_s3fs/__init__.py).
247
+
248
+ ### Protocol Consumers
249
+
250
+ No direct package-manifest dependency on `swarmauri_gitfilter_s3fs` was found in the audited three-repository inventory. External consumers may still use its documented imports or commands.
251
+
252
+ ### Extensions
253
+
254
+ For `swarmauri_gitfilter_s3fs`, use the source-declared public interfaces (`S3FSFilter`) when composing or extending behavior. Its entry-point section below is authoritative for registered plugins; no additional extension loader is inferred from the package name.
255
+
256
+ ---
257
+
258
+ ## Operations and Readiness
259
+
260
+ ### Operational Requirements
261
+
262
+ Operate `swarmauri_gitfilter_s3fs` according to its actual entry points and collaborators. The dependency and Python requirements in the [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/pyproject.toml) are prerequisites; deployment topology, credentials, and readiness remain the responsibility of the consuming application unless explicitly documented above.
263
+
264
+ ### Health and Observability
265
+
266
+ This README does not establish a standalone health endpoint for `swarmauri_gitfilter_s3fs`. Observe the concrete caller’s results, exceptions, and existing test reports. An application that embeds this package must define its own health and telemetry contract.
267
+
268
+ ### Security and Resource Limits
269
+
270
+ Apply the input, credential, and resource constraints implemented in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/swarmauri_gitfilter_s3fs/__init__.py). The `swarmauri_gitfilter_s3fs` README gate is a documentation check, not a security review or a substitute for the implementation’s limits and caller authorization.
271
+
272
+ ### Compatibility
273
+
274
+ This source version of `swarmauri_gitfilter_s3fs` declares Python `>=3.10,<3.15`. Consult its dependency constraints before upgrading. Source-version and registry-version badges have separate meanings; this migration makes no additional platform or interoperability certification claim.
275
+
276
+ ---
277
+
278
+ ## Verification
279
+
280
+ ### Tests
281
+
282
+ Run `python -m pytest tests/unit/test_readme_sources.py` from the `swarmauri_gitfilter_s3fs` package directory for the maintained example source checks (Python compilation and non-Python file presence). Existing package tests include:
283
+
284
+ - [tests/example/test_readme_example.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/tests/example/test_readme_example.py)
285
+ - [tests/i9n/test_i9n__init__.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/tests/i9n/test_i9n__init__.py)
286
+ - [tests/unit/test_s3fs_filter.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/tests/unit/test_s3fs_filter.py)
287
+
288
+ The repository README gate also checks the required heading tree, metadata, managed fragments, and referenced files.
289
+
290
+ ### Certification Status
291
+
292
+ No external certification is asserted for `swarmauri_gitfilter_s3fs` by this documentation migration. README conformance, example syntax, runtime tests, and protocol or security certification are distinct evidence scopes.
293
+
294
+ ### Evidence
295
+
296
+ The [README standards CI](https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml) records mechanical documentation results for its tested commit. The [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/swarmauri_gitfilter_s3fs/__init__.py) and example sources support the package-boundary description; external runtime behavior requires its own test evidence.
297
+
298
+ ---
299
+
300
+ ## FAQ
301
+
302
+ ### Why
303
+
304
+ **Why select this package?** `swarmauri_gitfilter_s3fs` provides s3 git filter for Peagen using s3fs; use its own API boundary rather than assuming neighboring packages are bundled or configured automatically.
305
+
306
+ ### How
307
+
308
+ **How do I start?** Install or synchronize the environment under Getting Started, follow the maintained example for `swarmauri_gitfilter_s3fs`, and consult [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/swarmauri_gitfilter_s3fs/__init__.py) for the exact types and signatures involved.
309
+
310
+ ### When
311
+
312
+ **When should I validate an upgrade?** Recheck `swarmauri_gitfilter_s3fs` whenever its source version, declared collaborators, configuration, or caller changes. Run relevant behavioral tests in addition to the README gate before promotion.
313
+
314
+ ---
315
+
316
+ ## Documentation and Related Packages
317
+
318
+ ### More Documentation
319
+
320
+ The [repository contribution guide](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md), [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/swarmauri_gitfilter_s3fs/__init__.py), and [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/pyproject.toml) provide the supporting context for `swarmauri_gitfilter_s3fs`. The [README policy](https://github.com/groupsum/readme-standards/blob/master/docs/outline.md) defines the common document structure.
321
+
322
+ ### Related Packages
323
+
324
+ - [swarmauri_base](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/20-bases/swarmauri_base/README.md): Reusable Swarmauri base classes, mixins, and dynamic Pydantic component models for composable intelligence infrastructure.
325
+ - [swarmauri_core](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/10-interfaces/swarmauri_core/README.md): Core interface contracts and shared types for Swarmauri composable intelligence infrastructure components.
326
+ - [swarmauri_standard](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/30-standard-kernel/swarmauri_standard/README.md): First-party Swarmauri standard components for agents, tools, parsers, vectors, model adapters, and composable intelligence workflows.
327
+
328
+ ### Project Links
329
+
330
+ <!-- readme-standards:begin project-links -->
331
+ - [pypi: swarmauri_gitfilter_s3fs](https://pypi.org/project/swarmauri_gitfilter_s3fs/)
332
+ <!-- readme-standards:end project-links -->
333
+
334
+ ---
335
+
336
+ ## Contributing
337
+
338
+ ### How to Contribute
339
+
340
+ If you want to contribute to swarmauri-sdk, read up on our
341
+ [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
342
+ that will help you get started.
343
+
344
+ ### Development Setup
345
+
346
+ Work from the `pkgs/40-standards/swarmauri_gitfilter_s3fs` checkout. Synchronize its declared development environment with uv, then run the relevant package tests and `python -m pytest tests/unit/test_readme_sources.py`. The repository’s dedicated README job installs `readme-standards==0.1.3` without resolving unrelated runtime packages.
347
+
348
+ ### Notes for Maintainers
349
+
350
+ Edit authored prose directly in this `swarmauri_gitfilter_s3fs` README. Update source examples in `docs/readme/`, then run `readme-standards render --root . --write` from the package directory and review the diff. Required headings and generated blocks come from package-guide-v1.
351
+
352
+ ---
353
+
354
+ ## Governance
355
+
356
+ ### Ownership and Decision Making
357
+
358
+ Changes to `swarmauri_gitfilter_s3fs` follow the maintainer review process of [swarmauri/swarmauri-sdk](https://github.com/swarmauri/swarmauri-sdk) and its contribution guide. Author attribution remains in the [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/pyproject.toml); this README does not assign new publishing or administrative authority.
359
+
360
+ ### Standards and Policies
361
+
362
+ `swarmauri_gitfilter_s3fs` follows the versioned [package-guide-v1 outline](https://github.com/groupsum/readme-standards/blob/master/docs/outline.md). All fixed headings, hierarchy, order, separators, and package-specific branding are checked by CI; reviewers assess the accuracy and usefulness of authored claims.
363
+
364
+ ### Lifecycle and Migration
365
+
366
+ The `swarmauri_gitfilter_s3fs` source version is `0.11.0`.
367
+
368
+ ---
369
+
370
+ ## License and Attribution
371
+
372
+ ### License
373
+
374
+ <!-- readme-standards:begin license -->
375
+ Licensed under `Apache-2.0`. See [LICENSE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/LICENSE).
376
+ <!-- readme-standards:end license -->
377
+
378
+ ### Notices
379
+
380
+ <!-- readme-standards:begin notices -->
381
+ See [NOTICE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/NOTICE) for attribution.
382
+ <!-- readme-standards:end notices -->
@@ -1,26 +1,24 @@
1
1
  [project]
2
2
  name = "swarmauri_gitfilter_s3fs"
3
- version = "0.3.0.dev46"
4
- authors = [
5
- { name = "Jacob Stewart", email = "jacob@swarmauri.com" }
6
- ]
3
+ version = "0.11.0"
4
+ authors = [{ name = "Jacob Stewart", email = "jacob@swarmauri.com" }]
7
5
  description = "S3 git filter for Peagen using s3fs"
8
6
  readme = "README.md"
9
7
  license = "Apache-2.0"
10
8
  repository = "http://github.com/swarmauri/swarmauri-sdk"
11
- requires-python = ">=3.10,<3.13"
9
+ requires-python = ">=3.10,<3.15"
12
10
  classifiers = [
13
- "License :: OSI Approved :: Apache Software License",
11
+ "Operating System :: OS Independent",
12
+ "Programming Language :: Python",
14
13
  "Programming Language :: Python :: 3",
14
+ "Programming Language :: Python :: 3 :: Only",
15
15
  "Programming Language :: Python :: 3.10",
16
16
  "Programming Language :: Python :: 3.11",
17
17
  "Programming Language :: Python :: 3.12",
18
- "Operating System :: OS Independent",
19
- "Programming Language :: Python",
20
- "Programming Language :: Python :: 3 :: Only",
18
+ "Programming Language :: Python :: 3.13",
19
+ "Programming Language :: Python :: 3.14",
21
20
  ]
22
21
  dependencies = [
23
- "peagen",
24
22
  "swarmauri_core",
25
23
  "swarmauri_base",
26
24
  "swarmauri_standard",
@@ -33,13 +31,61 @@ keywords = [
33
31
  'gitfilter',
34
32
  's3fs',
35
33
  ]
34
+ license-files = ["LICENSE", "NOTICE"]
36
35
 
37
36
  [tool.uv.sources]
38
- peagen = { workspace = true }
39
37
  swarmauri_core = { workspace = true }
40
38
  swarmauri_base = { workspace = true }
41
39
  swarmauri_standard = { workspace = true }
42
40
 
41
+ [tool.readme_standards]
42
+ policy = "package-guide-v1"
43
+ readme = "README.md"
44
+ brand = "swarmauri"
45
+ brand_catalog = "../../../tools/readme/brands.toml"
46
+ repository = "https://github.com/swarmauri/swarmauri-sdk"
47
+ ref = "master"
48
+ package_path = "pkgs/40-standards/swarmauri_gitfilter_s3fs"
49
+ layer = "standards"
50
+ lifecycle = "active"
51
+ license_file = "LICENSE"
52
+ notice_file = "NOTICE"
53
+
54
+ [tool.readme_standards.distributions.pypi]
55
+ name = "swarmauri_gitfilter_s3fs"
56
+ published = true
57
+
58
+ [tool.readme_standards.examples.quick_start]
59
+ source = "docs/readme/quick_start.py"
60
+ test = "tests/unit/test_readme_sources.py"
61
+ language = "python"
62
+ expected_exit_code = 0
63
+
64
+ [tool.readme_standards.examples.usage]
65
+ source = "docs/readme/usage.py"
66
+ test = "tests/unit/test_readme_sources.py"
67
+ language = "python"
68
+ expected_exit_code = 0
69
+
70
+ [tool.readme_standards.statuses.readme]
71
+ label = "CI gate"
72
+ url = "https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"
73
+
74
+ [tool.readme_standards.statuses.tests]
75
+ label = "example source"
76
+ url = "https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/tests/unit/test_readme_sources.py"
77
+
78
+ [tool.readme_standards.statuses.certification]
79
+ label = "not certified"
80
+ url = "https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_gitfilter_s3fs/README.md#certification-status"
81
+
82
+ [tool.readme_standards.statuses.governance]
83
+ label = "repository policy"
84
+ url = "https://github.com/swarmauri/swarmauri-sdk/blob/master/tools/readme/POLICY.md"
85
+
86
+ [tool.readme_standards.statuses.evidence]
87
+ label = "source and CI"
88
+ url = "https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"
43
89
  [project.entry-points.'swarmauri.git_filters']
44
90
  S3FSFilter = "swarmauri_gitfilter_s3fs.s3fs_filter:S3FSFilter"
45
91
 
@@ -78,9 +124,10 @@ dev = [
78
124
  "pytest-xdist>=3.6.1",
79
125
  "pytest-json-report>=1.5.0",
80
126
  "python-dotenv",
81
- "requests>=2.32.3",
127
+ "httpx>=0.27",
82
128
  "flake8>=7.0",
83
129
  "pytest-timeout>=2.3.1",
84
130
  "ruff>=0.9.9",
85
131
  "pytest-benchmark>=4.0.0",
132
+ "readme-standards==0.1.3; python_version >= \"3.11\"",
86
133
  ]
@@ -3,9 +3,9 @@ from .s3fs_filter import S3FSFilter
3
3
  __all__ = ["S3FSFilter"]
4
4
 
5
5
  try: # pragma: no cover
6
- from importlib.metadata import version, PackageNotFoundError
6
+ from importlib.metadata import PackageNotFoundError, version
7
7
  except ImportError: # pragma: no cover
8
- from importlib_metadata import version, PackageNotFoundError
8
+ from importlib_metadata import PackageNotFoundError, version
9
9
 
10
10
  try: # pragma: no cover
11
11
  __version__ = version("swarmauri_gitfilter_s3fs")
@@ -6,12 +6,13 @@ from pathlib import Path
6
6
  from typing import BinaryIO
7
7
 
8
8
  import s3fs
9
+ from swarmauri_base.git_filters.config import (
10
+ load_filter_config as load_peagen_toml,
11
+ )
9
12
  from pydantic import SecretStr
10
-
11
- from peagen._utils.config_loader import load_peagen_toml
12
13
  from swarmauri_base.ComponentBase import ComponentBase
13
- from swarmauri_base.storage import StorageAdapterBase
14
14
  from swarmauri_base.git_filters import GitFilterBase
15
+ from swarmauri_base.storage import StorageAdapterBase
15
16
 
16
17
 
17
18
  @ComponentBase.register_type(StorageAdapterBase, "S3FSFilter")
@@ -31,10 +32,14 @@ class S3FSFilter(StorageAdapterBase, GitFilterBase):
31
32
  ) -> None:
32
33
  super().__init__(**kwargs)
33
34
  self._bucket = bucket
34
- self._prefix = prefix.lstrip("/")
35
+ self._prefix = self.normalize_prefix(prefix)
35
36
 
36
37
  k = key.get_secret_value() if isinstance(key, SecretStr) else key
37
- s = secret.get_secret_value() if isinstance(secret, SecretStr) else secret
38
+ s = (
39
+ secret.get_secret_value()
40
+ if isinstance(secret, SecretStr)
41
+ else secret
42
+ )
38
43
  client_kwargs: dict[str, str] = {}
39
44
  if endpoint_url:
40
45
  client_kwargs["endpoint_url"] = endpoint_url
@@ -49,9 +54,7 @@ class S3FSFilter(StorageAdapterBase, GitFilterBase):
49
54
  )
50
55
 
51
56
  def _full_key(self, key: str) -> str:
52
- key = key.lstrip("/")
53
- if self._prefix:
54
- key = f"{self._prefix.rstrip('/')}/{key}"
57
+ key = self.compose_key(self._prefix, key, allow_empty=True)
55
58
  return f"{self._bucket}/{key}"
56
59
 
57
60
  @property
@@ -61,10 +64,11 @@ class S3FSFilter(StorageAdapterBase, GitFilterBase):
61
64
  return uri.rstrip("/") + "/"
62
65
 
63
66
  def upload(self, key: str, data: BinaryIO) -> str:
67
+ normalized_key = self.normalize_key(key)
64
68
  dest = self._full_key(key)
65
69
  with self._fs.open(dest, "wb") as fh:
66
70
  shutil.copyfileobj(data, fh)
67
- return f"{self.root_uri}{key.lstrip('/')}"
71
+ return f"{self.root_uri}{normalized_key}"
68
72
 
69
73
  def download(self, key: str) -> BinaryIO:
70
74
  src = self._full_key(key)
@@ -75,7 +79,7 @@ class S3FSFilter(StorageAdapterBase, GitFilterBase):
75
79
  for path in base.rglob("*"):
76
80
  if path.is_file():
77
81
  rel = path.relative_to(base).as_posix()
78
- key = f"{prefix.rstrip('/')}/{rel}" if prefix else rel
82
+ key = self.compose_key(prefix, rel)
79
83
  with path.open("rb") as fh:
80
84
  self.upload(key, fh)
81
85
 
@@ -87,17 +91,19 @@ class S3FSFilter(StorageAdapterBase, GitFilterBase):
87
91
  rel = rel[len(self._prefix.rstrip("/")) + 1 :]
88
92
  yield rel
89
93
 
90
- def download_prefix(self, prefix: str, dest_dir: str | os.PathLike) -> None:
94
+ def download_prefix(
95
+ self, prefix: str, dest_dir: str | os.PathLike
96
+ ) -> None:
91
97
  dest = Path(dest_dir)
92
98
  for rel_key in self.iter_prefix(prefix):
93
- target = dest / rel_key
99
+ target = self.download_target_for_key(dest, rel_key)
94
100
  target.parent.mkdir(parents=True, exist_ok=True)
95
101
  data = self.download(rel_key)
96
102
  with target.open("wb") as fh:
97
103
  shutil.copyfileobj(data, fh)
98
104
 
99
105
  @classmethod
100
- def from_uri(cls, uri: str) -> "S3FSFilter":
106
+ def from_uri(cls, uri: str) -> S3FSFilter:
101
107
  from urllib.parse import urlparse
102
108
 
103
109
  p = urlparse(uri)
@@ -112,7 +118,9 @@ class S3FSFilter(StorageAdapterBase, GitFilterBase):
112
118
 
113
119
  key = s3_cfg.get("key") or os.getenv("AWS_ACCESS_KEY_ID", "")
114
120
  secret = s3_cfg.get("secret") or os.getenv("AWS_SECRET_ACCESS_KEY", "")
115
- endpoint_url = s3_cfg.get("endpoint_url") or os.getenv("AWS_ENDPOINT_URL")
121
+ endpoint_url = s3_cfg.get("endpoint_url") or os.getenv(
122
+ "AWS_ENDPOINT_URL"
123
+ )
116
124
  region = s3_cfg.get("region") or os.getenv("AWS_REGION")
117
125
 
118
126
  return cls(
@@ -1,142 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: swarmauri_gitfilter_s3fs
3
- Version: 0.3.0.dev46
4
- Summary: S3 git filter for Peagen using s3fs
5
- License-Expression: Apache-2.0
6
- License-File: LICENSE
7
- Keywords: swarmauri,sdk,standards,gitfilter,s3fs
8
- Author: Jacob Stewart
9
- Author-email: jacob@swarmauri.com
10
- Requires-Python: >=3.10,<3.13
11
- Classifier: License :: OSI Approved :: Apache Software License
12
- Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3.10
14
- Classifier: Programming Language :: Python :: 3.11
15
- Classifier: Programming Language :: Python :: 3.12
16
- Classifier: Operating System :: OS Independent
17
- Classifier: Programming Language :: Python
18
- Classifier: Programming Language :: Python :: 3 :: Only
19
- Requires-Dist: peagen
20
- Requires-Dist: s3fs
21
- Requires-Dist: swarmauri_base
22
- Requires-Dist: swarmauri_core
23
- Requires-Dist: swarmauri_standard
24
- Description-Content-Type: text/markdown
25
-
26
- ![Swarmauri Logo](https://github.com/swarmauri/swarmauri-sdk/blob/3d4d1cfa949399d7019ae9d8f296afba773dfb7f/assets/swarmauri.brand.theme.svg)
27
-
28
- <p align="center">
29
- <a href="https://pypi.org/project/swarmauri_gitfilter_s3fs/">
30
- <img src="https://img.shields.io/pypi/dm/swarmauri_gitfilter_s3fs" alt="PyPI - Downloads"/>
31
- </a>
32
- <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_gitfilter_s3fs/">
33
- <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_gitfilter_s3fs.svg"/>
34
- </a>
35
- <a href="https://pypi.org/project/swarmauri_gitfilter_s3fs/">
36
- <img src="https://img.shields.io/pypi/pyversions/swarmauri_gitfilter_s3fs" alt="PyPI - Python Version"/>
37
- </a>
38
- <a href="https://pypi.org/project/swarmauri_gitfilter_s3fs/">
39
- <img src="https://img.shields.io/pypi/l/swarmauri_gitfilter_s3fs" alt="PyPI - License"/>
40
- </a>
41
- <a href="https://pypi.org/project/swarmauri_gitfilter_s3fs/">
42
- <img src="https://img.shields.io/pypi/v/swarmauri_gitfilter_s3fs?label=swarmauri_gitfilter_s3fs&color=green" alt="PyPI - swarmauri_gitfilter_s3fs"/>
43
- </a>
44
- </p>
45
-
46
- ---
47
-
48
- # Swarmauri Git Filter S3FS
49
-
50
- Git filter implementation for Peagen that streams artifacts to Amazon S3 (or
51
- S3-compatible services) through ``s3fs``. The filter registers as a
52
- ``StorageAdapter`` named ``S3FSFilter`` and supports the full git clean/smudge
53
- cycle by delegating reads and writes to the configured S3 bucket.
54
-
55
- ## Features
56
-
57
- - Implements :class:`~swarmauri_base.storage.StorageAdapterBase` and
58
- :class:`~swarmauri_base.git_filters.GitFilterBase` to provide streaming
59
- ``upload`` and ``download`` operations.
60
- - Recursively uploads local directories via ``upload_dir`` and reconstructs
61
- prefixes back onto disk with ``download_prefix``.
62
- - Lists existing objects under a prefix with ``iter_prefix`` to back git
63
- history reconstruction.
64
- - Reads configuration from ``peagen.toml`` (``[storage.filters.s3fs]``) or the
65
- ``AWS_*`` environment variables when instantiated through
66
- :meth:`S3FSFilter.from_uri`.
67
-
68
- ## Installation
69
-
70
- Install the package with your preferred Python packaging tool:
71
-
72
- ```bash
73
- pip install swarmauri_gitfilter_s3fs
74
- ```
75
-
76
- ```bash
77
- poetry add swarmauri_gitfilter_s3fs
78
- ```
79
-
80
- ```bash
81
- uv pip install swarmauri_gitfilter_s3fs
82
- ```
83
-
84
- ## Configuration
85
-
86
- Create the filter by supplying your bucket name and optional connection
87
- parameters:
88
-
89
- - ``bucket`` – Target bucket name (required).
90
- - ``prefix`` – Optional key prefix to scope uploads.
91
- - ``key`` / ``secret`` – Credentials for the S3 endpoint. ``SecretStr``
92
- instances are supported.
93
- - ``endpoint_url`` – Custom S3-compatible endpoint (useful for MinIO or
94
- LocalStack).
95
- - ``region_name`` – Region for the endpoint.
96
-
97
- When using :meth:`S3FSFilter.from_uri`, the URI sets the ``bucket`` and
98
- ``prefix`` while credentials are loaded from ``peagen.toml`` at
99
- ``[storage.filters.s3fs]`` (``key``, ``secret``, ``endpoint_url``, and
100
- ``region``). Missing configuration falls back to
101
- ``AWS_ACCESS_KEY_ID``, ``AWS_SECRET_ACCESS_KEY``, ``AWS_ENDPOINT_URL``, and
102
- ``AWS_REGION`` respectively.
103
-
104
- ## Usage
105
-
106
- The example below patches ``s3fs`` with an in-memory stub so it can run without
107
- network access. The logic mirrors how ``S3FSFilter`` writes data to S3 and
108
- returns the URI of the uploaded object.
109
-
110
- ```python
111
- from contextlib import nullcontext
112
- from io import BytesIO
113
- from unittest.mock import MagicMock, patch
114
-
115
- from swarmauri_gitfilter_s3fs import S3FSFilter
116
-
117
- with patch("swarmauri_gitfilter_s3fs.s3fs_filter.s3fs.S3FileSystem") as fs_cls:
118
- fake_fs = MagicMock()
119
- buffer = BytesIO()
120
- fake_fs.open.return_value = nullcontext(buffer)
121
- fs_cls.return_value = fake_fs
122
-
123
- filt = S3FSFilter.from_uri("s3://demo-bucket/models")
124
- location = filt.upload("artifacts/model.bin", BytesIO(b"model-weights"))
125
-
126
- assert location == "s3://demo-bucket/models/artifacts/model.bin"
127
- fake_fs.open.assert_called_with(
128
- "demo-bucket/models/artifacts/model.bin",
129
- "wb",
130
- )
131
- assert buffer.getvalue() == b"model-weights"
132
- ```
133
-
134
- In a production workflow you do not need to patch ``s3fs`` – instantiate the
135
- filter with your credentials and bucket, then use ``clean``/``smudge`` or
136
- ``upload``/``download`` to move artifacts between git and S3.
137
-
138
- ## Want to help?
139
-
140
- If you want to contribute to swarmauri-sdk, read up on our
141
- [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
142
- that will help you get started.
@@ -1,117 +0,0 @@
1
- ![Swarmauri Logo](https://github.com/swarmauri/swarmauri-sdk/blob/3d4d1cfa949399d7019ae9d8f296afba773dfb7f/assets/swarmauri.brand.theme.svg)
2
-
3
- <p align="center">
4
- <a href="https://pypi.org/project/swarmauri_gitfilter_s3fs/">
5
- <img src="https://img.shields.io/pypi/dm/swarmauri_gitfilter_s3fs" alt="PyPI - Downloads"/>
6
- </a>
7
- <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_gitfilter_s3fs/">
8
- <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_gitfilter_s3fs.svg"/>
9
- </a>
10
- <a href="https://pypi.org/project/swarmauri_gitfilter_s3fs/">
11
- <img src="https://img.shields.io/pypi/pyversions/swarmauri_gitfilter_s3fs" alt="PyPI - Python Version"/>
12
- </a>
13
- <a href="https://pypi.org/project/swarmauri_gitfilter_s3fs/">
14
- <img src="https://img.shields.io/pypi/l/swarmauri_gitfilter_s3fs" alt="PyPI - License"/>
15
- </a>
16
- <a href="https://pypi.org/project/swarmauri_gitfilter_s3fs/">
17
- <img src="https://img.shields.io/pypi/v/swarmauri_gitfilter_s3fs?label=swarmauri_gitfilter_s3fs&color=green" alt="PyPI - swarmauri_gitfilter_s3fs"/>
18
- </a>
19
- </p>
20
-
21
- ---
22
-
23
- # Swarmauri Git Filter S3FS
24
-
25
- Git filter implementation for Peagen that streams artifacts to Amazon S3 (or
26
- S3-compatible services) through ``s3fs``. The filter registers as a
27
- ``StorageAdapter`` named ``S3FSFilter`` and supports the full git clean/smudge
28
- cycle by delegating reads and writes to the configured S3 bucket.
29
-
30
- ## Features
31
-
32
- - Implements :class:`~swarmauri_base.storage.StorageAdapterBase` and
33
- :class:`~swarmauri_base.git_filters.GitFilterBase` to provide streaming
34
- ``upload`` and ``download`` operations.
35
- - Recursively uploads local directories via ``upload_dir`` and reconstructs
36
- prefixes back onto disk with ``download_prefix``.
37
- - Lists existing objects under a prefix with ``iter_prefix`` to back git
38
- history reconstruction.
39
- - Reads configuration from ``peagen.toml`` (``[storage.filters.s3fs]``) or the
40
- ``AWS_*`` environment variables when instantiated through
41
- :meth:`S3FSFilter.from_uri`.
42
-
43
- ## Installation
44
-
45
- Install the package with your preferred Python packaging tool:
46
-
47
- ```bash
48
- pip install swarmauri_gitfilter_s3fs
49
- ```
50
-
51
- ```bash
52
- poetry add swarmauri_gitfilter_s3fs
53
- ```
54
-
55
- ```bash
56
- uv pip install swarmauri_gitfilter_s3fs
57
- ```
58
-
59
- ## Configuration
60
-
61
- Create the filter by supplying your bucket name and optional connection
62
- parameters:
63
-
64
- - ``bucket`` – Target bucket name (required).
65
- - ``prefix`` – Optional key prefix to scope uploads.
66
- - ``key`` / ``secret`` – Credentials for the S3 endpoint. ``SecretStr``
67
- instances are supported.
68
- - ``endpoint_url`` – Custom S3-compatible endpoint (useful for MinIO or
69
- LocalStack).
70
- - ``region_name`` – Region for the endpoint.
71
-
72
- When using :meth:`S3FSFilter.from_uri`, the URI sets the ``bucket`` and
73
- ``prefix`` while credentials are loaded from ``peagen.toml`` at
74
- ``[storage.filters.s3fs]`` (``key``, ``secret``, ``endpoint_url``, and
75
- ``region``). Missing configuration falls back to
76
- ``AWS_ACCESS_KEY_ID``, ``AWS_SECRET_ACCESS_KEY``, ``AWS_ENDPOINT_URL``, and
77
- ``AWS_REGION`` respectively.
78
-
79
- ## Usage
80
-
81
- The example below patches ``s3fs`` with an in-memory stub so it can run without
82
- network access. The logic mirrors how ``S3FSFilter`` writes data to S3 and
83
- returns the URI of the uploaded object.
84
-
85
- ```python
86
- from contextlib import nullcontext
87
- from io import BytesIO
88
- from unittest.mock import MagicMock, patch
89
-
90
- from swarmauri_gitfilter_s3fs import S3FSFilter
91
-
92
- with patch("swarmauri_gitfilter_s3fs.s3fs_filter.s3fs.S3FileSystem") as fs_cls:
93
- fake_fs = MagicMock()
94
- buffer = BytesIO()
95
- fake_fs.open.return_value = nullcontext(buffer)
96
- fs_cls.return_value = fake_fs
97
-
98
- filt = S3FSFilter.from_uri("s3://demo-bucket/models")
99
- location = filt.upload("artifacts/model.bin", BytesIO(b"model-weights"))
100
-
101
- assert location == "s3://demo-bucket/models/artifacts/model.bin"
102
- fake_fs.open.assert_called_with(
103
- "demo-bucket/models/artifacts/model.bin",
104
- "wb",
105
- )
106
- assert buffer.getvalue() == b"model-weights"
107
- ```
108
-
109
- In a production workflow you do not need to patch ``s3fs`` – instantiate the
110
- filter with your credentials and bucket, then use ``clean``/``smudge`` or
111
- ``upload``/``download`` to move artifacts between git and S3.
112
-
113
- ## Want to help?
114
-
115
- If you want to contribute to swarmauri-sdk, read up on our
116
- [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
117
- that will help you get started.