lastshoot 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,10 @@
1
+ node_modules/
2
+ dist/
3
+ *.tgz
4
+ .venv/
5
+ __pycache__/
6
+ *.egg-info/
7
+ .pytest_cache/
8
+ .mypy_cache/
9
+ coverage/
10
+ .env
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 LastShoot
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.
@@ -0,0 +1,193 @@
1
+ Metadata-Version: 2.5
2
+ Name: lastshoot
3
+ Version: 0.1.0
4
+ Summary: Official Python client for the LastShoot AI product-photography API
5
+ Project-URL: Repository, https://github.com/lastshoot-com/lastshoot-sdks
6
+ Project-URL: Issues, https://github.com/lastshoot-com/lastshoot-sdks/issues
7
+ Project-URL: Homepage, https://www.lastshoot.com
8
+ Project-URL: Documentation, https://www.lastshoot.com/docs/sdks/python
9
+ Project-URL: API reference, https://api.lastshoot.com/docs
10
+ Author: LastShoot
11
+ License-Expression: MIT
12
+ License-File: LICENSE
13
+ Keywords: ai,api,background removal,image generation,lastshoot,product photography,sdk,virtual try-on
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Programming Language :: Python :: 3.9
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: Topic :: Multimedia :: Graphics
25
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
26
+ Classifier: Typing :: Typed
27
+ Requires-Python: >=3.9
28
+ Requires-Dist: httpx<1,>=0.24
29
+ Provides-Extra: dev
30
+ Requires-Dist: build; extra == 'dev'
31
+ Requires-Dist: mypy>=1.8; extra == 'dev'
32
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
33
+ Requires-Dist: pytest>=7; extra == 'dev'
34
+ Requires-Dist: respx>=0.21; extra == 'dev'
35
+ Requires-Dist: twine; extra == 'dev'
36
+ Description-Content-Type: text/markdown
37
+
38
+ # LastShoot Python SDK
39
+
40
+ Official Python client for the [LastShoot](https://www.lastshoot.com) AI product-photography API:
41
+ product-to-model, virtual try-on, background change and removal, edits, upscaling, branding,
42
+ identity, video, speech and 3D.
43
+
44
+ ```bash
45
+ pip install lastshoot
46
+ ```
47
+
48
+ Requires Python 3.9+. One runtime dependency: `httpx`.
49
+
50
+ ## Quickstart
51
+
52
+ Get an API key from the [dashboard](https://www.lastshoot.com/dashboard).
53
+
54
+ ```python
55
+ from lastshoot import LastShoot
56
+
57
+ ip = LastShoot("ip_live_xxxxxxxxxxxx") # or LastShoot() with LASTSHOOT_API_KEY set
58
+
59
+ # Generate
60
+ result = ip.generate.image(prompt="fashion model, white studio background, editorial lighting")
61
+ print(result.url)
62
+
63
+ # Virtual try-on
64
+ result = ip.identity.tryon(
65
+ person_image="https://cdn.example.com/model.jpg",
66
+ clothing_image="https://cdn.example.com/shirt.jpg",
67
+ gender="woman",
68
+ clothing_type="shirt",
69
+ )
70
+ print(result.url)
71
+ ```
72
+
73
+ `result.url` is a temporary link (expires within 24 hours). Download and store the file.
74
+
75
+ ## Local files
76
+
77
+ Every image parameter takes a public URL. Upload a local file first:
78
+
79
+ ```python
80
+ uploaded = ip.upload.image("product.jpg") # path, bytes, or a file opened with "rb"
81
+ result = ip.background.change(
82
+ input_image=uploaded.url,
83
+ prompt="white marble table, soft daylight",
84
+ subject_description="glass perfume bottle",
85
+ )
86
+ ```
87
+
88
+ `ip.upload("product.jpg")` is shorthand for `ip.upload.image(...)`.
89
+
90
+ ## Jobs, progress and webhooks
91
+
92
+ Every compute method submits a job and blocks until it finishes. Pass `wait=False` to get a
93
+ `Job` back immediately, then wait when you are ready:
94
+
95
+ ```python
96
+ job = ip.edit.image(input_image=url, prompt="make the dress emerald green", wait=False)
97
+ print(job.job_id, job.status) # e.g. "queued"
98
+
99
+ result = job.wait(
100
+ poll_interval=2, # seconds between polls
101
+ timeout=600, # raise JobTimeoutError after this
102
+ on_progress=lambda s: print(s.status, s.progress),
103
+ )
104
+ print(result.url, result.mime_type, result.cost_usd)
105
+ ```
106
+
107
+ Look up any job later with `ip.jobs.get("/edit/image/v1", job_id)` (returns a `JobStatus`) or
108
+ `ip.jobs.wait("/edit/image/v1", job_id)`.
109
+
110
+ Pass `callback_url=` to any compute method to have a `WebhookEvent` POSTed when the job
111
+ finishes. `lastshoot.WebhookEvent` is a `TypedDict` of that payload.
112
+
113
+ ## Methods
114
+
115
+ | Method | Endpoint |
116
+ | --- | --- |
117
+ | `ip.generate.image(prompt=...)` | `POST /generate/image/v1` |
118
+ | `ip.generate.video(input_image=...)` | `POST /generate/video/v1` |
119
+ | `ip.generate.speech(text=...)` | `POST /generate/speech/v1` |
120
+ | `ip.generate.generate_3d(image_path=...)` | `POST /generate/3d/v1` |
121
+ | `ip.edit.image(prompt=..., input_image=...)` | `POST /edit/image/v1` |
122
+ | `ip.background.change(input_image=..., prompt=..., subject_description=...)` | `POST /background/change/image/v1` |
123
+ | `ip.background.remove(input_image=...)` | `POST /background/remove/image/v1` |
124
+ | `ip.upscale.image(input_image=...)` | `POST /upscale/image/v1` |
125
+ | `ip.branding.logo(input_image=..., logo_url=...)` | `POST /branding/logo/image/v1` |
126
+ | `ip.branding.template(input_image=...)` | `POST /branding/template/image/v1` |
127
+ | `ip.identity.tryon(person_image=..., clothing_image=..., gender=..., clothing_type=...)` | `POST /creator/tryon/image/v1` |
128
+ | `ip.identity.faceswap(target=..., source=...)` | `POST /identity/faceswap/image/v1` |
129
+ | `ip.identity.lock(input_image=..., prompt=...)` | `POST /identity/lock/image/v1` |
130
+ | `ip.identity.replace(input_image=..., prompt=...)` | `POST /identity/replace/image/v1` |
131
+ | `ip.identity.instamodel(prompt=..., input_face=...)` | `POST /creator/instamodel/image/v1` |
132
+ | `ip.identity.voice_clone(text=..., reference_voice_url=...)` | `POST /identity/voice/clone/v1` |
133
+ | `ip.identity.create_profile / list_profiles / get_profile / update_profile / delete_profile` | `/profiles/v1` |
134
+ | `ip.upload.image(file)` | `POST /upload/image/v1` |
135
+ | `ip.jobs.get(endpoint, job_id)` / `ip.jobs.wait(endpoint, job_id)` | `GET <endpoint>/status/{job_id}` |
136
+
137
+ All parameters are keyword arguments in snake_case, typed from the live
138
+ [OpenAPI spec](https://api.lastshoot.com/docs). Options you leave out use the server default.
139
+ Full parameter reference: [lastshoot.com/docs/sdks/python](https://www.lastshoot.com/docs/sdks/python).
140
+
141
+ ## Async
142
+
143
+ ```python
144
+ import asyncio
145
+ from lastshoot import AsyncLastShoot
146
+
147
+ async def main():
148
+ async with AsyncLastShoot() as ip:
149
+ result = await ip.upscale.image(input_image="https://cdn.example.com/shoe.jpg", scale=2)
150
+ print(result.url)
151
+
152
+ asyncio.run(main())
153
+ ```
154
+
155
+ ## Errors
156
+
157
+ ```python
158
+ from lastshoot import (
159
+ LastShootError, # base class
160
+ APIError, # any non-2xx response: .status_code .message .code .body
161
+ AuthenticationError, # 401
162
+ InsufficientCreditsError, # 402
163
+ PermissionDeniedError, # 403
164
+ NotFoundError, # 404
165
+ InvalidRequestError, # 400 / 422
166
+ RateLimitError, # 429 (.retry_after)
167
+ InternalServerError, # 5xx
168
+ APIConnectionError, APITimeoutError,
169
+ JobFailedError, # job ended failed/cancelled: .failure_reason_code .retryable .error
170
+ JobTimeoutError, # wait() gave up; the job keeps running server-side
171
+ )
172
+ ```
173
+
174
+ Status polls (GET) retry automatically on 429, 5xx and network errors with exponential
175
+ backoff (`max_retries=2` by default). Job submissions (POST) are never retried automatically,
176
+ so a job is never billed twice.
177
+
178
+ ## Configuration
179
+
180
+ ```python
181
+ LastShoot(
182
+ api_key=None, # default: LASTSHOOT_API_KEY env var
183
+ base_url="https://api.lastshoot.com",
184
+ timeout=60.0, # per HTTP request
185
+ max_retries=2, # GET retries
186
+ poll_interval=2.0, # default for wait()
187
+ wait_timeout=600.0, # default for wait()
188
+ )
189
+ ```
190
+
191
+ ## License
192
+
193
+ MIT
@@ -0,0 +1,156 @@
1
+ # LastShoot Python SDK
2
+
3
+ Official Python client for the [LastShoot](https://www.lastshoot.com) AI product-photography API:
4
+ product-to-model, virtual try-on, background change and removal, edits, upscaling, branding,
5
+ identity, video, speech and 3D.
6
+
7
+ ```bash
8
+ pip install lastshoot
9
+ ```
10
+
11
+ Requires Python 3.9+. One runtime dependency: `httpx`.
12
+
13
+ ## Quickstart
14
+
15
+ Get an API key from the [dashboard](https://www.lastshoot.com/dashboard).
16
+
17
+ ```python
18
+ from lastshoot import LastShoot
19
+
20
+ ip = LastShoot("ip_live_xxxxxxxxxxxx") # or LastShoot() with LASTSHOOT_API_KEY set
21
+
22
+ # Generate
23
+ result = ip.generate.image(prompt="fashion model, white studio background, editorial lighting")
24
+ print(result.url)
25
+
26
+ # Virtual try-on
27
+ result = ip.identity.tryon(
28
+ person_image="https://cdn.example.com/model.jpg",
29
+ clothing_image="https://cdn.example.com/shirt.jpg",
30
+ gender="woman",
31
+ clothing_type="shirt",
32
+ )
33
+ print(result.url)
34
+ ```
35
+
36
+ `result.url` is a temporary link (expires within 24 hours). Download and store the file.
37
+
38
+ ## Local files
39
+
40
+ Every image parameter takes a public URL. Upload a local file first:
41
+
42
+ ```python
43
+ uploaded = ip.upload.image("product.jpg") # path, bytes, or a file opened with "rb"
44
+ result = ip.background.change(
45
+ input_image=uploaded.url,
46
+ prompt="white marble table, soft daylight",
47
+ subject_description="glass perfume bottle",
48
+ )
49
+ ```
50
+
51
+ `ip.upload("product.jpg")` is shorthand for `ip.upload.image(...)`.
52
+
53
+ ## Jobs, progress and webhooks
54
+
55
+ Every compute method submits a job and blocks until it finishes. Pass `wait=False` to get a
56
+ `Job` back immediately, then wait when you are ready:
57
+
58
+ ```python
59
+ job = ip.edit.image(input_image=url, prompt="make the dress emerald green", wait=False)
60
+ print(job.job_id, job.status) # e.g. "queued"
61
+
62
+ result = job.wait(
63
+ poll_interval=2, # seconds between polls
64
+ timeout=600, # raise JobTimeoutError after this
65
+ on_progress=lambda s: print(s.status, s.progress),
66
+ )
67
+ print(result.url, result.mime_type, result.cost_usd)
68
+ ```
69
+
70
+ Look up any job later with `ip.jobs.get("/edit/image/v1", job_id)` (returns a `JobStatus`) or
71
+ `ip.jobs.wait("/edit/image/v1", job_id)`.
72
+
73
+ Pass `callback_url=` to any compute method to have a `WebhookEvent` POSTed when the job
74
+ finishes. `lastshoot.WebhookEvent` is a `TypedDict` of that payload.
75
+
76
+ ## Methods
77
+
78
+ | Method | Endpoint |
79
+ | --- | --- |
80
+ | `ip.generate.image(prompt=...)` | `POST /generate/image/v1` |
81
+ | `ip.generate.video(input_image=...)` | `POST /generate/video/v1` |
82
+ | `ip.generate.speech(text=...)` | `POST /generate/speech/v1` |
83
+ | `ip.generate.generate_3d(image_path=...)` | `POST /generate/3d/v1` |
84
+ | `ip.edit.image(prompt=..., input_image=...)` | `POST /edit/image/v1` |
85
+ | `ip.background.change(input_image=..., prompt=..., subject_description=...)` | `POST /background/change/image/v1` |
86
+ | `ip.background.remove(input_image=...)` | `POST /background/remove/image/v1` |
87
+ | `ip.upscale.image(input_image=...)` | `POST /upscale/image/v1` |
88
+ | `ip.branding.logo(input_image=..., logo_url=...)` | `POST /branding/logo/image/v1` |
89
+ | `ip.branding.template(input_image=...)` | `POST /branding/template/image/v1` |
90
+ | `ip.identity.tryon(person_image=..., clothing_image=..., gender=..., clothing_type=...)` | `POST /creator/tryon/image/v1` |
91
+ | `ip.identity.faceswap(target=..., source=...)` | `POST /identity/faceswap/image/v1` |
92
+ | `ip.identity.lock(input_image=..., prompt=...)` | `POST /identity/lock/image/v1` |
93
+ | `ip.identity.replace(input_image=..., prompt=...)` | `POST /identity/replace/image/v1` |
94
+ | `ip.identity.instamodel(prompt=..., input_face=...)` | `POST /creator/instamodel/image/v1` |
95
+ | `ip.identity.voice_clone(text=..., reference_voice_url=...)` | `POST /identity/voice/clone/v1` |
96
+ | `ip.identity.create_profile / list_profiles / get_profile / update_profile / delete_profile` | `/profiles/v1` |
97
+ | `ip.upload.image(file)` | `POST /upload/image/v1` |
98
+ | `ip.jobs.get(endpoint, job_id)` / `ip.jobs.wait(endpoint, job_id)` | `GET <endpoint>/status/{job_id}` |
99
+
100
+ All parameters are keyword arguments in snake_case, typed from the live
101
+ [OpenAPI spec](https://api.lastshoot.com/docs). Options you leave out use the server default.
102
+ Full parameter reference: [lastshoot.com/docs/sdks/python](https://www.lastshoot.com/docs/sdks/python).
103
+
104
+ ## Async
105
+
106
+ ```python
107
+ import asyncio
108
+ from lastshoot import AsyncLastShoot
109
+
110
+ async def main():
111
+ async with AsyncLastShoot() as ip:
112
+ result = await ip.upscale.image(input_image="https://cdn.example.com/shoe.jpg", scale=2)
113
+ print(result.url)
114
+
115
+ asyncio.run(main())
116
+ ```
117
+
118
+ ## Errors
119
+
120
+ ```python
121
+ from lastshoot import (
122
+ LastShootError, # base class
123
+ APIError, # any non-2xx response: .status_code .message .code .body
124
+ AuthenticationError, # 401
125
+ InsufficientCreditsError, # 402
126
+ PermissionDeniedError, # 403
127
+ NotFoundError, # 404
128
+ InvalidRequestError, # 400 / 422
129
+ RateLimitError, # 429 (.retry_after)
130
+ InternalServerError, # 5xx
131
+ APIConnectionError, APITimeoutError,
132
+ JobFailedError, # job ended failed/cancelled: .failure_reason_code .retryable .error
133
+ JobTimeoutError, # wait() gave up; the job keeps running server-side
134
+ )
135
+ ```
136
+
137
+ Status polls (GET) retry automatically on 429, 5xx and network errors with exponential
138
+ backoff (`max_retries=2` by default). Job submissions (POST) are never retried automatically,
139
+ so a job is never billed twice.
140
+
141
+ ## Configuration
142
+
143
+ ```python
144
+ LastShoot(
145
+ api_key=None, # default: LASTSHOOT_API_KEY env var
146
+ base_url="https://api.lastshoot.com",
147
+ timeout=60.0, # per HTTP request
148
+ max_retries=2, # GET retries
149
+ poll_interval=2.0, # default for wait()
150
+ wait_timeout=600.0, # default for wait()
151
+ )
152
+ ```
153
+
154
+ ## License
155
+
156
+ MIT
@@ -0,0 +1,56 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.21"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "lastshoot"
7
+ version = "0.1.0"
8
+ description = "Official Python client for the LastShoot AI product-photography API"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [{ name = "LastShoot" }]
14
+ keywords = ["lastshoot", "ai", "product photography", "virtual try-on", "background removal", "image generation", "api", "sdk"]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Intended Audience :: Developers",
18
+ "Operating System :: OS Independent",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3 :: Only",
21
+ "Programming Language :: Python :: 3.9",
22
+ "Programming Language :: Python :: 3.10",
23
+ "Programming Language :: Python :: 3.11",
24
+ "Programming Language :: Python :: 3.12",
25
+ "Programming Language :: Python :: 3.13",
26
+ "Topic :: Multimedia :: Graphics",
27
+ "Topic :: Software Development :: Libraries :: Python Modules",
28
+ "Typing :: Typed",
29
+ ]
30
+ dependencies = ["httpx>=0.24,<1"]
31
+
32
+ [project.optional-dependencies]
33
+ dev = ["pytest>=7", "pytest-asyncio>=0.23", "respx>=0.21", "mypy>=1.8", "build", "twine"]
34
+
35
+ [project.urls]
36
+ Repository = "https://github.com/lastshoot-com/lastshoot-sdks"
37
+ Issues = "https://github.com/lastshoot-com/lastshoot-sdks/issues"
38
+ Homepage = "https://www.lastshoot.com"
39
+ Documentation = "https://www.lastshoot.com/docs/sdks/python"
40
+ "API reference" = "https://api.lastshoot.com/docs"
41
+
42
+ [tool.hatch.build.targets.wheel]
43
+ packages = ["src/lastshoot"]
44
+
45
+ [tool.hatch.build.targets.sdist]
46
+ include = ["src/lastshoot", "tests", "README.md", "LICENSE", "pyproject.toml"]
47
+
48
+ [tool.pytest.ini_options]
49
+ testpaths = ["tests"]
50
+ asyncio_mode = "auto"
51
+ asyncio_default_fixture_loop_scope = "function"
52
+
53
+ [tool.mypy]
54
+ strict = true
55
+ python_version = "3.10"
56
+ files = ["src/lastshoot"]
@@ -0,0 +1,63 @@
1
+ """Official Python client for the LastShoot API (https://www.lastshoot.com)."""
2
+
3
+ from ._client import DEFAULT_BASE_URL, AsyncLastShoot, FileInput, LastShoot
4
+ from ._endpoints import (
5
+ AdapterConfigSnapshot,
6
+ JobQueuedData,
7
+ JobStatusData,
8
+ Profile,
9
+ ProfileList,
10
+ UploadData,
11
+ WebhookEvent,
12
+ )
13
+ from ._exceptions import (
14
+ APIConnectionError,
15
+ APIError,
16
+ APITimeoutError,
17
+ AuthenticationError,
18
+ InsufficientCreditsError,
19
+ InternalServerError,
20
+ InvalidRequestError,
21
+ JobFailedError,
22
+ JobTimeoutError,
23
+ LastShootError,
24
+ NotFoundError,
25
+ PermissionDeniedError,
26
+ RateLimitError,
27
+ )
28
+ from ._models import AsyncJob, Job, JobStatus, ProgressCallback, Result, UploadResult
29
+ from ._version import __version__
30
+
31
+ __all__ = [
32
+ "__version__",
33
+ "DEFAULT_BASE_URL",
34
+ "LastShoot",
35
+ "AsyncLastShoot",
36
+ "FileInput",
37
+ "Job",
38
+ "AsyncJob",
39
+ "JobStatus",
40
+ "Result",
41
+ "UploadResult",
42
+ "ProgressCallback",
43
+ "AdapterConfigSnapshot",
44
+ "JobQueuedData",
45
+ "JobStatusData",
46
+ "Profile",
47
+ "ProfileList",
48
+ "UploadData",
49
+ "WebhookEvent",
50
+ "LastShootError",
51
+ "APIError",
52
+ "InvalidRequestError",
53
+ "AuthenticationError",
54
+ "InsufficientCreditsError",
55
+ "PermissionDeniedError",
56
+ "NotFoundError",
57
+ "RateLimitError",
58
+ "InternalServerError",
59
+ "APIConnectionError",
60
+ "APITimeoutError",
61
+ "JobFailedError",
62
+ "JobTimeoutError",
63
+ ]