nerdstack-ark 1.0.0__py3-none-any.whl

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,187 @@
1
+ Metadata-Version: 2.5
2
+ Name: nerdstack-ark
3
+ Version: 1.0.0
4
+ Summary: Official Python SDK for Ark storage, with sync, async, and S3-compatible access.
5
+ Project-URL: Homepage, https://ark.nerdstackgrp.com
6
+ Project-URL: Documentation, https://github.com/joshhumphrey02/ark-sdk/tree/master/packages/ark-py#readme
7
+ Project-URL: Repository, https://github.com/joshhumphrey02/ark-sdk
8
+ Project-URL: Issues, https://github.com/joshhumphrey02/ark-sdk/issues
9
+ Author: Nerdstack
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: ark,django,fastapi,flask,s3,storage,upload
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Framework :: AsyncIO
15
+ Classifier: Framework :: Django
16
+ Classifier: Framework :: FastAPI
17
+ Classifier: Framework :: Flask
18
+ Classifier: License :: OSI Approved :: MIT License
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.10
26
+ Requires-Dist: httpx<1,>=0.27
27
+ Provides-Extra: dev
28
+ Requires-Dist: build>=1.2; extra == 'dev'
29
+ Requires-Dist: mypy>=1.11; extra == 'dev'
30
+ Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
31
+ Requires-Dist: pytest>=8.3; extra == 'dev'
32
+ Requires-Dist: ruff>=0.9; extra == 'dev'
33
+ Requires-Dist: twine>=6.0; extra == 'dev'
34
+ Provides-Extra: django
35
+ Requires-Dist: django>=4.2; extra == 'django'
36
+ Provides-Extra: fastapi
37
+ Requires-Dist: fastapi>=0.110; extra == 'fastapi'
38
+ Provides-Extra: flask
39
+ Requires-Dist: flask>=2.3; extra == 'flask'
40
+ Provides-Extra: s3
41
+ Requires-Dist: boto3<2,>=1.35; extra == 's3'
42
+ Description-Content-Type: text/markdown
43
+
44
+ # Ark for Python
45
+
46
+ The official Python SDK for [Ark](https://ark.nerdstackgrp.com) storage. It is
47
+ framework-independent and provides:
48
+
49
+ - `Ark` for Django, Flask, Celery, scripts, and synchronous workers.
50
+ - `AsyncArk` for FastAPI, Starlette, aiohttp, and async workers.
51
+ - Memory-bounded single and multipart uploads.
52
+ - Typed result models and one normalized `ArkError` exception.
53
+ - Optional access through Ark's S3-compatible endpoint using boto3.
54
+
55
+ ## Install
56
+
57
+ ```bash
58
+ pip install nerdstack-ark
59
+ ```
60
+
61
+ For S3-compatible access:
62
+
63
+ ```bash
64
+ pip install "nerdstack-ark[s3]"
65
+ ```
66
+
67
+ Python 3.10 or newer is required.
68
+
69
+ ## Synchronous usage
70
+
71
+ ```python
72
+ import os
73
+ from ark_py import Ark
74
+
75
+ with Ark(os.environ["ARK_API_TOKEN"]) as ark:
76
+ folder = ark.folders.create("Product Media")
77
+ file = ark.files.upload(
78
+ "./hero.mp4",
79
+ folder_id=folder.id,
80
+ content_type="video/mp4",
81
+ )
82
+ download_url = ark.files.get_download_url(file.id, expires_in_seconds=600)
83
+ print(download_url)
84
+ ```
85
+
86
+ Filesystem paths stream directly from disk. A file-like object is also
87
+ accepted; provide `size` and `filename` when it is not seekable:
88
+
89
+ ```python
90
+ file = ark.files.upload(
91
+ request.stream,
92
+ size=int(request.headers["content-length"]),
93
+ filename="upload.bin",
94
+ )
95
+ ```
96
+
97
+ The stream must produce exactly the declared number of bytes. Ark aborts an
98
+ incomplete server-side session if the transfer fails, underflows, or overflows.
99
+
100
+ ## Asynchronous usage
101
+
102
+ ```python
103
+ import os
104
+ from ark_py import AsyncArk
105
+
106
+ async with AsyncArk(os.environ["ARK_API_TOKEN"]) as ark:
107
+ file = await ark.files.upload("./hero.mp4", content_type="video/mp4")
108
+ usage = await ark.usage()
109
+ print(file.id, usage.storage.used_bytes)
110
+ ```
111
+
112
+ `AsyncArk.files.upload` accepts paths, ordinary binary files, and
113
+ `AsyncIterable[bytes]`. Async iterables require an exact `size` and `filename`.
114
+
115
+ ## Files, folders, images, and sessions
116
+
117
+ ```python
118
+ page = ark.files.list(folder_id=folder.id, limit=50)
119
+ file = ark.files.get(page.data[0].id)
120
+ ark.files.move(file.id, folder_id=None)
121
+ ark.files.delete(file.id)
122
+
123
+ folders = ark.folders.list(parent_id=None)
124
+ ark.folders.rename(folder.id, "Campaign Media")
125
+
126
+ image_url = ark.images.url(file.id)
127
+ signed_url = ark.images.signed_url(file.id, expires_in_seconds=600)
128
+
129
+ session = ark.create_client_session(ttl_seconds=900)
130
+ # Hand session.token to @nerdstackgrp/ark-client in the browser.
131
+ ```
132
+
133
+ ## S3-compatible access
134
+
135
+ ```python
136
+ import os
137
+ from ark_py import create_s3_client
138
+
139
+ s3 = create_s3_client(
140
+ access_key_id=os.environ["ARK_ACCESS_KEY_ID"],
141
+ secret_access_key=os.environ["ARK_SECRET_ACCESS_KEY"],
142
+ )
143
+
144
+ s3.put_object(Bucket="product-media", Key="hero.jpg", Body=image_bytes)
145
+ objects = s3.list_objects_v2(Bucket="product-media", Prefix="photos/")
146
+ ```
147
+
148
+ These must be Ark-issued S3 credentials. The helper configures SigV4 and
149
+ path-style addressing for `https://ark.nerdstackgrp.com/s3`.
150
+
151
+ ## Errors
152
+
153
+ ```python
154
+ from ark_py import ArkError
155
+
156
+ try:
157
+ ark.files.get("missing")
158
+ except ArkError as error:
159
+ print(error.code, error.status, error.request_id, error.retryable)
160
+ ```
161
+
162
+ ## Framework examples
163
+
164
+ Complete examples live in [`examples/`](examples):
165
+
166
+ - Django upload view and application lifecycle.
167
+ - Flask application factory and upload route.
168
+ - FastAPI lifespan management and `UploadFile` streaming.
169
+
170
+ Keep `ARK_API_TOKEN` in server-side environment configuration. Never expose it
171
+ to templates, frontend bundles, mobile apps, logs, or error responses.
172
+
173
+ ## Development
174
+
175
+ ```bash
176
+ python -m venv .venv
177
+ .venv/bin/pip install -e ".[dev]"
178
+ .venv/bin/pytest
179
+ .venv/bin/ruff check .
180
+ .venv/bin/mypy
181
+ .venv/bin/python -m build
182
+ .venv/bin/twine check dist/*
183
+ ```
184
+
185
+ ## License
186
+
187
+ MIT © Nerdstack.
@@ -0,0 +1,12 @@
1
+ ark_py/__init__.py,sha256=zGLbXFUTz5Ra1BCaCWNBPyAdgM5UdlqQnk2vaCwrfYg,528
2
+ ark_py/_shared.py,sha256=-rIW5OnJF-CrfZjj3G77Y5QdKahwCQkO5r-JyJlOucQ,6029
3
+ ark_py/async_client.py,sha256=Gtm9VkXV8MxY3Jsx38vdMIIPaZjmBZ64QH9LibQF8vI,19737
4
+ ark_py/errors.py,sha256=bQFW9lo7d609zswKfrQX9LGjXuFVpeasT9AQkIyWtLQ,2336
5
+ ark_py/models.py,sha256=R06ZT72UaZHAaGlLF5G0MwoBR_tzUMnguxef9oI0ksc,2964
6
+ ark_py/py.typed,sha256=OHLhUlJwzVblRS88hQOvYv5HXJG8mzugIVr_EYAOCmU,17
7
+ ark_py/s3.py,sha256=Il2GkjuHkVfedn0b_N0vq45MRThp0lj3106WAqfyyuI,1188
8
+ ark_py/sync.py,sha256=FW-cKEzSYIAXkQDamqFWdFhvrdezx_5FKcb8tpwOLkI,13086
9
+ nerdstack_ark-1.0.0.dist-info/METADATA,sha256=SpVvjWWbNbABR7Pa6E-htTHrfm1IOG9ckNFguTIZcHI,5399
10
+ nerdstack_ark-1.0.0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
11
+ nerdstack_ark-1.0.0.dist-info/licenses/LICENSE,sha256=HnmJ4X5sG-pRJUnoDgJ363BlVvhFtu2MZz6qE9FUX00,1066
12
+ nerdstack_ark-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.32.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Nerdstack
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.