viewrium 0.1.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.
@@ -0,0 +1,52 @@
1
+ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2
+
3
+ # dependencies
4
+ node_modules/
5
+ /.pnp
6
+ .pnp.*
7
+ .yarn/*
8
+ !.yarn/patches
9
+ !.yarn/plugins
10
+ !.yarn/releases
11
+ !.yarn/versions
12
+
13
+ # testing
14
+ /coverage
15
+
16
+ # next.js
17
+ /.next/
18
+ /out/
19
+
20
+ # production
21
+ /build
22
+
23
+ # misc
24
+ .DS_Store
25
+ *.pem
26
+
27
+ # debug
28
+ npm-debug.log*
29
+ yarn-debug.log*
30
+ yarn-error.log*
31
+ .pnpm-debug.log*
32
+
33
+ # env files (can opt-in for committing if needed)
34
+ .env*
35
+
36
+ # vercel
37
+ .vercel
38
+
39
+ # typescript
40
+ *.tsbuildinfo
41
+ next-env.d.ts
42
+
43
+ # python (upload proxy)
44
+ __pycache__/
45
+ *.py[cod]
46
+ .venv/
47
+ api-venv/
48
+
49
+ exports/
50
+
51
+ # sdk package build outputs (regenerated on publish)
52
+ /packages/*/dist/
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+ All notable changes to the `viewrium` Python SDK are documented here. Format roughly follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
4
+
5
+ ## 0.1.0 — 2026-04-29
6
+
7
+ - Initial release. Python SDK for the Viewrium API: sync (`viewrium.Client`) and async (`viewrium.AsyncClient`) clients with `Models`, `ApiKeys`, `Usage`, `Webhooks` resources, built on `httpx`.
@@ -0,0 +1,164 @@
1
+ Metadata-Version: 2.4
2
+ Name: viewrium
3
+ Version: 0.1.0
4
+ Summary: Official Python SDK for the Viewrium API. Create and manage 3D models, api keys, and usage records.
5
+ Project-URL: Homepage, https://viewrium.com
6
+ Project-URL: Repository, https://github.com/davidzagyvaig/viewrium
7
+ Project-URL: Documentation, https://docs.viewrium.com
8
+ Author-email: Viewrium <hello@viewrium.com>
9
+ License: Apache-2.0
10
+ Keywords: 3d,api,ar,model-viewer,sdk,viewrium
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Software Development :: Libraries
19
+ Requires-Python: >=3.10
20
+ Requires-Dist: httpx>=0.27
21
+ Description-Content-Type: text/markdown
22
+
23
+ # viewrium
24
+
25
+ Official Python SDK for the [Viewrium](https://viewrium.com) API. Create and manage 3D models, API keys, and usage records.
26
+
27
+ ## Install
28
+
29
+ ```bash
30
+ pip install viewrium
31
+ ```
32
+
33
+ Python 3.10+.
34
+
35
+ ## Configure
36
+
37
+ ```python
38
+ import viewrium
39
+ viewrium.api_key = "sk_live_..."
40
+ ```
41
+
42
+ Or via environment variable:
43
+
44
+ ```bash
45
+ export VIEWRIUM_API_KEY=sk_live_...
46
+ ```
47
+
48
+ Both are supported; the module variable wins if both are set.
49
+
50
+ Other config (all optional):
51
+
52
+ | Variable | Env | Default |
53
+ |---|---|---|
54
+ | `viewrium.api_base` | `VIEWRIUM_API_BASE` | `https://api.viewrium.com` |
55
+ | `viewrium.timeout` | - | `60` seconds |
56
+ | `viewrium.max_retries` | - | `3` (retries 429 / 5xx, respects `Retry-After`) |
57
+
58
+ ## Quickstart (sync)
59
+
60
+ ```python
61
+ import viewrium
62
+
63
+ viewrium.api_key = "sk_live_..."
64
+
65
+ model = viewrium.Model.create(
66
+ custom_id="sku-1",
67
+ images=["https://example.com/img1.jpg", "https://example.com/img2.jpg"],
68
+ height=90,
69
+ tags=["chair", "summer-2026"],
70
+ )
71
+ print(model.id, model.status)
72
+
73
+ models = viewrium.Model.list(tag="chair", limit=20)
74
+ for m in models.data:
75
+ print(m.custom_id, m.status)
76
+ ```
77
+
78
+ ## Quickstart (async)
79
+
80
+ ```python
81
+ import asyncio
82
+ import viewrium
83
+
84
+ viewrium.api_key = "sk_live_..."
85
+
86
+ async def main():
87
+ model = await viewrium.AsyncModel.create(
88
+ custom_id="sku-1",
89
+ images=["https://example.com/img1.jpg"],
90
+ height=35,
91
+ size_unit="in", # converted to cm server-side
92
+ )
93
+ events = await viewrium.AsyncModel.list_events(model.id)
94
+ return model, events
95
+
96
+ asyncio.run(main())
97
+ ```
98
+
99
+ ## Resources
100
+
101
+ Each resource has a sync class and an `Async`-prefixed async twin.
102
+
103
+ | Sync | Async | Methods |
104
+ |---|---|---|
105
+ | `Model` | `AsyncModel` | `create`, `create_from_images`, `create_from_video`, `retrieve`, `list`, `modify`, `delete`, `list_events` |
106
+ | `ApiKey` | `AsyncApiKey` | `create`, `list`, `delete` |
107
+ | `Usage` | `AsyncUsage` | `retrieve` |
108
+ | `Tag` | `AsyncTag` | `list` |
109
+
110
+ ## Uploading files
111
+
112
+ ```python
113
+ model = viewrium.Model.create_from_images(
114
+ ["./chair-front.jpg", "./chair-side.jpg", "./chair-back.jpg"],
115
+ custom_id="sku-1",
116
+ height=90,
117
+ tags=["chair"],
118
+ )
119
+
120
+ model = viewrium.Model.create_from_video(
121
+ "./chair-walkaround.mp4",
122
+ custom_id="sku-2",
123
+ height=92,
124
+ )
125
+ ```
126
+
127
+ Paths are strings or `pathlib.Path`. Files are opened + closed by the SDK.
128
+
129
+ ## Sizing
130
+
131
+ Pass `height` + optional `size_unit` (`"cm"` or `"in"`, default `"cm"`). The server normalizes to cm before storing. Explicit `height` wins over scraped values; if neither is present, the model renders unscaled.
132
+
133
+ ## Errors
134
+
135
+ ```python
136
+ from viewrium import (
137
+ ViewriumError, # base class
138
+ AuthError, # 401 / missing key
139
+ NotFoundError, # 404
140
+ ValidationError, # 400 / 409 / 422
141
+ RateLimitError, # 429 (has .retry_after)
142
+ APIError, # 5xx / other
143
+ )
144
+
145
+ try:
146
+ viewrium.Model.retrieve("not-a-real-id")
147
+ except NotFoundError:
148
+ ...
149
+ except RateLimitError as e:
150
+ print("back off for", e.retry_after, "seconds")
151
+ ```
152
+
153
+ ## Cleanup
154
+
155
+ The SDK lazily opens HTTP clients and tears them down on process exit. If you need to close eagerly:
156
+
157
+ ```python
158
+ viewrium.close() # sync client
159
+ await viewrium.aclose() # async client
160
+ ```
161
+
162
+ ## License
163
+
164
+ Apache 2.0.
@@ -0,0 +1,142 @@
1
+ # viewrium
2
+
3
+ Official Python SDK for the [Viewrium](https://viewrium.com) API. Create and manage 3D models, API keys, and usage records.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install viewrium
9
+ ```
10
+
11
+ Python 3.10+.
12
+
13
+ ## Configure
14
+
15
+ ```python
16
+ import viewrium
17
+ viewrium.api_key = "sk_live_..."
18
+ ```
19
+
20
+ Or via environment variable:
21
+
22
+ ```bash
23
+ export VIEWRIUM_API_KEY=sk_live_...
24
+ ```
25
+
26
+ Both are supported; the module variable wins if both are set.
27
+
28
+ Other config (all optional):
29
+
30
+ | Variable | Env | Default |
31
+ |---|---|---|
32
+ | `viewrium.api_base` | `VIEWRIUM_API_BASE` | `https://api.viewrium.com` |
33
+ | `viewrium.timeout` | - | `60` seconds |
34
+ | `viewrium.max_retries` | - | `3` (retries 429 / 5xx, respects `Retry-After`) |
35
+
36
+ ## Quickstart (sync)
37
+
38
+ ```python
39
+ import viewrium
40
+
41
+ viewrium.api_key = "sk_live_..."
42
+
43
+ model = viewrium.Model.create(
44
+ custom_id="sku-1",
45
+ images=["https://example.com/img1.jpg", "https://example.com/img2.jpg"],
46
+ height=90,
47
+ tags=["chair", "summer-2026"],
48
+ )
49
+ print(model.id, model.status)
50
+
51
+ models = viewrium.Model.list(tag="chair", limit=20)
52
+ for m in models.data:
53
+ print(m.custom_id, m.status)
54
+ ```
55
+
56
+ ## Quickstart (async)
57
+
58
+ ```python
59
+ import asyncio
60
+ import viewrium
61
+
62
+ viewrium.api_key = "sk_live_..."
63
+
64
+ async def main():
65
+ model = await viewrium.AsyncModel.create(
66
+ custom_id="sku-1",
67
+ images=["https://example.com/img1.jpg"],
68
+ height=35,
69
+ size_unit="in", # converted to cm server-side
70
+ )
71
+ events = await viewrium.AsyncModel.list_events(model.id)
72
+ return model, events
73
+
74
+ asyncio.run(main())
75
+ ```
76
+
77
+ ## Resources
78
+
79
+ Each resource has a sync class and an `Async`-prefixed async twin.
80
+
81
+ | Sync | Async | Methods |
82
+ |---|---|---|
83
+ | `Model` | `AsyncModel` | `create`, `create_from_images`, `create_from_video`, `retrieve`, `list`, `modify`, `delete`, `list_events` |
84
+ | `ApiKey` | `AsyncApiKey` | `create`, `list`, `delete` |
85
+ | `Usage` | `AsyncUsage` | `retrieve` |
86
+ | `Tag` | `AsyncTag` | `list` |
87
+
88
+ ## Uploading files
89
+
90
+ ```python
91
+ model = viewrium.Model.create_from_images(
92
+ ["./chair-front.jpg", "./chair-side.jpg", "./chair-back.jpg"],
93
+ custom_id="sku-1",
94
+ height=90,
95
+ tags=["chair"],
96
+ )
97
+
98
+ model = viewrium.Model.create_from_video(
99
+ "./chair-walkaround.mp4",
100
+ custom_id="sku-2",
101
+ height=92,
102
+ )
103
+ ```
104
+
105
+ Paths are strings or `pathlib.Path`. Files are opened + closed by the SDK.
106
+
107
+ ## Sizing
108
+
109
+ Pass `height` + optional `size_unit` (`"cm"` or `"in"`, default `"cm"`). The server normalizes to cm before storing. Explicit `height` wins over scraped values; if neither is present, the model renders unscaled.
110
+
111
+ ## Errors
112
+
113
+ ```python
114
+ from viewrium import (
115
+ ViewriumError, # base class
116
+ AuthError, # 401 / missing key
117
+ NotFoundError, # 404
118
+ ValidationError, # 400 / 409 / 422
119
+ RateLimitError, # 429 (has .retry_after)
120
+ APIError, # 5xx / other
121
+ )
122
+
123
+ try:
124
+ viewrium.Model.retrieve("not-a-real-id")
125
+ except NotFoundError:
126
+ ...
127
+ except RateLimitError as e:
128
+ print("back off for", e.retry_after, "seconds")
129
+ ```
130
+
131
+ ## Cleanup
132
+
133
+ The SDK lazily opens HTTP clients and tears them down on process exit. If you need to close eagerly:
134
+
135
+ ```python
136
+ viewrium.close() # sync client
137
+ await viewrium.aclose() # async client
138
+ ```
139
+
140
+ ## License
141
+
142
+ Apache 2.0.
@@ -0,0 +1,34 @@
1
+ [project]
2
+ name = "viewrium"
3
+ version = "0.1.0"
4
+ description = "Official Python SDK for the Viewrium API. Create and manage 3D models, api keys, and usage records."
5
+ authors = [{ name = "Viewrium", email = "hello@viewrium.com" }]
6
+ license = { text = "Apache-2.0" }
7
+ readme = "README.md"
8
+ requires-python = ">=3.10"
9
+ keywords = ["viewrium", "3d", "ar", "model-viewer", "sdk", "api"]
10
+ classifiers = [
11
+ "Development Status :: 3 - Alpha",
12
+ "Intended Audience :: Developers",
13
+ "License :: OSI Approved :: Apache Software License",
14
+ "Programming Language :: Python :: 3",
15
+ "Programming Language :: Python :: 3.10",
16
+ "Programming Language :: Python :: 3.11",
17
+ "Programming Language :: Python :: 3.12",
18
+ "Topic :: Software Development :: Libraries",
19
+ ]
20
+ dependencies = [
21
+ "httpx>=0.27",
22
+ ]
23
+
24
+ [project.urls]
25
+ Homepage = "https://viewrium.com"
26
+ Repository = "https://github.com/davidzagyvaig/viewrium"
27
+ Documentation = "https://docs.viewrium.com"
28
+
29
+ [build-system]
30
+ requires = ["hatchling"]
31
+ build-backend = "hatchling.build"
32
+
33
+ [tool.hatch.build.targets.wheel]
34
+ packages = ["viewrium"]
@@ -0,0 +1,94 @@
1
+ """Official Python SDK for the Viewrium API.
2
+
3
+ Quickstart::
4
+
5
+ import viewrium
6
+
7
+ viewrium.api_key = "sk_live_..."
8
+
9
+ model = viewrium.Model.create(
10
+ custom_id="sku-1",
11
+ images=["https://example.com/img1.jpg"],
12
+ height=90,
13
+ tags=["chair"],
14
+ )
15
+
16
+ Async variant::
17
+
18
+ import asyncio
19
+ import viewrium
20
+
21
+ viewrium.api_key = "sk_live_..."
22
+
23
+ async def main():
24
+ return await viewrium.AsyncModel.create(
25
+ custom_id="sku-1",
26
+ images=["https://example.com/img1.jpg"],
27
+ height=90,
28
+ )
29
+
30
+ asyncio.run(main())
31
+
32
+ Configuration (all optional; env vars are used when module vars are unset):
33
+
34
+ - ``viewrium.api_key`` env ``VIEWRIUM_API_KEY`` (required at call time)
35
+ - ``viewrium.api_base`` env ``VIEWRIUM_API_BASE`` default ``https://api.viewrium.com``
36
+ - ``viewrium.timeout`` request timeout in seconds (default 60)
37
+ - ``viewrium.max_retries`` retries on 429 / 5xx (default 3, respects Retry-After)
38
+ """
39
+
40
+ from __future__ import annotations
41
+
42
+ __version__ = "0.1.0"
43
+
44
+ # Module-level configuration. Read on each request; env vars used as fallbacks.
45
+ api_key: str | None = None
46
+ api_base: str | None = None
47
+ timeout: float | None = None
48
+ max_retries: int | None = None
49
+
50
+ from ._client import aclose, close # noqa: E402
51
+ from ._errors import ( # noqa: E402
52
+ APIError,
53
+ AuthError,
54
+ NotFoundError,
55
+ RateLimitError,
56
+ ValidationError,
57
+ ViewriumError,
58
+ )
59
+ from ._object import ViewriumObject # noqa: E402
60
+ from .resources import ( # noqa: E402
61
+ ApiKey,
62
+ AsyncApiKey,
63
+ AsyncModel,
64
+ AsyncTag,
65
+ AsyncUsage,
66
+ Model,
67
+ Tag,
68
+ Usage,
69
+ )
70
+
71
+ __all__ = [
72
+ "__version__",
73
+ "api_key",
74
+ "api_base",
75
+ "timeout",
76
+ "max_retries",
77
+ "Model",
78
+ "AsyncModel",
79
+ "ApiKey",
80
+ "AsyncApiKey",
81
+ "Usage",
82
+ "AsyncUsage",
83
+ "Tag",
84
+ "AsyncTag",
85
+ "ViewriumObject",
86
+ "ViewriumError",
87
+ "AuthError",
88
+ "RateLimitError",
89
+ "ValidationError",
90
+ "NotFoundError",
91
+ "APIError",
92
+ "close",
93
+ "aclose",
94
+ ]