byoc-storage 0.2.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.
Files changed (42) hide show
  1. byoc_storage-0.2.0/.gitignore +32 -0
  2. byoc_storage-0.2.0/LICENSE +175 -0
  3. byoc_storage-0.2.0/PKG-INFO +322 -0
  4. byoc_storage-0.2.0/README.md +116 -0
  5. byoc_storage-0.2.0/pyproject.toml +71 -0
  6. byoc_storage-0.2.0/scripts/validate_gdrive_live.py +238 -0
  7. byoc_storage-0.2.0/src/byoc/__init__.py +121 -0
  8. byoc_storage-0.2.0/src/byoc/client.py +336 -0
  9. byoc_storage-0.2.0/src/byoc/encryption.py +175 -0
  10. byoc_storage-0.2.0/src/byoc/errors.py +187 -0
  11. byoc_storage-0.2.0/src/byoc/logging.py +98 -0
  12. byoc_storage-0.2.0/src/byoc/migration.py +199 -0
  13. byoc_storage-0.2.0/src/byoc/paths.py +125 -0
  14. byoc_storage-0.2.0/src/byoc/providers/__init__.py +0 -0
  15. byoc_storage-0.2.0/src/byoc/providers/_sigv4.py +192 -0
  16. byoc_storage-0.2.0/src/byoc/providers/gdrive/__init__.py +42 -0
  17. byoc_storage-0.2.0/src/byoc/providers/gdrive/_http.py +391 -0
  18. byoc_storage-0.2.0/src/byoc/providers/gdrive/_oauth.py +262 -0
  19. byoc_storage-0.2.0/src/byoc/providers/gdrive/_pkce.py +57 -0
  20. byoc_storage-0.2.0/src/byoc/providers/gdrive/_resolver.py +239 -0
  21. byoc_storage-0.2.0/src/byoc/providers/gdrive/_tokens.py +125 -0
  22. byoc_storage-0.2.0/src/byoc/providers/gdrive/adapter.py +256 -0
  23. byoc_storage-0.2.0/src/byoc/providers/s3.py +429 -0
  24. byoc_storage-0.2.0/src/byoc/providers/webdav.py +530 -0
  25. byoc_storage-0.2.0/src/byoc/py.typed +0 -0
  26. byoc_storage-0.2.0/src/byoc/retry.py +58 -0
  27. byoc_storage-0.2.0/src/byoc/types.py +187 -0
  28. byoc_storage-0.2.0/tests/conftest.py +21 -0
  29. byoc_storage-0.2.0/tests/integration/__init__.py +0 -0
  30. byoc_storage-0.2.0/tests/integration/test_client_minio.py +139 -0
  31. byoc_storage-0.2.0/tests/integration/test_s3_minio.py +183 -0
  32. byoc_storage-0.2.0/tests/integration/test_webdav_live.py +204 -0
  33. byoc_storage-0.2.0/tests/interop/__init__.py +0 -0
  34. byoc_storage-0.2.0/tests/interop/interop_cli.mjs +130 -0
  35. byoc_storage-0.2.0/tests/interop/test_cross_sdk.py +331 -0
  36. byoc_storage-0.2.0/tests/test_client.py +358 -0
  37. byoc_storage-0.2.0/tests/test_conformance_e2ee.py +122 -0
  38. byoc_storage-0.2.0/tests/test_conformance_paths.py +77 -0
  39. byoc_storage-0.2.0/tests/test_conformance_pkce.py +72 -0
  40. byoc_storage-0.2.0/tests/test_conformance_sigv4.py +100 -0
  41. byoc_storage-0.2.0/tests/test_gdrive.py +472 -0
  42. byoc_storage-0.2.0/tests/test_s3_adapter.py +224 -0
