beamlit 0.0.29rc29__py3-none-any.whl → 0.0.29rc31__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.
@@ -1,20 +1,15 @@
1
+ import os
1
2
  from dataclasses import dataclass
2
3
  from typing import Dict, Generator
3
- import os
4
-
5
- from httpx import Auth, Request, Response
6
4
 
7
5
  from beamlit.common.settings import Settings, get_settings
6
+ from httpx import Auth, Request, Response
8
7
 
9
8
  from ..client import AuthenticatedClient
10
9
  from .apikey import ApiKeyProvider
11
10
  from .clientcredentials import ClientCredentials
12
- from .credentials import (
13
- Credentials,
14
- current_context,
15
- load_credentials,
16
- load_credentials_from_settings,
17
- )
11
+ from .credentials import (Credentials, current_context, load_credentials,
12
+ load_credentials_from_settings)
18
13
  from .device_mode import BearerToken
19
14
 
20
15
 
@@ -27,13 +22,15 @@ class PublicProvider(Auth):
27
22
  class RunClientWithCredentials:
28
23
  credentials: Credentials
29
24
  workspace: str
30
- api_url: str = "https://api.beamlit.com/v0"
31
- run_url: str = "https://run.beamlit.com/v0"
25
+ api_url: str = ""
26
+ run_url: str = ""
32
27
 
33
28
  def __post_init__(self):
34
- if os.getenv('BL_ENV') == 'dev':
35
- self.api_url = "https://api.beamlit.dev/v0"
36
- self.run_url = "https://run.beamlit.dev/v0"
29
+ from ..common.settings import get_settings
30
+
31
+ settings = get_settings()
32
+ self.api_url = settings.base_url
33
+ self.run_url = settings.run_url
37
34
 
38
35
 
39
36
  def new_client_from_settings(settings: Settings):
beamlit/client.py CHANGED
@@ -1,4 +1,3 @@
1
- import os
2
1
  import ssl
3
2
  from typing import Any, Optional, Union
4
3
 
@@ -38,13 +37,8 @@ class Client:
38
37
 
39
38
  """
40
39
 
41
- # Determine the base URL based on the environment
42
- default_base_url = "https://api.beamlit.com/v0"
43
- if os.getenv("BL_ENV") == "dev":
44
- default_base_url = "https://api.beamlit.dev/v0"
45
-
46
40
  raise_on_unexpected_status: bool = field(default=True, kw_only=True)
47
- _base_url: str = field(alias="base_url", default=default_base_url)
41
+ _base_url: str = field(alias="base_url", default="")
48
42
  _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
49
43
  _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
50
44
  _provider: httpx.Auth = field(default=None, alias="provider")
@@ -55,6 +49,12 @@ class Client:
55
49
  _client: Optional[httpx.Client] = field(default=None, init=False)
56
50
  _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
57
51
 
52
+ def __post_init__(self):
53
+ from .common.settings import get_settings
54
+
55
+ settings = get_settings()
56
+ self._base_url = settings.base_url
57
+
58
58
  def with_headers(self, headers: dict[str, str]) -> "Client":
59
59
  """Get a new client matching this one with additional headers"""
60
60
  if self._client is not None:
@@ -175,13 +175,8 @@ class AuthenticatedClient:
175
175
  provider: AuthProvider to use for authentication
176
176
  """
177
177
 
178
- # Determine the base URL based on the environment
179
- default_base_url = "https://api.beamlit.com/v0"
180
- if os.getenv("BL_ENV") == "dev":
181
- default_base_url = "https://api.beamlit.dev/v0"
182
-
183
178
  raise_on_unexpected_status: bool = field(default=True, kw_only=True)
184
- _base_url: str = field(alias="base_url", default=default_base_url)
179
+ _base_url: str = field(alias="base_url", default="")
185
180
  _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
186
181
  _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
187
182
  _provider: httpx.Auth = field(default=None, alias="provider")
@@ -192,6 +187,12 @@ class AuthenticatedClient:
192
187
  _client: Optional[httpx.Client] = field(default=None, init=False)
193
188
  _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
194
189
 
190
+ def __post_init__(self):
191
+ from .common.settings import get_settings
192
+
193
+ settings = get_settings()
194
+ self._base_url = settings.base_url
195
+
195
196
  def with_headers(self, headers: dict[str, str]) -> "AuthenticatedClient":
196
197
  """Get a new client matching this one with additional headers"""
197
198
  if self._client is not None:
@@ -69,10 +69,10 @@ class Settings(BaseSettings):
69
69
  def __init__(self, **data):
70
70
  super().__init__(**data)
71
71
  if os.getenv('BL_ENV') == 'dev':
72
- self.base_url = "https://api.beamlit.dev/v0"
73
- self.run_url = "https://run.beamlit.dev"
74
- self.mcp_hub_url = "https://mcp-hub-server.beamlit.workers.dev"
75
- self.registry_url = "https://eu.registry.beamlit.dev"
72
+ self.base_url = os.getenv('BL_BASE_URL') or "https://api.beamlit.dev/v0"
73
+ self.run_url = os.getenv('BL_RUN_URL') or "https://run.beamlit.dev"
74
+ self.mcp_hub_url = os.getenv('BL_MCP_HUB_URL') or "https://mcp-hub-server.beamlit.workers.dev"
75
+ self.registry_url = os.getenv('BL_REGISTRY_URL') or "https://eu.registry.beamlit.dev"
76
76
 
77
77
  @classmethod
