useknockout 0.7.0__tar.gz → 0.8.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 @@
1
+ *
File without changes
@@ -0,0 +1,8 @@
1
+ 01:27:19 [hook] session-start: PROJECT_DIR=C:/Users/Troy/projects/useknockout-python PIPELINE_DIR=C:/Users/Troy/.claude/plugins/cache/claude-plugins-official/remember/0.8.3 REMEMBER_DIR=C:/Users/Troy/projects/useknockout-python/.remember
2
+ 01:29:21 [hook] post-tool: PROJECT_DIR=C:/Users/Troy/projects/useknockout-python PIPELINE_DIR=C:/Users/Troy/.claude/plugins/cache/claude-plugins-official/remember/0.8.3 PYTHON=python REMEMBER_DIR=C:/Users/Troy/projects/useknockout-python/.remember
3
+ 01:29:24 [hook] post-tool: PROJECT_DIR=C:/Users/Troy/projects/useknockout-python PIPELINE_DIR=C:/Users/Troy/.claude/plugins/cache/claude-plugins-official/remember/0.8.3 PYTHON=python REMEMBER_DIR=C:/Users/Troy/projects/useknockout-python/.remember
4
+ 01:29:35 [hook] post-tool: PROJECT_DIR=C:/Users/Troy/projects/useknockout-python PIPELINE_DIR=C:/Users/Troy/.claude/plugins/cache/claude-plugins-official/remember/0.8.3 PYTHON=python REMEMBER_DIR=C:/Users/Troy/projects/useknockout-python/.remember
5
+ 01:29:46 [hook] post-tool: PROJECT_DIR=C:/Users/Troy/projects/useknockout-python PIPELINE_DIR=C:/Users/Troy/.claude/plugins/cache/claude-plugins-official/remember/0.8.3 PYTHON=python REMEMBER_DIR=C:/Users/Troy/projects/useknockout-python/.remember
6
+ 01:30:06 [hook] post-tool: PROJECT_DIR=C:/Users/Troy/projects/useknockout-python PIPELINE_DIR=C:/Users/Troy/.claude/plugins/cache/claude-plugins-official/remember/0.8.3 PYTHON=python REMEMBER_DIR=C:/Users/Troy/projects/useknockout-python/.remember
7
+ 01:30:12 [hook] post-tool: PROJECT_DIR=C:/Users/Troy/projects/useknockout-python PIPELINE_DIR=C:/Users/Troy/.claude/plugins/cache/claude-plugins-official/remember/0.8.3 PYTHON=python REMEMBER_DIR=C:/Users/Troy/projects/useknockout-python/.remember
8
+ 01:30:33 [hook] post-tool: PROJECT_DIR=C:/Users/Troy/projects/useknockout-python PIPELINE_DIR=C:/Users/Troy/.claude/plugins/cache/claude-plugins-official/remember/0.8.3 PYTHON=python REMEMBER_DIR=C:/Users/Troy/projects/useknockout-python/.remember
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: useknockout
3
- Version: 0.7.0
3
+ Version: 0.8.0
4
4
  Summary: Python SDK for useknockout — state-of-the-art background removal API.
5
5
  Project-URL: Homepage, https://useknockout.com
6
6
  Project-URL: Documentation, https://github.com/useknockout/python
