bladekit 4.43.3__tar.gz → 4.43.5__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 (35) hide show
  1. {bladekit-4.43.3 → bladekit-4.43.5}/PKG-INFO +1 -1
  2. {bladekit-4.43.3 → bladekit-4.43.5}/pyproject.toml +1 -1
  3. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/_app.py +4 -0
  4. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/_client.py +23 -2
  5. {bladekit-4.43.3 → bladekit-4.43.5}/.gitignore +0 -0
  6. {bladekit-4.43.3 → bladekit-4.43.5}/README.md +0 -0
  7. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/__init__.py +0 -0
  8. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/_banner.py +0 -0
  9. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/_batch.py +0 -0
  10. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/_bucket.py +0 -0
  11. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/_build.py +0 -0
  12. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/_bundle.py +0 -0
  13. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/_cls.py +0 -0
  14. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/_constants.py +0 -0
  15. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/_cron.py +0 -0
  16. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/_dict.py +0 -0
  17. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/_env.py +0 -0
  18. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/_exported_metrics.py +0 -0
  19. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/_image.py +0 -0
  20. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/_loader.py +0 -0
  21. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/_map.py +0 -0
  22. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/_metrics_cli.py +0 -0
  23. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/_preempt.py +0 -0
  24. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/_queue.py +0 -0
  25. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/_render.py +0 -0
  26. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/_runner_api.py +0 -0
  27. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/_sandbox.py +0 -0
  28. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/_secret.py +0 -0
  29. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/_serialize.py +0 -0
  30. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/_serve.py +0 -0
  31. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/_volume.py +0 -0
  32. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/_webhook.py +0 -0
  33. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/cli.py +0 -0
  34. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/config.py +0 -0
  35. {bladekit-4.43.3 → bladekit-4.43.5}/src/bladekit/exceptions.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bladekit
3
- Version: 4.43.3
3
+ Version: 4.43.5
4
4
  Summary: Blade AI Fabric SDK + CLI — run Python functions on Blade's GPU fleet.
5
5
  Project-URL: Homepage, https://blade.sh
6
6
  Project-URL: Documentation, https://console.blade.sh
@@ -16,7 +16,7 @@
16
16
  # uninstalled during an upgrade, and `forge` is a different project's name on
17
17
  # public PyPI.
18
18
  name = "bladekit"
19
- version = "4.43.3"
19
+ version = "4.43.5"
20
20
  description = "Blade AI Fabric SDK + CLI — run Python functions on Blade's GPU fleet."
21
21
  readme = "README.md"
22
22
  requires-python = ">=3.10"
@@ -1854,6 +1854,9 @@ class _NamedFunction:
1854
1854
  headers=headers,
1855
1855
  params=params,
1856
1856
  url=_absolute_endpoint_url(endpoint),
1857
+ # Known only for a resolved endpoint; an explicit path= keeps the
1858
+ # token (the endpoint's auth is unknown, and a private one needs it).
1859
+ public=bool((endpoint or {}).get("public")),
1857
1860
  )
1858
1861
  except exc.NotFoundError:
1859
1862
  # The cached endpoint went stale mid-flight (redeploy or rollback
@@ -1883,6 +1886,7 @@ class _NamedFunction:
1883
1886
  headers=headers,
1884
1887
  params=params,
1885
1888
  url=_absolute_endpoint_url(retry_endpoint),
1889
+ public=bool(retry_endpoint.get("public")),
1886
1890
  )
1887
1891
 
1888
1892
  def web(
@@ -229,11 +229,22 @@ class Client:
229
229
 
230
230
  # -- low level ----------------------------------------------------------
231
231
 
232
- def _request(self, method: str, path: str, **kwargs: Any) -> Any:
232
+ def _request(
233
+ self, method: str, path: str, *, send_token: bool = True, **kwargs: Any
234
+ ) -> Any:
233
235
  import httpx
234
236
 
235
237
  try:
236
- resp = self._http.request(method, path, **kwargs)
238
+ if send_token:
239
+ resp = self._http.request(method, path, **kwargs)
240
+ else:
241
+ # Without the client's own Bearer token. A caller-supplied
242
+ # Authorization (the app's own credential) is the caller's to send.
243
+ req = self._http.build_request(method, path, **kwargs)
244
+ caller_headers = kwargs.get("headers") or {}
245
+ if not any(k.lower() == "authorization" for k in caller_headers):
246
+ req.headers.pop("Authorization", None)
247
+ resp = self._http.send(req)
237
248
  except httpx.HTTPError as e: # connect/read/timeout
238
249
  raise exc.ConnectionFailed(
239
250
  f"could not reach control plane at {self.base_url}: {e}"
@@ -900,7 +911,16 @@ class Client:
900
911
  headers: Optional[Mapping[str, str]] = None,
901
912
  params: Optional[Mapping[str, Any]] = None,
902
913
  url: Optional[str] = None,
914
+ public: bool = False,
903
915
  ) -> Any:
916
+ """Invoke a deployed web endpoint through the serving ingress.
917
+
918
+ ``public=True`` (the endpoint's own flag) sends the request WITHOUT this
919
+ client's Blade token: a public endpoint authenticates nobody, and the
920
+ request reaches the app owner's code, so the token would be the caller's
921
+ credential handed to a third party (PAAS-1268). An ``Authorization`` the
922
+ caller passes in ``headers`` is still sent.
923
+ """
904
924
  import httpx
905
925
 
906
926
  if not endpoint_path.startswith("/"):
@@ -940,6 +960,7 @@ class Client:
940
960
  headers=dict(headers or {}),
941
961
  params=dict(params or {}),
942
962
  timeout=_INGRESS_TIMEOUT,
963
+ send_token=not public,
943
964
  )
944
965
  except exc.UnavailableError:
945
966
  if attempt >= _MAX_RETRIES:
File without changes
File without changes
File without changes