swarmauri_gitfilter_s3fs 0.3.0.dev45__tar.gz → 0.11.0.dev1__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.
@@ -1,21 +1,23 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: swarmauri_gitfilter_s3fs
3
- Version: 0.3.0.dev45
3
+ Version: 0.11.0.dev1
4
4
  Summary: S3 git filter for Peagen using s3fs
5
5
  License-Expression: Apache-2.0
6
6
  License-File: LICENSE
7
7
  Keywords: swarmauri,sdk,standards,gitfilter,s3fs
8
8
  Author: Jacob Stewart
9
9
  Author-email: jacob@swarmauri.com
10
- Requires-Python: >=3.10,<3.13
10
+ Requires-Python: >=3.10,<3.15
11
11
  Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python
12
14
  Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
13
16
  Classifier: Programming Language :: Python :: 3.10
14
17
  Classifier: Programming Language :: Python :: 3.11
15
18
  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
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
19
21
  Requires-Dist: peagen
20
22
  Requires-Dist: s3fs
21
23
  Requires-Dist: swarmauri_base
@@ -23,27 +25,21 @@ Requires-Dist: swarmauri_core
23
25
  Requires-Dist: swarmauri_standard
24
26
  Description-Content-Type: text/markdown
25
27
 
26
- ![Swarmauri Logo](https://github.com/swarmauri/swarmauri-sdk/blob/3d4d1cfa949399d7019ae9d8f296afba773dfb7f/assets/swarmauri.brand.theme.svg)
28
+ ![Swarmauri Logo](https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri_sdk_brand.png)
27
29
 
28
30
  <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>
31
+ <a href="https://pepy.tech/project/swarmauri_gitfilter_s3fs/">
32
+ <img src="https://static.pepy.tech/badge/swarmauri_gitfilter_s3fs/month" alt="PyPI - Downloads"/></a>
32
33
  <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>
34
+ <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_gitfilter_s3fs.svg"/></a>
35
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>
36
+ <img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue" alt="PyPI - Python Version"/></a>
38
37
  <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>
38
+ <img src="https://img.shields.io/pypi/l/swarmauri_gitfilter_s3fs" alt="PyPI - License"/></a>
41
39
  <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
- ---
40
+ <img src="https://img.shields.io/pypi/v/swarmauri_gitfilter_s3fs?label=swarmauri_gitfilter_s3fs&color=green" alt="PyPI - swarmauri_gitfilter_s3fs"/></a>
41
+ <a href="https://discord.gg/N4UpBuQv8T">
42
+ <img src="https://img.shields.io/badge/Discord-Join%20Chat-5865F2?logo=discord&logoColor=white" alt="Discord"/></a></p>
47
43
 
48
44
  # Swarmauri Git Filter S3FS
49
45
 
@@ -86,13 +82,13 @@ uv pip install swarmauri_gitfilter_s3fs
86
82
  Create the filter by supplying your bucket name and optional connection
87
83
  parameters:
88
84
 
89
- - ``bucket`` – Target bucket name (required).
90
- - ``prefix`` – Optional key prefix to scope uploads.
91
- - ``key`` / ``secret`` – Credentials for the S3 endpoint. ``SecretStr``
85
+ - ``bucket`` ? Target bucket name (required).
86
+ - ``prefix`` ? Optional key prefix to scope uploads.
87
+ - ``key`` / ``secret`` ? Credentials for the S3 endpoint. ``SecretStr``
92
88
  instances are supported.
93
- - ``endpoint_url`` – Custom S3-compatible endpoint (useful for MinIO or
89
+ - ``endpoint_url`` ? Custom S3-compatible endpoint (useful for MinIO or
94
90
  LocalStack).
95
- - ``region_name`` – Region for the endpoint.
91
+ - ``region_name`` ? Region for the endpoint.
96
92
 
97
93
  When using :meth:`S3FSFilter.from_uri`, the URI sets the ``bucket`` and
98
94
  ``prefix`` while credentials are loaded from ``peagen.toml`` at
@@ -131,7 +127,7 @@ with patch("swarmauri_gitfilter_s3fs.s3fs_filter.s3fs.S3FileSystem") as fs_cls:
131
127
  assert buffer.getvalue() == b"model-weights"
132
128
  ```
133
129
 
134
- In a production workflow you do not need to patch ``s3fs`` – instantiate the
130
+ In a production workflow you do not need to patch ``s3fs`` ? instantiate the
135
131
  filter with your credentials and bucket, then use ``clean``/``smudge`` or
136
132
  ``upload``/``download`` to move artifacts between git and S3.
137
133
 
@@ -140,3 +136,5 @@ filter with your credentials and bucket, then use ``clean``/``smudge`` or
140
136
  If you want to contribute to swarmauri-sdk, read up on our
141
137
  [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
142
138
  that will help you get started.
139
+
140
+
@@ -1,24 +1,18 @@
1
- ![Swarmauri Logo](https://github.com/swarmauri/swarmauri-sdk/blob/3d4d1cfa949399d7019ae9d8f296afba773dfb7f/assets/swarmauri.brand.theme.svg)
1
+ ![Swarmauri Logo](https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri_sdk_brand.png)
2
2
 
3
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>
4
+ <a href="https://pepy.tech/project/swarmauri_gitfilter_s3fs/">
5
+ <img src="https://static.pepy.tech/badge/swarmauri_gitfilter_s3fs/month" alt="PyPI - Downloads"/></a>
7
6
  <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>
7
+ <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_gitfilter_s3fs.svg"/></a>
10
8
  <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>
9
+ <img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue" alt="PyPI - Python Version"/></a>
13
10
  <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>
11
+ <img src="https://img.shields.io/pypi/l/swarmauri_gitfilter_s3fs" alt="PyPI - License"/></a>
16
12
  <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
- ---
13
+ <img src="https://img.shields.io/pypi/v/swarmauri_gitfilter_s3fs?label=swarmauri_gitfilter_s3fs&color=green" alt="PyPI - swarmauri_gitfilter_s3fs"/></a>
14
+ <a href="https://discord.gg/N4UpBuQv8T">
15
+ <img src="https://img.shields.io/badge/Discord-Join%20Chat-5865F2?logo=discord&logoColor=white" alt="Discord"/></a></p>
22
16
 
23
17
  # Swarmauri Git Filter S3FS
24
18
 
@@ -61,13 +55,13 @@ uv pip install swarmauri_gitfilter_s3fs
61
55
  Create the filter by supplying your bucket name and optional connection
62
56
  parameters:
63
57
 
64
- - ``bucket`` – Target bucket name (required).
65
- - ``prefix`` – Optional key prefix to scope uploads.
66
- - ``key`` / ``secret`` – Credentials for the S3 endpoint. ``SecretStr``
58
+ - ``bucket`` ? Target bucket name (required).
59
+ - ``prefix`` ? Optional key prefix to scope uploads.
60
+ - ``key`` / ``secret`` ? Credentials for the S3 endpoint. ``SecretStr``
67
61
  instances are supported.
68
- - ``endpoint_url`` – Custom S3-compatible endpoint (useful for MinIO or
62
+ - ``endpoint_url`` ? Custom S3-compatible endpoint (useful for MinIO or
69
63
  LocalStack).
70
- - ``region_name`` – Region for the endpoint.
64
+ - ``region_name`` ? Region for the endpoint.
71
65
 
72
66
  When using :meth:`S3FSFilter.from_uri`, the URI sets the ``bucket`` and
73
67
  ``prefix`` while credentials are loaded from ``peagen.toml`` at
@@ -106,7 +100,7 @@ with patch("swarmauri_gitfilter_s3fs.s3fs_filter.s3fs.S3FileSystem") as fs_cls:
106
100
  assert buffer.getvalue() == b"model-weights"
107
101
  ```
108
102
 
109
- In a production workflow you do not need to patch ``s3fs`` – instantiate the
103
+ In a production workflow you do not need to patch ``s3fs`` ? instantiate the
110
104
  filter with your credentials and bucket, then use ``clean``/``smudge`` or
111
105
  ``upload``/``download`` to move artifacts between git and S3.
112
106
 
@@ -114,4 +108,5 @@ filter with your credentials and bucket, then use ``clean``/``smudge`` or
114
108
 
115
109
  If you want to contribute to swarmauri-sdk, read up on our
116
110
  [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
117
- that will help you get started.
111
+ that will help you get started.
112
+
@@ -1,23 +1,23 @@
1
1
  [project]
2
2
  name = "swarmauri_gitfilter_s3fs"
3
- version = "0.3.0.dev45"
4
- authors = [
5
- { name = "Jacob Stewart", email = "jacob@swarmauri.com" }
6
- ]
3
+ version = "0.11.0.dev1"
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
11
  "License :: OSI Approved :: Apache Software License",
12
+ "Operating System :: OS Independent",
13
+ "Programming Language :: Python",
14
14
  "Programming Language :: Python :: 3",
15
+ "Programming Language :: Python :: 3 :: Only",
15
16
  "Programming Language :: Python :: 3.10",
16
17
  "Programming Language :: Python :: 3.11",
17
18
  "Programming Language :: Python :: 3.12",
18
- "Operating System :: OS Independent",
19
- "Programming Language :: Python",
20
- "Programming Language :: Python :: 3 :: Only",
19
+ "Programming Language :: Python :: 3.13",
20
+ "Programming Language :: Python :: 3.14",
21
21
  ]
22
22
  dependencies = [
23
23
  "peagen",
@@ -35,7 +35,6 @@ keywords = [
35
35
  ]
36
36
 
37
37
  [tool.uv.sources]
38
- peagen = { workspace = true }
39
38
  swarmauri_core = { workspace = true }
40
39
  swarmauri_base = { workspace = true }
41
40
  swarmauri_standard = { workspace = true }
@@ -78,7 +77,7 @@ dev = [
78
77
  "pytest-xdist>=3.6.1",
79
78
  "pytest-json-report>=1.5.0",
80
79
  "python-dotenv",
81
- "requests>=2.32.3",
80
+ "httpx>=0.27",
82
81
  "flake8>=7.0",
83
82
  "pytest-timeout>=2.3.1",
84
83
  "ruff>=0.9.9",
@@ -31,10 +31,14 @@ class S3FSFilter(StorageAdapterBase, GitFilterBase):
31
31
  ) -> None:
32
32
  super().__init__(**kwargs)
33
33
  self._bucket = bucket
34
- self._prefix = prefix.lstrip("/")
34
+ self._prefix = self.normalize_prefix(prefix)
35
35
 
36
36
  k = key.get_secret_value() if isinstance(key, SecretStr) else key
37
- s = secret.get_secret_value() if isinstance(secret, SecretStr) else secret
37
+ s = (
38
+ secret.get_secret_value()
39
+ if isinstance(secret, SecretStr)
40
+ else secret
41
+ )
38
42
  client_kwargs: dict[str, str] = {}
39
43
  if endpoint_url:
40
44
  client_kwargs["endpoint_url"] = endpoint_url
@@ -49,9 +53,7 @@ class S3FSFilter(StorageAdapterBase, GitFilterBase):
49
53
  )
50
54
 
51
55
  def _full_key(self, key: str) -> str:
52
- key = key.lstrip("/")
53
- if self._prefix:
54
- key = f"{self._prefix.rstrip('/')}/{key}"
56
+ key = self.compose_key(self._prefix, key, allow_empty=True)
55
57
  return f"{self._bucket}/{key}"
56
58
 
57
59
  @property
@@ -61,10 +63,11 @@ class S3FSFilter(StorageAdapterBase, GitFilterBase):
61
63
  return uri.rstrip("/") + "/"
62
64
 
63
65
  def upload(self, key: str, data: BinaryIO) -> str:
66
+ normalized_key = self.normalize_key(key)
64
67
  dest = self._full_key(key)
65
68
  with self._fs.open(dest, "wb") as fh:
66
69
  shutil.copyfileobj(data, fh)
67
- return f"{self.root_uri}{key.lstrip('/')}"
70
+ return f"{self.root_uri}{normalized_key}"
68
71
 
69
72
  def download(self, key: str) -> BinaryIO:
70
73
  src = self._full_key(key)
@@ -75,7 +78,7 @@ class S3FSFilter(StorageAdapterBase, GitFilterBase):
75
78
  for path in base.rglob("*"):
76
79
  if path.is_file():
77
80
  rel = path.relative_to(base).as_posix()
78
- key = f"{prefix.rstrip('/')}/{rel}" if prefix else rel
81
+ key = self.compose_key(prefix, rel)
79
82
  with path.open("rb") as fh:
80
83
  self.upload(key, fh)
81
84
 
@@ -87,10 +90,12 @@ class S3FSFilter(StorageAdapterBase, GitFilterBase):
87
90
  rel = rel[len(self._prefix.rstrip("/")) + 1 :]
88
91
  yield rel
89
92
 
90
- def download_prefix(self, prefix: str, dest_dir: str | os.PathLike) -> None:
93
+ def download_prefix(
94
+ self, prefix: str, dest_dir: str | os.PathLike
95
+ ) -> None:
91
96
  dest = Path(dest_dir)
92
97
  for rel_key in self.iter_prefix(prefix):
93
- target = dest / rel_key
98
+ target = self.download_target_for_key(dest, rel_key)
94
99
  target.parent.mkdir(parents=True, exist_ok=True)
95
100
  data = self.download(rel_key)
96
101
  with target.open("wb") as fh:
@@ -112,7 +117,9 @@ class S3FSFilter(StorageAdapterBase, GitFilterBase):
112
117
 
113
118
  key = s3_cfg.get("key") or os.getenv("AWS_ACCESS_KEY_ID", "")
114
119
  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")
120
+ endpoint_url = s3_cfg.get("endpoint_url") or os.getenv(
121
+ "AWS_ENDPOINT_URL"
122
+ )
116
123
  region = s3_cfg.get("region") or os.getenv("AWS_REGION")
117
124
 
118
125
  return cls(