@@ -1,60 +1,60 @@
1
- [build-system]
2
- requires = ["hatchling"]
3
- build-backend = "hatchling.build"
4
-
5
- [project]
6
- name = "useknockout"
7
- version = "0.7.0"
8
- description = "Python SDK for useknockout — state-of-the-art background removal API."
9
- readme = "README.md"
10
- license = { text = "MIT" }
11
- requires-python = ">=3.9"
12
- authors = [{ name = "useknockout" }]
13
- keywords = [
14
- "background-removal",
15
- "remove-background",
16
- "birefnet",
17
- "ai",
18
- "image-processing",
19
- "useknockout",
20
- ]
21
- classifiers = [
22
- "Development Status :: 4 - Beta",
23
- "Intended Audience :: Developers",
24
- "License :: OSI Approved :: MIT License",
25
- "Programming Language :: Python :: 3",
26
- "Programming Language :: Python :: 3.9",
27
- "Programming Language :: Python :: 3.10",
28
- "Programming Language :: Python :: 3.11",
29
- "Programming Language :: Python :: 3.12",
30
- "Programming Language :: Python :: 3.13",
31
- "Topic :: Multimedia :: Graphics",
32
- "Topic :: Scientific/Engineering :: Image Processing",
33
- ]
34
- dependencies = [
35
- "httpx>=0.27.0",
36
- ]
37
-
38
- [project.optional-dependencies]
39
- dev = [
40
- "pytest>=8.0",
41
- "pytest-asyncio>=0.23",
42
- "ruff>=0.6.0",
43
- "mypy>=1.10",
44
- ]
45
-
46
- [project.urls]
47
- Homepage = "https://useknockout.com"
48
- Documentation = "https://github.com/useknockout/python"
49
- Repository = "https://github.com/useknockout/python"
50
- Issues = "https://github.com/useknockout/python/issues"
51
-
52
- [tool.hatch.build.targets.wheel]
53
- packages = ["src/useknockout"]
54
-
55
- [tool.ruff]
56
- line-length = 100
57
- target-version = "py39"
58
-
59
- [tool.ruff.lint]
60
- select = ["E", "F", "I", "W", "UP"]
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "useknockout"
7
+ version = "0.8.0"
8
+ description = "Python SDK for useknockout — state-of-the-art background removal API."
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ requires-python = ">=3.9"
12
+ authors = [{ name = "useknockout" }]
13
+ keywords = [
14
+ "background-removal",
15
+ "remove-background",
16
+ "birefnet",
17
+ "ai",
18
+ "image-processing",
19
+ "useknockout",
20
+ ]
21
+ classifiers = [
22
+ "Development Status :: 4 - Beta",
23
+ "Intended Audience :: Developers",
24
+ "License :: OSI Approved :: MIT License",
25
+ "Programming Language :: Python :: 3",
26
+ "Programming Language :: Python :: 3.9",
27
+ "Programming Language :: Python :: 3.10",
28
+ "Programming Language :: Python :: 3.11",
29
+ "Programming Language :: Python :: 3.12",
30
+ "Programming Language :: Python :: 3.13",
31
+ "Topic :: Multimedia :: Graphics",
32
+ "Topic :: Scientific/Engineering :: Image Processing",
33
+ ]
34
+ dependencies = [
35
+ "httpx>=0.27.0",
36
+ ]
37
+
38
+ [project.optional-dependencies]
39
+ dev = [
40
+ "pytest>=8.0",
41
+ "pytest-asyncio>=0.23",
42
+ "ruff>=0.6.0",
43
+ "mypy>=1.10",
44
+ ]
45
+
46
+ [project.urls]
47
+ Homepage = "https://useknockout.com"
48
+ Documentation = "https://github.com/useknockout/python"
49
+ Repository = "https://github.com/useknockout/python"
50
+ Issues = "https://github.com/useknockout/python/issues"
51
+
52
+ [tool.hatch.build.targets.wheel]
53
+ packages = ["src/useknockout"]
54
+
55
+ [tool.ruff]
56
+ line-length = 100
57
+ target-version = "py39"
58
+
59
+ [tool.ruff.lint]
60
+ select = ["E", "F", "I", "W", "UP"]
@@ -110,20 +110,47 @@ class AsyncKnockout:
110
110
  async def stats(self) -> Dict[str, Any]:
111
111
  return await self._request_json("GET", "/stats")
112
112
 
113
- async def remove(self, file: FileInput, *, format: str = "png") -> bytes:
114
- # /remove reads `format` as a QUERY param (bare default in the API).
113
+ async def remove(
114
+ self,
115
+ file: FileInput,
116
+ *,
117
+ format: str = "png",
118
+ edge: str = "soft",
119
+ detect: str = "standard",
120
+ decontaminate: bool = False,
121
+ ) -> bytes:
122
+ # All params are Form fields — they must ride in the multipart body.
115
123
  return await self._request_bytes(
116
124
  "POST",
117
125
  "/remove",
118
126
  files=_multipart_files(file),
119
- params={"format": format},
127
+ data=_form({
128
+ "format": format,
129
+ "edge": edge,
130
+ "detect": detect,
131
+ "decontaminate": decontaminate,
132
+ }),
120
133
  )
121
134
 
122
- async def remove_url(self, url: str, *, format: str = "png") -> bytes:
135
+ async def remove_url(
136
+ self,
137
+ url: str,
138
+ *,
139
+ format: str = "png",
140
+ edge: str = "soft",
141
+ detect: str = "standard",
142
+ decontaminate: bool = False,
143
+ ) -> bytes:
123
144
  return await self._request_bytes(
124
145
  "POST",
125
146
  "/remove-url",
126
- json={"url": url, "format": format},
147
+ json={
148
+ "url": url,
149
+ "format": format,
150
+ "edge": edge,
151
+ "detect": detect,
152
+ "decontaminate": decontaminate,
153
+ },
127
154
  )
128
155
 
129
156
  async def replace_background(
@@ -181,12 +208,20 @@ class AsyncKnockout:
181
208
  padding: int = 24,
182
209
  transparent: bool = True,
183
210
  format: str = "png",
211
+ detect: str = "standard",
212
+ decontaminate: bool = False,
184
213
  ) -> bytes:
185
214
  return await self._request_bytes(
186
215
  "POST",
187
216
  "/smart-crop",
188
217
  files=_multipart_files(file),
189
- data=_form({"padding": padding, "transparent": transparent, "format": format}),
218
+ data=_form({
219
+ "padding": padding,
220
+ "transparent": transparent,
221
+ "format": format,
222
+ "detect": detect,
223
+ "decontaminate": decontaminate,
224
+ }),
190
225
  )