78
78
  def settings_customise_sources(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: beamlit
3
- Version: 0.0.29rc29
3
+ Version: 0.0.29rc31
4
4
  Summary: Add your description here
5
5
  Author-email: cploujoux <ch.ploujoux@gmail.com>
6
6
  Requires-Python: >=3.12
@@ -1,5 +1,5 @@
1
1
  beamlit/__init__.py,sha256=545gFC-wLLwUktWcOAjUWe_Glha40tBetRTOYSfHnbI,164
2
- beamlit/client.py,sha256=SmJ46egRqKwRrLXCHmwrik0D_dD6s46-87YeVhBgxSU,12817
2
+ beamlit/client.py,sha256=PnR6ybZk5dLIJPnDKAf2epHOeQC_7yL0fG4muvphHjA,12695
3
3
  beamlit/errors.py,sha256=gO8GBmKqmSNgAg-E5oT-oOyxztvp7V_6XG7OUTT15q0,546
4
4
  beamlit/py.typed,sha256=8ZJUsxZiuOy1oJeVhsTWQhTG_6pTVHVXk5hJL79ebTk,25
5
5
  beamlit/run.py,sha256=RLwMv5f_S8lw7Wq7O6DvEcOl0nGYh769qjGl_SmR9Z0,1338
@@ -124,7 +124,7 @@ beamlit/api/workspaces/update_workspace.py,sha256=qa5DV2UJSUYuB_ibALb4E9ghKpT1Ha
124
124
  beamlit/api/workspaces/update_workspace_user_role.py,sha256=Yn9iuJ4tKtauzBiJyU4-wYUMS9g98X2Om8zs7UkzrY8,4917
125
125
  beamlit/authentication/__init__.py,sha256=wiXqRbc7E-ulrH_ueA9duOGFvXeo7-RvhSD1XbFogMo,1020
126
126
  beamlit/authentication/apikey.py,sha256=KNBTgdi0VBzBAAmSwU2X1QoB58vRbg8wkXb8-GTZCQo,657
127
- beamlit/authentication/authentication.py,sha256=ZH3zS7PVa9kw8szZTplwZvCbhBJ-oXHsxEtnAhKjxzM,3409
127
+ beamlit/authentication/authentication.py,sha256=8R-3WdQSykNjCbebAW2p8Glvw5nlAmSEZr6Ylo-vPuc,3377
128
128
  beamlit/authentication/clientcredentials.py,sha256=cxZPPu--CgizwqX0pdfFQ91gJt1EFKwyy-aBB_dXX7I,3990
129
129
  beamlit/authentication/credentials.py,sha256=p_1xenabCbQuRz7BiFk7oTK4uCxAt_zoyku5o-jcKGE,5343
130
130
  beamlit/authentication/device_mode.py,sha256=tmr22gllKOZwBRub_QjF5pYa425x-nE8tQNpZ_EGR6g,3644
@@ -133,7 +133,7 @@ beamlit/common/generate.py,sha256=LtdCju_QayRS4lZrrb_0VHqWWvTcv4Mbf-iV1TB_Qko,75
133
133
  beamlit/common/instrumentation.py,sha256=MsBDfFcMYqGDiHHj4j5hLHE4EWxZExkhmCeFS3SKzJY,3181
134
134
  beamlit/common/logger.py,sha256=VFRbaZh93n8ZGugeeYKe88IP2nI3g2JNa7XN4j8wVJE,1116
135
135
  beamlit/common/secrets.py,sha256=sid81bOe3LflkMKDHwBsBs9nIju8bp5-v9qU9gkyNMc,212
136
- beamlit/common/settings.py,sha256=inAjEPF1OG9fsamuuSKe4z-sZ-cfZ-Qn1evnME44Fz4,5777
136
+ beamlit/common/settings.py,sha256=bxgQxMV5ncNqDGcWS_Wj3nzOF8FgAmC6alMP2fOdEDU,5895
137
137
  beamlit/common/utils.py,sha256=jouz5igBvT37Xn_e94-foCHyQczVim-UzVcoIF6RWJ4,657
138
138
  beamlit/deploy/__init__.py,sha256=GS7l7Jtm2yKs7iNLKcfjYO-rAhUzggQ3xiYSf3oxLBY,91
139
139
  beamlit/deploy/deploy.py,sha256=on1i93SdECKrLVRMm3V2BRW5JeolPPq1dJHa4Evp0ns,9188
@@ -254,6 +254,6 @@ beamlit/serve/app.py,sha256=OpwPjRdyHZK6J-ziPwhiRDGGa2mvCrFVcBFE6alJVOM,3071
254
254
  beamlit/serve/middlewares/__init__.py,sha256=1dVmnOmhAQWvWktqHkKSIX-YoF6fmMU8xkUQuhg_rJU,148
255
255
  beamlit/serve/middlewares/accesslog.py,sha256=Mu4T4_9OvHybjA0ApzZFpgi2C8f3X1NbUk-76v634XM,631
256
256
  beamlit/serve/middlewares/processtime.py,sha256=lDAaIasZ4bwvN-HKHvZpaD9r-yrkVNZYx4abvbjbrCg,411
257
- beamlit-0.0.29rc29.dist-info/METADATA,sha256=WGBXo_WZ4XmwGXOJAZoqq82BAcpdOQWgbymobbVBSr8,2405
258
- beamlit-0.0.29rc29.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
259
- beamlit-0.0.29rc29.dist-info/RECORD,,
257
+ beamlit-0.0.29rc31.dist-info/METADATA,sha256=wtvS37H-4XfjTewjRWIlNgalDC5yy_C4nEsQEdE5Lfc,2405
258
+ beamlit-0.0.29rc31.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
259
+ beamlit-0.0.29rc31.dist-info/RECORD,,