swarmauri_gitfilter_s3fs 0.3.0.dev4__tar.gz → 0.3.0.dev32__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,142 @@
1
+ Metadata-Version: 2.4
2
+ Name: swarmauri_gitfilter_s3fs
3
+ Version: 0.3.0.dev32
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.
@@ -0,0 +1,117 @@
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.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "swarmauri_gitfilter_s3fs"
3
- version = "0.3.0.dev4"
3
+ version = "0.3.0.dev32"
4
4
  authors = [
5
5
  { name = "Jacob Stewart", email = "jacob@swarmauri.com" }
6
6
  ]
@@ -16,6 +16,8 @@ classifiers = [
16
16
  "Programming Language :: Python :: 3.11",
17
17
  "Programming Language :: Python :: 3.12",
18
18
  "Operating System :: OS Independent",
19
+ "Programming Language :: Python",
20
+ "Programming Language :: Python :: 3 :: Only",
19
21
  ]
20
22
  dependencies = [
21
23
  "peagen",
@@ -24,6 +26,13 @@ dependencies = [
24
26
  "swarmauri_standard",
25
27
  "s3fs",
26
28
  ]
29
+ keywords = [
30
+ 'swarmauri',
31
+ 'sdk',
32
+ 'standards',
33
+ 'gitfilter',
34
+ 's3fs',
35
+ ]
27
36
 
28
37
  [tool.uv.sources]
29
38
  peagen = { workspace = true }
@@ -49,6 +58,7 @@ markers = [
49
58
  "xfail: Expected failures",
50
59
  "acceptance: Acceptance tests",
51
60
  "perf: Performance tests that measure execution time and resource usage",
61
+ "example: Example usage tests",
52
62
  ]
53
63
  timeout = 300
54
64
  log_cli = true
@@ -1,61 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: swarmauri_gitfilter_s3fs
3
- Version: 0.3.0.dev4
4
- Summary: S3 git filter for Peagen using s3fs
5
- License: Apache-2.0
6
- Author: Jacob Stewart
7
- Author-email: jacob@swarmauri.com
8
- Requires-Python: >=3.10,<3.13
9
- Classifier: License :: OSI Approved :: Apache Software License
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.10
12
- Classifier: Programming Language :: Python :: 3.11
13
- Classifier: Programming Language :: Python :: 3.12
14
- Classifier: Operating System :: OS Independent
15
- Requires-Dist: peagen
16
- Requires-Dist: s3fs
17
- Requires-Dist: swarmauri_base
18
- Requires-Dist: swarmauri_core
19
- Requires-Dist: swarmauri_standard
20
- Description-Content-Type: text/markdown
21
-
22
- ![Swamauri Logo](https://res.cloudinary.com/dbjmpekvl/image/upload/v1730099724/Swarmauri-logo-lockup-2048x757_hww01w.png)
23
-
24
- <p align="center">
25
- <a href="https://pypi.org/project/swarmauri_gitfilter_s3fs/">
26
- <img src="https://img.shields.io/pypi/dm/swarmauri_gitfilter_s3fs" alt="PyPI - Downloads"/>
27
- </a>
28
- <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_gitfilter_s3fs/">
29
- <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_gitfilter_s3fs.svg"/>
30
- </a>
31
- <a href="https://pypi.org/project/swarmauri_gitfilter_s3fs/">
32
- <img src="https://img.shields.io/pypi/pyversions/swarmauri_gitfilter_s3fs" alt="PyPI - Python Version"/>
33
- </a>
34
- <a href="https://pypi.org/project/swarmauri_gitfilter_s3fs/">
35
- <img src="https://img.shields.io/pypi/l/swarmauri_gitfilter_s3fs" alt="PyPI - License"/>
36
- </a>
37
- <a href="https://pypi.org/project/swarmauri_gitfilter_s3fs/">
38
- <img src="https://img.shields.io/pypi/v/swarmauri_gitfilter_s3fs?label=swarmauri_gitfilter_s3fs&color=green" alt="PyPI - swarmauri_gitfilter_s3fs"/>
39
- </a>
40
- </p>
41
-
42
- ---
43
-
44
- # Swarmauri Git Filter S3FS
45
-
46
- S3 backed git filter for Peagen using ``s3fs``.
47
-
48
- ## Installation
49
-
50
- ```bash
51
- pip install swarmauri_gitfilter_s3fs
52
- ```
53
-
54
- ## Usage
55
-
56
- ```python
57
- from swarmauri_gitfilter_s3fs import S3FSFilter
58
-
59
- filt = S3FSFilter.from_uri("s3://bucket/path")
60
- ```
61
-
@@ -1,39 +0,0 @@
1
- ![Swamauri Logo](https://res.cloudinary.com/dbjmpekvl/image/upload/v1730099724/Swarmauri-logo-lockup-2048x757_hww01w.png)
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
- S3 backed git filter for Peagen using ``s3fs``.
26
-
27
- ## Installation
28
-
29
- ```bash
30
- pip install swarmauri_gitfilter_s3fs
31
- ```
32
-
33
- ## Usage
34
-
35
- ```python
36
- from swarmauri_gitfilter_s3fs import S3FSFilter
37
-
38
- filt = S3FSFilter.from_uri("s3://bucket/path")
39
- ```