191
226
 
192
227
  async def shadow(
@@ -266,6 +301,8 @@ class AsyncKnockout:
266
301
  enhance: bool = False,
267
302
  enhance_strength: float = 0.15,
268
303
  format: str = "jpg",
304
+ detect: str = "standard",
305
+ decontaminate: bool = False,
269
306
  ) -> bytes:
270
307
  return await self._request_bytes(
271
308
  "POST",
@@ -281,6 +318,8 @@ class AsyncKnockout:
281
318
  "enhance": enhance,
282
319
  "enhance_strength": enhance_strength,
283
320
  "format": format,
321
+ "detect": detect,
322
+ "decontaminate": decontaminate,
284
323
  }
285
324
  ),
286
325
  )
@@ -124,23 +124,58 @@ class Knockout:
124
124
  """GET /stats — public usage counter (total + today + last 7 days)."""
125
125
  return self._request_json("GET", "/stats")
126
126
 
127
- def remove(self, file: FileInput, *, format: str = "png") -> bytes:
128
- """POST /remove — remove background, return transparent PNG/WebP bytes."""
129
- # /remove reads `format` as a QUERY param (bare default in the API), unlike
130
- # the Form()-based endpoints. Sending it in the body would be ignored.
127
+ def remove(
128
+ self,
129
+ file: FileInput,
130
+ *,
131
+ format: str = "png",
132
+ edge: str = "soft",
133
+ detect: str = "standard",
134
+ decontaminate: bool = False,
135
+ ) -> bytes:
136
+ """POST /remove — remove background, return transparent PNG/WebP bytes.
137
+
138
+ edge: "soft" (default) or "hard" — hard commits ambiguous edge pixels
139
+ for a crisp product cut; keep soft for hair and fur.
140
+ detect: "standard" (default) or "high_recall" — second pass recovers
141
+ low-contrast product edges. Paid tiers; roughly 2x latency.
142
+ decontaminate: remove background-colored contamination at mask edges.
143
+ """
144
+ # NOTE: the API reads ALL of these as Form fields — they must go in the
145
+ # multipart body. (A previous version sent format as a query param,
146
+ # which the API silently ignored.)
131
147
  return self._request_bytes(
132
148
  "POST",
133
149
  "/remove",
134
150
  files=_multipart_files(file),
135
- params={"format": format},
151
+ data=_form({
152
+ "format": format,
153
+ "edge": edge,
154
+ "detect": detect,
155
+ "decontaminate": decontaminate,
156
+ }),
136
157
  )
137
158
 
138
- def remove_url(self, url: str, *, format: str = "png") -> bytes:
159
+ def remove_url(
160
+ self,
161
+ url: str,
162
+ *,
163
+ format: str = "png",
164
+ edge: str = "soft",
165
+ detect: str = "standard",
166
+ decontaminate: bool = False,
167
+ ) -> bytes:
139
168
  """POST /remove-url — fetch remote image, return transparent PNG/WebP."""
140
169
  return self._request_bytes(
141
170
  "POST",
142
171
  "/remove-url",
143
- json={"url": url, "format": format},
172
+ json={
173
+ "url": url,
174
+ "format": format,
175
+ "edge": edge,
176
+ "detect": detect,
177
+ "decontaminate": decontaminate,
178
+ },
144
179
  )
145
180
 
146
181
  def replace_background(
@@ -202,13 +237,21 @@ class Knockout:
202
237
  padding: int = 24,
203
238
  transparent: bool = True,
204
239
  format: str = "png",
240
+ detect: str = "standard",
241
+ decontaminate: bool = False,
205
242
  ) -> bytes:
206
243
  """POST /smart-crop — crop to subject bbox + padding."""
207
244
  return self._request_bytes(
208
245
  "POST",
209
246
  "/smart-crop",
210
247
  files=_multipart_files(file),
211
- data=_form({"padding": padding, "transparent": transparent, "format": format}),
248
+ data=_form({
249
+ "padding": padding,
250
+ "transparent": transparent,
251
+ "format": format,
252
+ "detect": detect,
253
+ "decontaminate": decontaminate,
254
+ }),
212
255
  )
213
256
 
214
257
  def shadow(
@@ -291,6 +334,8 @@ class Knockout:
291
334
  enhance: bool = False,
292
335
  enhance_strength: float = 0.15,
293
336
  format: str = "jpg",
337
+ detect: str = "standard",
338
+ decontaminate: bool = False,
294
339
  ) -> bytes:
295
340
  """POST /studio-shot — e-commerce preset (cutout + crop + center + shadow).
296
341
 
@@ -315,6 +360,8 @@ class Knockout:
315
360
  "enhance": enhance,
316
361
  "enhance_strength": enhance_strength,
317
362
  "format": format,
363
+ "detect": detect,
364
+ "decontaminate": decontaminate,
318
365
  }
319
366
  ),
320
367
  )
File without changes
File without changes
File without changes
File without changes
File without changes