swarmauri_gitfilter_minio 0.3.0.dev4__tar.gz → 0.3.0.dev33__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,119 @@
1
+ Metadata-Version: 2.4
2
+ Name: swarmauri_gitfilter_minio
3
+ Version: 0.3.0.dev33
4
+ Summary: MinIO git filter for Peagen
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ Keywords: swarmauri,sdk,standards,gitfilter,minio
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: minio
20
+ Requires-Dist: peagen
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_minio/">
30
+ <img src="https://img.shields.io/pypi/dm/swarmauri_gitfilter_minio" alt="PyPI - Downloads"/>
31
+ </a>
32
+ <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_gitfilter_minio/">
33
+ <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_gitfilter_minio.svg"/>
34
+ </a>
35
+ <a href="https://pypi.org/project/swarmauri_gitfilter_minio/">
36
+ <img src="https://img.shields.io/pypi/pyversions/swarmauri_gitfilter_minio" alt="PyPI - Python Version"/>
37
+ </a>
38
+ <a href="https://pypi.org/project/swarmauri_gitfilter_minio/">
39
+ <img src="https://img.shields.io/pypi/l/swarmauri_gitfilter_minio" alt="PyPI - License"/>
40
+ </a>
41
+ <a href="https://pypi.org/project/swarmauri_gitfilter_minio/">
42
+ <img src="https://img.shields.io/pypi/v/swarmauri_gitfilter_minio?label=swarmauri_gitfilter_minio&color=green" alt="PyPI - swarmauri_gitfilter_minio"/>
43
+ </a>
44
+ </p>
45
+
46
+ ---
47
+
48
+ # Swarmauri Git Filter Minio
49
+
50
+ `swarmauri_gitfilter_minio` packages the `MinioFilter` plugin used by
51
+ [`peagen`](https://pypi.org/project/peagen/) and other Swarmauri tooling to keep
52
+ large Git objects in MinIO (or any S3-compatible) storage instead of the local
53
+ repository. The filter implements both `StorageAdapterBase` and
54
+ `GitFilterBase`, so you can call it directly from Python code or register it as
55
+ a Git clean/smudge filter.
56
+
57
+ ### Highlights
58
+
59
+ - Accepts `minio://` (HTTP) and `minios://` (HTTPS) URIs and automatically
60
+ ensures the referenced bucket exists.
61
+ - Inherits `GitFilterBase`, giving you `clean` and `smudge` helpers that hash
62
+ content, upload it to remote storage, and hydrate it back into your working
63
+ tree on checkout.
64
+ - Provides convenience methods such as `upload_dir`, `iter_prefix`, and
65
+ `download_prefix` for whole directory trees in addition to single-file
66
+ transfers.
67
+ - Surfaces a `root_uri` property that reflects the bucket and optional prefix
68
+ derived from the connection string.
69
+
70
+ ## Installation
71
+
72
+ Choose the workflow that matches your project:
73
+
74
+ ```bash
75
+ # pip
76
+ pip install swarmauri_gitfilter_minio
77
+
78
+ # Poetry
79
+ poetry add swarmauri_gitfilter_minio
80
+
81
+ # uv
82
+ uv add swarmauri_gitfilter_minio
83
+ ```
84
+
85
+ ## Configuration
86
+
87
+ `MinioFilter.from_uri()` consults `peagen.toml` for credentials under
88
+ `[storage.filters.minio]` and falls back to the `MINIO_ACCESS_KEY` and
89
+ `MINIO_SECRET_KEY` environment variables when the configuration is absent. When
90
+ instantiated, the filter lazily creates the bucket identified by the URI and
91
+ stores objects beneath an optional prefix.
92
+
93
+ ## Usage
94
+
95
+ ```python
96
+ from swarmauri_gitfilter_minio import MinioFilter
97
+
98
+ # Create a filter from a connection string. The scheme `minios://` will use
99
+ # HTTPS while `minio://` uses plain HTTP.
100
+ filt = MinioFilter.from_uri("minio://localhost:9000/my-bucket/prefix")
101
+
102
+ # Upload a file and retrieve its URI
103
+ with open("README.md", "rb") as fh:
104
+ uri = filt.upload("docs/README.md", fh)
105
+
106
+ # Download the file back into memory
107
+ buffer = filt.download("docs/README.md")
108
+ data = buffer.read()
109
+ ```
110
+
111
+ `MinioFilter` also exposes helpers such as `upload_dir`, `iter_prefix`, and
112
+ `download_prefix` for working with entire directory trees.
113
+
114
+ ## Want to help?
115
+
116
+ If you want to contribute to swarmauri-sdk, read up on our
117
+ [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
118
+ that will help you get started.
119
+
@@ -0,0 +1,93 @@
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_minio/">
5
+ <img src="https://img.shields.io/pypi/dm/swarmauri_gitfilter_minio" alt="PyPI - Downloads"/>
6
+ </a>
7
+ <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_gitfilter_minio/">
8
+ <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_gitfilter_minio.svg"/>
9
+ </a>
10
+ <a href="https://pypi.org/project/swarmauri_gitfilter_minio/">
11
+ <img src="https://img.shields.io/pypi/pyversions/swarmauri_gitfilter_minio" alt="PyPI - Python Version"/>
12
+ </a>
13
+ <a href="https://pypi.org/project/swarmauri_gitfilter_minio/">
14
+ <img src="https://img.shields.io/pypi/l/swarmauri_gitfilter_minio" alt="PyPI - License"/>
15
+ </a>
16
+ <a href="https://pypi.org/project/swarmauri_gitfilter_minio/">
17
+ <img src="https://img.shields.io/pypi/v/swarmauri_gitfilter_minio?label=swarmauri_gitfilter_minio&color=green" alt="PyPI - swarmauri_gitfilter_minio"/>
18
+ </a>
19
+ </p>
20
+
21
+ ---
22
+
23
+ # Swarmauri Git Filter Minio
24
+
25
+ `swarmauri_gitfilter_minio` packages the `MinioFilter` plugin used by
26
+ [`peagen`](https://pypi.org/project/peagen/) and other Swarmauri tooling to keep
27
+ large Git objects in MinIO (or any S3-compatible) storage instead of the local
28
+ repository. The filter implements both `StorageAdapterBase` and
29
+ `GitFilterBase`, so you can call it directly from Python code or register it as
30
+ a Git clean/smudge filter.
31
+
32
+ ### Highlights
33
+
34
+ - Accepts `minio://` (HTTP) and `minios://` (HTTPS) URIs and automatically
35
+ ensures the referenced bucket exists.
36
+ - Inherits `GitFilterBase`, giving you `clean` and `smudge` helpers that hash
37
+ content, upload it to remote storage, and hydrate it back into your working
38
+ tree on checkout.
39
+ - Provides convenience methods such as `upload_dir`, `iter_prefix`, and
40
+ `download_prefix` for whole directory trees in addition to single-file
41
+ transfers.
42
+ - Surfaces a `root_uri` property that reflects the bucket and optional prefix
43
+ derived from the connection string.
44
+
45
+ ## Installation
46
+
47
+ Choose the workflow that matches your project:
48
+
49
+ ```bash
50
+ # pip
51
+ pip install swarmauri_gitfilter_minio
52
+
53
+ # Poetry
54
+ poetry add swarmauri_gitfilter_minio
55
+
56
+ # uv
57
+ uv add swarmauri_gitfilter_minio
58
+ ```
59
+
60
+ ## Configuration
61
+
62
+ `MinioFilter.from_uri()` consults `peagen.toml` for credentials under
63
+ `[storage.filters.minio]` and falls back to the `MINIO_ACCESS_KEY` and
64
+ `MINIO_SECRET_KEY` environment variables when the configuration is absent. When
65
+ instantiated, the filter lazily creates the bucket identified by the URI and
66
+ stores objects beneath an optional prefix.
67
+
68
+ ## Usage
69
+
70
+ ```python
71
+ from swarmauri_gitfilter_minio import MinioFilter
72
+
73
+ # Create a filter from a connection string. The scheme `minios://` will use
74
+ # HTTPS while `minio://` uses plain HTTP.
75
+ filt = MinioFilter.from_uri("minio://localhost:9000/my-bucket/prefix")
76
+
77
+ # Upload a file and retrieve its URI
78
+ with open("README.md", "rb") as fh:
79
+ uri = filt.upload("docs/README.md", fh)
80
+
81
+ # Download the file back into memory
82
+ buffer = filt.download("docs/README.md")
83
+ data = buffer.read()
84
+ ```
85
+
86
+ `MinioFilter` also exposes helpers such as `upload_dir`, `iter_prefix`, and
87
+ `download_prefix` for working with entire directory trees.
88
+
89
+ ## Want to help?
90
+
91
+ If you want to contribute to swarmauri-sdk, read up on our
92
+ [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
93
+ that will help you get started.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "swarmauri_gitfilter_minio"
3
- version = "0.3.0.dev4"
3
+ version = "0.3.0.dev33"
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
  "minio",
26
28
  ]
29
+ keywords = [
30
+ 'swarmauri',
31
+ 'sdk',
32
+ 'standards',
33
+ 'gitfilter',
34
+ 'minio',
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: Documentation-backed usage examples",
52
62
  ]
53
63
  timeout = 300
54
64
  log_cli = true
@@ -1,3 +1,5 @@
1
+ """Expose the :class:`~swarmauri_gitfilter_minio.minio_filter.MinioFilter` plugin."""
2
+
1
3
  from .minio_filter import MinioFilter
2
4
 
3
5
  __all__ = ["MinioFilter"]
@@ -1,3 +1,5 @@
1
+ """Storage adapter and Git filter backed by a MinIO or S3-compatible service."""
2
+
1
3
  from __future__ import annotations
2
4
 
3
5
  import io
@@ -18,7 +20,11 @@ from swarmauri_base.git_filters import GitFilterBase
18
20
 
19
21
  @ComponentBase.register_type(StorageAdapterBase, "MinioFilter")
20
22
  class MinioFilter(StorageAdapterBase, GitFilterBase):
21
- """Simple wrapper around the MinIO client for use with Peagen."""
23
+ """Interact with MinIO for storing Git objects.
24
+
25
+ Provides helpers to upload and download individual files or directory
26
+ trees, allowing Peagen to offload repository data to object storage.
27
+ """
22
28
 
23
29
  def __init__(
24
30
  self,
@@ -31,6 +37,18 @@ class MinioFilter(StorageAdapterBase, GitFilterBase):
31
37
  prefix: str = "",
32
38
  **kwargs,
33
39
  ) -> None:
40
+ """Create a new MinioFilter instance.
41
+
42
+ endpoint (str): Host and port of the MinIO service.
43
+ access_key (SecretStr): Access key credential.
44
+ secret_key (SecretStr): Secret key credential.
45
+ bucket (str): Bucket name to store objects in.
46
+ secure (bool): Use HTTPS when ``True``.
47
+ prefix (str): Optional path prefix inside the bucket.
48
+ **kwargs: Additional options forwarded to ``StorageAdapterBase``.
49
+
50
+ RETURNS (None): This method does not return anything.
51
+ """
34
52
  super().__init__(**kwargs)
35
53
  self._client = Minio(
36
54
  endpoint,
@@ -54,12 +72,24 @@ class MinioFilter(StorageAdapterBase, GitFilterBase):
54
72
 
55
73
  @property
56
74
  def root_uri(self) -> str:
75
+ """Return the root URI for the configured bucket and prefix.
76
+
77
+ RETURNS (str): Base MinIO URI ending with a trailing slash.
78
+ """
57
79
  scheme = "minios" if self._secure else "minio"
58
80
  base = f"{scheme}://{self._endpoint}/{self._bucket}"
59
81
  uri = f"{base}/{self._prefix.rstrip('/')}" if self._prefix else base
60
82
  return uri.rstrip("/") + "/"
61
83
 
62
84
  def upload(self, key: str, data: BinaryIO) -> str:
85
+ """Upload a binary stream to the bucket.
86
+
87
+ key (str): Destination object key.
88
+ data (BinaryIO): File-like object containing the data.
89
+
90
+ RETURNS (str): URI of the stored object.
91
+ RAISES (S3Error): If the upload fails.
92
+ """
63
93
  size: Optional[int] = None
64
94
  try:
65
95
  size = os.fstat(data.fileno()).st_size # type: ignore[attr-defined]
@@ -79,6 +109,13 @@ class MinioFilter(StorageAdapterBase, GitFilterBase):
79
109
  return f"{self.root_uri}{key.lstrip('/')}"
80
110
 
81
111
  def download(self, key: str) -> BinaryIO:
112
+ """Retrieve an object from the bucket.
113
+
114
+ key (str): Object key to fetch.
115
+
116
+ RETURNS (BinaryIO): Buffer containing the object data.
117
+ RAISES (FileNotFoundError): If the object cannot be found.
118
+ """
82
119
  try:
83
120
  resp = self._client.get_object(self._bucket, self._full_key(key))
84
121
  buffer = io.BytesIO(resp.read())
@@ -90,6 +127,13 @@ class MinioFilter(StorageAdapterBase, GitFilterBase):
90
127
  raise FileNotFoundError(f"{self._bucket}/{key}: {exc}") from exc
91
128
 
92
129
  def upload_dir(self, src: str | os.PathLike, *, prefix: str = "") -> None:
130
+ """Upload all files under a directory to the bucket.
131
+
132
+ src (str | os.PathLike): Local directory to walk.
133
+ prefix (str): Optional key prefix to prepend to uploaded objects.
134
+
135
+ RETURNS (None): This method does not return anything.
136
+ """
93
137
  base = Path(src)
94
138
  for path in base.rglob("*"):
95
139
  if path.is_file():
@@ -99,6 +143,12 @@ class MinioFilter(StorageAdapterBase, GitFilterBase):
99
143
  self.upload(key, fh)
100
144
 
101
145
  def iter_prefix(self, prefix: str):
146
+ """Iterate over object keys matching a prefix.
147
+
148
+ prefix (str): Key prefix to match.
149
+
150
+ RETURNS (Iterator[str]): Relative keys under the configured prefix.
151
+ """
102
152
  for obj in self._client.list_objects(
103
153
  self._bucket, prefix=prefix, recursive=True
104
154
  ):
@@ -108,6 +158,13 @@ class MinioFilter(StorageAdapterBase, GitFilterBase):
108
158
  yield key
109
159
 
110
160
  def download_prefix(self, prefix: str, dest_dir: str | os.PathLike) -> None:
161
+ """Download all objects beneath a prefix into a directory.
162
+
163
+ prefix (str): Key prefix to copy from the bucket.
164
+ dest_dir (str | os.PathLike): Local directory to populate.
165
+
166
+ RETURNS (None): This method does not return anything.
167
+ """
111
168
  dest = Path(dest_dir)
112
169
  for rel_key in self.iter_prefix(prefix):
113
170
  target = dest / rel_key
@@ -118,6 +175,12 @@ class MinioFilter(StorageAdapterBase, GitFilterBase):
118
175
 
119
176
  @classmethod
120
177
  def from_uri(cls, uri: str) -> "MinioFilter":
178
+ """Create a MinioFilter from a connection string.
179
+
180
+ uri (str): A URI like ``minio://host:port/bucket/prefix``.
181
+
182
+ RETURNS (MinioFilter): Configured ``MinioFilter`` instance.
183
+ """
121
184
  from urllib.parse import urlparse
122
185
 
123
186
  p = urlparse(uri)
@@ -1,61 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: swarmauri_gitfilter_minio
3
- Version: 0.3.0.dev4
4
- Summary: MinIO git filter for Peagen
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: minio
16
- Requires-Dist: peagen
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_minio/">
26
- <img src="https://img.shields.io/pypi/dm/swarmauri_gitfilter_minio" alt="PyPI - Downloads"/>
27
- </a>
28
- <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_gitfilter_minio/">
29
- <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_gitfilter_minio.svg"/>
30
- </a>
31
- <a href="https://pypi.org/project/swarmauri_gitfilter_minio/">
32
- <img src="https://img.shields.io/pypi/pyversions/swarmauri_gitfilter_minio" alt="PyPI - Python Version"/>
33
- </a>
34
- <a href="https://pypi.org/project/swarmauri_gitfilter_minio/">
35
- <img src="https://img.shields.io/pypi/l/swarmauri_gitfilter_minio" alt="PyPI - License"/>
36
- </a>
37
- <a href="https://pypi.org/project/swarmauri_gitfilter_minio/">
38
- <img src="https://img.shields.io/pypi/v/swarmauri_gitfilter_minio?label=swarmauri_gitfilter_minio&color=green" alt="PyPI - swarmauri_gitfilter_minio"/>
39
- </a>
40
- </p>
41
-
42
- ---
43
-
44
- # Swarmauri Git Filter Minio
45
-
46
- Git filter using MinIO or S3 compatible storage.
47
-
48
- ## Installation
49
-
50
- ```bash
51
- pip install swarmauri_gitfilter_minio
52
- ```
53
-
54
- ## Usage
55
-
56
- ```python
57
- from swarmauri_gitfilter_minio import MinioFilter
58
-
59
- filt = MinioFilter.from_uri("minio://localhost:9000/bucket")
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_minio/">
5
- <img src="https://img.shields.io/pypi/dm/swarmauri_gitfilter_minio" alt="PyPI - Downloads"/>
6
- </a>
7
- <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_gitfilter_minio/">
8
- <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_gitfilter_minio.svg"/>
9
- </a>
10
- <a href="https://pypi.org/project/swarmauri_gitfilter_minio/">
11
- <img src="https://img.shields.io/pypi/pyversions/swarmauri_gitfilter_minio" alt="PyPI - Python Version"/>
12
- </a>
13
- <a href="https://pypi.org/project/swarmauri_gitfilter_minio/">
14
- <img src="https://img.shields.io/pypi/l/swarmauri_gitfilter_minio" alt="PyPI - License"/>
15
- </a>
16
- <a href="https://pypi.org/project/swarmauri_gitfilter_minio/">
17
- <img src="https://img.shields.io/pypi/v/swarmauri_gitfilter_minio?label=swarmauri_gitfilter_minio&color=green" alt="PyPI - swarmauri_gitfilter_minio"/>
18
- </a>
19
- </p>
20
-
21
- ---
22
-
23
- # Swarmauri Git Filter Minio
24
-
25
- Git filter using MinIO or S3 compatible storage.
26
-
27
- ## Installation
28
-
29
- ```bash
30
- pip install swarmauri_gitfilter_minio
31
- ```
32
-
33
- ## Usage
34
-
35
- ```python
36
- from swarmauri_gitfilter_minio import MinioFilter
37
-
38
- filt = MinioFilter.from_uri("minio://localhost:9000/bucket")
39
- ```