@@ -0,0 +1,32 @@
1
+ # Node & Dependencies
2
+ node_modules/
3
+ .npm/
4
+
5
+ # Build Outputs & Type Information
6
+ dist/
7
+ *.tsbuildinfo
8
+
9
+ # Environment & Secrets
10
+ .env
11
+ .env.local
12
+ .env.*.local
13
+
14
+ # Testing & Coverage
15
+ coverage/
16
+ .nyc_output/
17
+
18
+ # Logs & Temp
19
+ *.log
20
+ npm-debug.log*
21
+ yarn-debug.log*
22
+ yarn-error.log*
23
+ .DS_Store
24
+
25
+ # IDE & Editors
26
+ .vscode/
27
+ .idea/
28
+ *.suo
29
+ *.ntvs*
30
+ *.njsproj
31
+ *.sln
32
+ *.sw?
@@ -0,0 +1,175 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work.
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and Derivative Works thereof.
46
+
47
+ "Contribution" shall mean any work of authorship, including
48
+ the original version of the Work and any modifications or additions
49
+ to that Work or Derivative Works thereof, that is intentionally
50
+ submitted to Licensor for inclusion in the Work by the copyright owner
51
+ or by an individual or Legal Entity authorized to submit on behalf of
52
+ the copyright owner. For the purposes of this definition, "submitted"
53
+ means any form of electronic, verbal, or written communication sent
54
+ to the Licensor or its representatives, including but not limited to
55
+ communication on electronic mailing lists, source code control systems,
56
+ and issue tracking systems that are managed by, or on behalf of, the
57
+ Licensor for the purpose of discussing and improving the Work, but
58
+ excluding communication that is conspicuously marked or otherwise
59
+ designated in writing by the copyright owner as "Not a Contribution."
60
+
61
+ "Contributor" shall mean Licensor and any individual or Legal Entity
62
+ on behalf of whom a Contribution has been received by Licensor and
63
+ subsequently incorporated within the Work.
64
+
65
+ 2. Grant of Copyright License. Subject to the terms and conditions of
66
+ this License, each Contributor hereby grants to You a perpetual,
67
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
68
+ copyright license to reproduce, prepare Derivative Works of,
69
+ publicly display, publicly perform, sublicense, and distribute the
70
+ Work and such Derivative Works in Source or Object form.
71
+
72
+ 3. Grant of Patent License. Subject to the terms and conditions of
73
+ this License, each Contributor hereby grants to You a perpetual,
74
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
75
+ (except as stated in this section) patent license to make, have made,
76
+ use, offer to sell, sell, import, and otherwise transfer the Work,
77
+ where such license applies only to those patent claims licensable
78
+ by such Contributor that are necessarily infringed by their
79
+ Contribution(s) alone or by combination of their Contribution(s)
80
+ with the Work to which such Contribution(s) was submitted. If You
81
+ institute patent litigation against any entity (including a
82
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
83
+ or a Contribution incorporated within the Work constitutes direct
84
+ or contributory patent infringement, then any patent licenses
85
+ granted to You under this License for that Work shall terminate
86
+ as of the date such litigation is filed.
87
+
88
+ 4. Redistribution. You may reproduce and distribute copies of the
89
+ Work or Derivative Works thereof in any medium, with or without
90
+ modifications, and in Source or Object form, provided that You
91
+ meet the following conditions:
92
+
93
+ (a) You must give any other recipients of the Work or
94
+ Derivative Works a copy of this License; and
95
+
96
+ (b) You must cause any modified files to carry prominent notices
97
+ stating that You changed the files; and
98
+
99
+ (c) You must retain, in the Source form of any Derivative Works
100
+ that You distribute, all copyright, patent, trademark, and
101
+ attribution notices from the Source form of the Work,
102
+ excluding those notices that do not pertain to any part of
103
+ the Derivative Works; and
104
+
105
+ (d) If the Work includes a "NOTICE" text file as part of its
106
+ distribution, then any Derivative Works that You distribute must
107
+ include a readable copy of the attribution notices contained
108
+ within such NOTICE file, excluding those notices that do not
109
+ pertain to any part of the Derivative Works, in at least one
110
+ of the following places: within a NOTICE text file distributed
111
+ as part of the Derivative Works; within the Source form or
112
+ documentation, if provided along with the Derivative Works; or,
113
+ within a display generated by the Derivative Works, if and
114
+ wherever such third-party notices normally appear. The contents
115
+ of the NOTICE file are for informational purposes only and
116
+ do not modify the License. You may add Your own attribution
117
+ notices within Derivative Works that You distribute, alongside
118
+ or as an addendum to the NOTICE text from the Work, provided
119
+ that such additional attribution notices cannot be construed
120
+ as modifying the License.
121
+
122
+ You may add Your own copyright statement to Your modifications and
123
+ may provide additional or different license terms and conditions
124
+ for use, reproduction, or distribution of Your modifications, or
125
+ for any such Derivative Works as a whole, provided Your use,
126
+ reproduction, and distribution of the Work otherwise complies with
127
+ the conditions stated in this License.
128
+
129
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
130
+ any Contribution intentionally submitted for inclusion in the Work
131
+ by You to the Licensor shall be under the terms and conditions of
132
+ this License, without any additional terms or conditions.
133
+ Notwithstanding the above, nothing herein shall supersede or modify
134
+ the terms of any separate license agreement you may have executed
135
+ with Licensor regarding such Contributions.
136
+
137
+ 6. Trademarks. This License does not grant permission to use the trade
138
+ names, trademarks, service marks, or product names of the Licensor,
139
+ except as required for reasonable and customary use in describing the
140
+ origin of the Work and reproducing the content of the NOTICE file.
141
+
142
+ 7. Disclaimer of Warranty. Unless required by applicable law or
143
+ agreed to in writing, Licensor provides the Work (and each
144
+ Contributor provides its Contributions) on an "AS IS" BASIS,
145
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
146
+ implied, including, without limitation, any warranties or conditions
147
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
148
+ PARTICULAR PURPOSE. You are solely responsible for determining the
149
+ appropriateness of using or redistributing the Work and assume any
150
+ risks associated with Your exercise of permissions under this License.
151
+
152
+ 8. Limitation of Liability. In no event and under no legal theory,
153
+ whether in tort (including negligence), contract, or otherwise,
154
+ unless required by applicable law (such as deliberate and grossly
155
+ negligent acts) or agreed to in writing, shall any Contributor be
156
+ liable to You for damages, including any direct, indirect, special,
157
+ incidental, or consequential damages of any character arising as a
158
+ result of this License or out of the use or inability to use the
159
+ Work (including but not limited to damages for loss of goodwill,
160
+ work stoppage, computer failure or malfunction, or any and all
161
+ other commercial damages or losses), even if such Contributor
162
+ has been advised of the possibility of such damages.
163
+
164
+ 9. Accepting Warranty or Additional Liability. While redistributing
165
+ the Work or Derivative Works thereof, You may choose to offer,
166
+ and charge a fee for, acceptance of support, warranty, indemnity,
167
+ or other liability obligations and/or rights consistent with this
168
+ License. However, in accepting such obligations, You may act only
169
+ on Your own behalf and on Your sole responsibility, not on behalf
170
+ of any other Contributor, and only if You agree to indemnify,
171
+ defend, and hold each Contributor harmless for any liability
172
+ incurred by, or claims asserted against, such Contributor by reason
173
+ of your accepting any such warranty or additional liability.
174
+
175
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,322 @@
1
+ Metadata-Version: 2.5
2
+ Name: byoc-storage
3
+ Version: 0.2.0
4
+ Summary: BYOC (Bring Your Own Cloud) — universal storage abstraction for storage your users already own
5
+ Project-URL: Homepage, https://github.com/Ajayvarmaramineni/BYOC
6
+ Project-URL: Repository, https://github.com/Ajayvarmaramineni/BYOC
7
+ Project-URL: Issues, https://github.com/Ajayvarmaramineni/BYOC/issues
8
+ Author: Ajay Ramineni
9
+ License: Apache License
10
+ Version 2.0, January 2004
11
+ http://www.apache.org/licenses/
12
+
13
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
14
+
15
+ 1. Definitions.
16
+
17
+ "License" shall mean the terms and conditions for use, reproduction,
18
+ and distribution as defined by Sections 1 through 9 of this document.
19
+
20
+ "Licensor" shall mean the copyright owner or entity authorized by
21
+ the copyright owner that is granting the License.
22
+
23
+ "Legal Entity" shall mean the union of the acting entity and all
24
+ other entities that control, are controlled by, or are under common
25
+ control with that entity. For the purposes of this definition,
26
+ "control" means (i) the power, direct or indirect, to cause the
27
+ direction or management of such entity, whether by contract or
28
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
29
+ outstanding shares, or (iii) beneficial ownership of such entity.
30
+
31
+ "You" (or "Your") shall mean an individual or Legal Entity
32
+ exercising permissions granted by this License.
33
+
34
+ "Source" form shall mean the preferred form for making modifications,
35
+ including but not limited to software source code, documentation
36
+ source, and configuration files.
37
+
38
+ "Object" form shall mean any form resulting from mechanical
39
+ transformation or translation of a Source form, including but
40
+ not limited to compiled object code, generated documentation,
41
+ and conversions to other media types.
42
+
43
+ "Work" shall mean the work of authorship, whether in Source or
44
+ Object form, made available under the License, as indicated by a
45
+ copyright notice that is included in or attached to the work.
46
+
47
+ "Derivative Works" shall mean any work, whether in Source or Object
48
+ form, that is based on (or derived from) the Work and for which the
49
+ editorial revisions, annotations, elaborations, or other modifications
50
+ represent, as a whole, an original work of authorship. For the purposes
51
+ of this License, Derivative Works shall not include works that remain
52
+ separable from, or merely link (or bind by name) to the interfaces of,
53
+ the Work and Derivative Works thereof.
54
+
55
+ "Contribution" shall mean any work of authorship, including
56
+ the original version of the Work and any modifications or additions
57
+ to that Work or Derivative Works thereof, that is intentionally
58
+ submitted to Licensor for inclusion in the Work by the copyright owner
59
+ or by an individual or Legal Entity authorized to submit on behalf of
60
+ the copyright owner. For the purposes of this definition, "submitted"
61
+ means any form of electronic, verbal, or written communication sent
62
+ to the Licensor or its representatives, including but not limited to
63
+ communication on electronic mailing lists, source code control systems,
64
+ and issue tracking systems that are managed by, or on behalf of, the
65
+ Licensor for the purpose of discussing and improving the Work, but
66
+ excluding communication that is conspicuously marked or otherwise
67
+ designated in writing by the copyright owner as "Not a Contribution."
68
+
69
+ "Contributor" shall mean Licensor and any individual or Legal Entity
70
+ on behalf of whom a Contribution has been received by Licensor and
71
+ subsequently incorporated within the Work.
72
+
73
+ 2. Grant of Copyright License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ copyright license to reproduce, prepare Derivative Works of,
77
+ publicly display, publicly perform, sublicense, and distribute the
78
+ Work and such Derivative Works in Source or Object form.
79
+
80
+ 3. Grant of Patent License. Subject to the terms and conditions of
81
+ this License, each Contributor hereby grants to You a perpetual,
82
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
83
+ (except as stated in this section) patent license to make, have made,
84
+ use, offer to sell, sell, import, and otherwise transfer the Work,
85
+ where such license applies only to those patent claims licensable
86
+ by such Contributor that are necessarily infringed by their
87
+ Contribution(s) alone or by combination of their Contribution(s)
88
+ with the Work to which such Contribution(s) was submitted. If You
89
+ institute patent litigation against any entity (including a
90
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
91
+ or a Contribution incorporated within the Work constitutes direct
92
+ or contributory patent infringement, then any patent licenses
93
+ granted to You under this License for that Work shall terminate
94
+ as of the date such litigation is filed.
95
+
96
+ 4. Redistribution. You may reproduce and distribute copies of the
97
+ Work or Derivative Works thereof in any medium, with or without
98
+ modifications, and in Source or Object form, provided that You
99
+ meet the following conditions:
100
+
101
+ (a) You must give any other recipients of the Work or
102
+ Derivative Works a copy of this License; and
103
+
104
+ (b) You must cause any modified files to carry prominent notices
105
+ stating that You changed the files; and
106
+
107
+ (c) You must retain, in the Source form of any Derivative Works
108
+ that You distribute, all copyright, patent, trademark, and
109
+ attribution notices from the Source form of the Work,
110
+ excluding those notices that do not pertain to any part of
111
+ the Derivative Works; and
112
+
113
+ (d) If the Work includes a "NOTICE" text file as part of its
114
+ distribution, then any Derivative Works that You distribute must
115
+ include a readable copy of the attribution notices contained
116
+ within such NOTICE file, excluding those notices that do not
117
+ pertain to any part of the Derivative Works, in at least one
118
+ of the following places: within a NOTICE text file distributed
119
+ as part of the Derivative Works; within the Source form or
120
+ documentation, if provided along with the Derivative Works; or,
121
+ within a display generated by the Derivative Works, if and
122
+ wherever such third-party notices normally appear. The contents
123
+ of the NOTICE file are for informational purposes only and
124
+ do not modify the License. You may add Your own attribution
125
+ notices within Derivative Works that You distribute, alongside
126
+ or as an addendum to the NOTICE text from the Work, provided
127
+ that such additional attribution notices cannot be construed
128
+ as modifying the License.
129
+
130
+ You may add Your own copyright statement to Your modifications and
131
+ may provide additional or different license terms and conditions
132
+ for use, reproduction, or distribution of Your modifications, or
133
+ for any such Derivative Works as a whole, provided Your use,
134
+ reproduction, and distribution of the Work otherwise complies with
135
+ the conditions stated in this License.
136
+
137
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
138
+ any Contribution intentionally submitted for inclusion in the Work
139
+ by You to the Licensor shall be under the terms and conditions of
140
+ this License, without any additional terms or conditions.
141
+ Notwithstanding the above, nothing herein shall supersede or modify
142
+ the terms of any separate license agreement you may have executed
143
+ with Licensor regarding such Contributions.
144
+
145
+ 6. Trademarks. This License does not grant permission to use the trade
146
+ names, trademarks, service marks, or product names of the Licensor,
147
+ except as required for reasonable and customary use in describing the
148
+ origin of the Work and reproducing the content of the NOTICE file.
149
+
150
+ 7. Disclaimer of Warranty. Unless required by applicable law or
151
+ agreed to in writing, Licensor provides the Work (and each
152
+ Contributor provides its Contributions) on an "AS IS" BASIS,
153
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
154
+ implied, including, without limitation, any warranties or conditions
155
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
156
+ PARTICULAR PURPOSE. You are solely responsible for determining the
157
+ appropriateness of using or redistributing the Work and assume any
158
+ risks associated with Your exercise of permissions under this License.
159
+
160
+ 8. Limitation of Liability. In no event and under no legal theory,
161
+ whether in tort (including negligence), contract, or otherwise,
162
+ unless required by applicable law (such as deliberate and grossly
163
+ negligent acts) or agreed to in writing, shall any Contributor be
164
+ liable to You for damages, including any direct, indirect, special,
165
+ incidental, or consequential damages of any character arising as a
166
+ result of this License or out of the use or inability to use the
167
+ Work (including but not limited to damages for loss of goodwill,
168
+ work stoppage, computer failure or malfunction, or any and all
169
+ other commercial damages or losses), even if such Contributor
170
+ has been advised of the possibility of such damages.
171
+
172
+ 9. Accepting Warranty or Additional Liability. While redistributing
173
+ the Work or Derivative Works thereof, You may choose to offer,
174
+ and charge a fee for, acceptance of support, warranty, indemnity,
175
+ or other liability obligations and/or rights consistent with this
176
+ License. However, in accepting such obligations, You may act only
177
+ on Your own behalf and on Your sole responsibility, not on behalf
178
+ of any other Contributor, and only if You agree to indemnify,
179
+ defend, and hold each Contributor harmless for any liability
180
+ incurred by, or claims asserted against, such Contributor by reason
181
+ of your accepting any such warranty or additional liability.
182
+
183
+ END OF TERMS AND CONDITIONS
184
+ License-File: LICENSE
185
+ Keywords: byoc,cloud-storage,google-drive,s3,storage-abstraction,webdav
186
+ Classifier: Development Status :: 4 - Beta
187
+ Classifier: Intended Audience :: Developers
188
+ Classifier: License :: OSI Approved :: Apache Software License
189
+ Classifier: Programming Language :: Python :: 3.10
190
+ Classifier: Programming Language :: Python :: 3.11
191
+ Classifier: Programming Language :: Python :: 3.12
192
+ Classifier: Programming Language :: Python :: 3.13
193
+ Classifier: Typing :: Typed
194
+ Requires-Python: >=3.10
195
+ Requires-Dist: cryptography>=42.0
196
+ Requires-Dist: httpx>=0.27
197
+ Provides-Extra: dev
198
+ Requires-Dist: cheroot>=10.0; extra == 'dev'
199
+ Requires-Dist: mypy>=1.9; extra == 'dev'
200
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
201
+ Requires-Dist: pytest-httpx>=0.30; extra == 'dev'
202
+ Requires-Dist: pytest>=8.0; extra == 'dev'
203
+ Requires-Dist: ruff>=0.4; extra == 'dev'
204
+ Requires-Dist: wsgidav>=4.3; extra == 'dev'
205
+ Description-Content-Type: text/markdown
206
+
207
+ # byoc
208
+
209
+ Python SDK for **BYOC (Bring Your Own Cloud)**: a provider-agnostic storage layer for building applications on top of cloud storage your users already own.
210
+
211
+ > Part of the [BYOC monorepo](https://github.com/Ajayvarmaramineni/BYOC). Peer implementation of [`@byoc/core`](https://www.npmjs.com/package/@byoc/core) on npm.
212
+ >
213
+ > **Status: v0.2.0.** Every adapter is validated against a live server. Not yet on PyPI.
214
+
215
+ ## Why
216
+
217
+ Instead of paying to host every user's files on your own S3 bucket, BYOC lets your application read and write storage the user already owns: their Google Drive, their company's Nextcloud, their own R2 bucket.
218
+
219
+ ```text
220
+ FastAPI / Django / Celery
221
+
222
+ ├── PostgreSQL → users, jobs, metadata pointers
223
+
224
+ └── byoc → the actual PDFs, images, audio, model artifacts
225
+
226
+ └── the user's own cloud
227
+ ```
228
+
229
+ Use Postgres for your application data. Use BYOC for their files.
230
+
231
+ ## Install
232
+
233
+ ```bash
234
+ pip install byoc-storage
235
+ ```
236
+
237
+ The distribution is named `byoc-storage` because `byoc` on PyPI belongs to an
238
+ unrelated CLI framework. The import name is still `byoc`:
239
+
240
+ ```python
241
+ import byoc
242
+ ```
243
+
244
+ > If you also depend on the unrelated `byoc` CLI framework, do not install both
245
+ > into the same environment: they share the `byoc` import name and will shadow
246
+ > each other.
247
+
248
+ ## Usage
249
+
250
+ ```python
251
+ import os
252
+ from byoc import AsyncBYOC
253
+ from byoc.providers.s3 import S3CompatibleProvider
254
+
255
+ storage = AsyncBYOC(
256
+ provider=S3CompatibleProvider(
257
+ endpoint="https://<account_id>.r2.cloudflarestorage.com",
258
+ bucket="user-assets",
259
+ region="auto",
260
+ access_key_id=os.environ["R2_ACCESS_KEY_ID"],
261
+ secret_access_key=os.environ["R2_SECRET_ACCESS_KEY"],
262
+ )
263
+ )
264
+
265
+ async with storage:
266
+ await storage.write_text("documents/welcome.md", "# Hello from BYOC!")
267
+ content = await storage.read_text("documents/welcome.md")
268
+ ```
269
+
270
+ ### Multiple providers and migration
271
+
272
+ ```python
273
+ storage = AsyncBYOC(providers=[drive, r2, nextcloud], default_provider_id="s3-compatible")
274
+
275
+ storage.use_provider("webdav")
276
+ await storage.write_bytes("images/banner.png", data)
277
+
278
+ report = await storage.migrate(
279
+ source="s3-compatible",
280
+ target="webdav",
281
+ paths=["documents/report.pdf"],
282
+ on_progress=lambda p: print(f"{p.current_file} ({p.percentage}%)"),
283
+ )
284
+ ```
285
+
286
+ `report.files_partial` counts files that reached the target but whose source
287
+ cleanup failed. The transfer is done, so retrying those would re-upload for
288
+ nothing.
289
+
290
+ > **Async only for now.** A synchronous facade for Celery, Django, and scripts
291
+ > is planned but not yet implemented; use `asyncio.run()` in the meantime.
292
+
293
+ ## Google Drive
294
+
295
+ Drive needs a Google Cloud OAuth client. See [**Google Drive OAuth Setup**](../docs/google-oauth-setup.md), then verify your setup with:
296
+
297
+ ```bash
298
+ .venv/bin/python scripts/validate_gdrive_live.py
299
+ ```
300
+
301
+ ## Cross-SDK compatibility
302
+
303
+ This SDK and the TypeScript SDK are peer implementations of the same contract. Both run against the shared conformance vectors in [`spec/fixtures`](../spec/), so a file written by a Next.js frontend can be read by a FastAPI backend, including client-side encrypted files, whose envelope format is byte-identical across both.
304
+
305
+ ## Development
306
+
307
+ ```bash
308
+ python3 -m venv .venv
309
+ source .venv/bin/activate
310
+ pip install -e ".[dev]"
311
+
312
+ pytest # unit + conformance suite
313
+ mypy src # strict type checking
314
+ ruff check . # lint
315
+ ```
316
+
317
+ Without activating, call the venv binaries directly: `.venv/bin/pytest`,
318
+ `.venv/bin/mypy src`, `.venv/bin/ruff check .`
319
+
320
+ ## License
321
+
322
+ [Apache-2.0](./LICENSE)
@@ -0,0 +1,116 @@
1
+ # byoc
2
+
3
+ Python SDK for **BYOC (Bring Your Own Cloud)**: a provider-agnostic storage layer for building applications on top of cloud storage your users already own.
4
+
5
+ > Part of the [BYOC monorepo](https://github.com/Ajayvarmaramineni/BYOC). Peer implementation of [`@byoc/core`](https://www.npmjs.com/package/@byoc/core) on npm.
6
+ >
7
+ > **Status: v0.2.0.** Every adapter is validated against a live server. Not yet on PyPI.
8
+
9
+ ## Why
10
+
11
+ Instead of paying to host every user's files on your own S3 bucket, BYOC lets your application read and write storage the user already owns: their Google Drive, their company's Nextcloud, their own R2 bucket.
12
+
13
+ ```text
14
+ FastAPI / Django / Celery
15
+
16
+ ├── PostgreSQL → users, jobs, metadata pointers
17
+
18
+ └── byoc → the actual PDFs, images, audio, model artifacts
19
+
20
+ └── the user's own cloud
21
+ ```
22
+
23
+ Use Postgres for your application data. Use BYOC for their files.
24
+
25
+ ## Install
26
+
27
+ ```bash
28
+ pip install byoc-storage
29
+ ```
30
+
31
+ The distribution is named `byoc-storage` because `byoc` on PyPI belongs to an
32
+ unrelated CLI framework. The import name is still `byoc`:
33
+
34
+ ```python
35
+ import byoc
36
+ ```
37
+
38
+ > If you also depend on the unrelated `byoc` CLI framework, do not install both
39
+ > into the same environment: they share the `byoc` import name and will shadow
40
+ > each other.
41
+
42
+ ## Usage
43
+
44
+ ```python
45
+ import os
46
+ from byoc import AsyncBYOC
47
+ from byoc.providers.s3 import S3CompatibleProvider
48
+
49
+ storage = AsyncBYOC(
50
+ provider=S3CompatibleProvider(
51
+ endpoint="https://<account_id>.r2.cloudflarestorage.com",
52
+ bucket="user-assets",
53
+ region="auto",
54
+ access_key_id=os.environ["R2_ACCESS_KEY_ID"],
55
+ secret_access_key=os.environ["R2_SECRET_ACCESS_KEY"],
56
+ )
57
+ )
58
+
59
+ async with storage:
60
+ await storage.write_text("documents/welcome.md", "# Hello from BYOC!")
61
+ content = await storage.read_text("documents/welcome.md")
62
+ ```
63
+
64
+ ### Multiple providers and migration
65
+
66
+ ```python
67
+ storage = AsyncBYOC(providers=[drive, r2, nextcloud], default_provider_id="s3-compatible")
68
+
69
+ storage.use_provider("webdav")
70
+ await storage.write_bytes("images/banner.png", data)
71
+
72
+ report = await storage.migrate(
73
+ source="s3-compatible",
74
+ target="webdav",
75
+ paths=["documents/report.pdf"],
76
+ on_progress=lambda p: print(f"{p.current_file} ({p.percentage}%)"),
77
+ )
78
+ ```
79
+
80
+ `report.files_partial` counts files that reached the target but whose source
81
+ cleanup failed. The transfer is done, so retrying those would re-upload for
82
+ nothing.
83
+
84
+ > **Async only for now.** A synchronous facade for Celery, Django, and scripts
85
+ > is planned but not yet implemented; use `asyncio.run()` in the meantime.
86
+
87
+ ## Google Drive
88
+
89
+ Drive needs a Google Cloud OAuth client. See [**Google Drive OAuth Setup**](../docs/google-oauth-setup.md), then verify your setup with:
90
+
91
+ ```bash
92
+ .venv/bin/python scripts/validate_gdrive_live.py
93
+ ```
94
+
95
+ ## Cross-SDK compatibility
96
+
97
+ This SDK and the TypeScript SDK are peer implementations of the same contract. Both run against the shared conformance vectors in [`spec/fixtures`](../spec/), so a file written by a Next.js frontend can be read by a FastAPI backend, including client-side encrypted files, whose envelope format is byte-identical across both.
98
+
99
+ ## Development
100
+
101
+ ```bash
102
+ python3 -m venv .venv
103
+ source .venv/bin/activate
104
+ pip install -e ".[dev]"
105
+
106
+ pytest # unit + conformance suite
107
+ mypy src # strict type checking
108
+ ruff check . # lint
109
+ ```
110
+
111
+ Without activating, call the venv binaries directly: `.venv/bin/pytest`,
112
+ `.venv/bin/mypy src`, `.venv/bin/ruff check .`
113
+
114
+ ## License
115
+
116
+ [Apache-2.0](./LICENSE)