tinybird 0.0.1.dev281__py3-none-any.whl → 0.0.1.dev282__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.

Potentially problematic release.


This version of tinybird might be problematic. Click here for more details.

tinybird/tb/__cli__.py CHANGED
@@ -4,5 +4,5 @@ __description__ = 'Tinybird Command Line Tool'
4
4
  __url__ = 'https://www.tinybird.co/docs/forward/commands'
5
5
  __author__ = 'Tinybird'
6
6
  __author_email__ = 'support@tinybird.co'
7
- __version__ = '0.0.1.dev281'
8
- __revision__ = 'a7365be'
7
+ __version__ = '0.0.1.dev282'
8
+ __revision__ = '77eb85f'
@@ -1,9 +1,35 @@
1
1
  from typing import Optional
2
2
 
3
3
  from anthropic import AsyncAnthropic
4
- from httpx import AsyncClient
4
+ from httpx import AsyncClient, HTTPStatusError
5
5
  from pydantic_ai.models.anthropic import AnthropicModel, AnthropicModelName
6
6
  from pydantic_ai.providers.anthropic import AnthropicProvider
7
+ from pydantic_ai.retries import AsyncTenacityTransport, wait_retry_after
8
+ from tenacity import AsyncRetrying, retry_if_exception_type, stop_after_attempt, wait_exponential
9
+
10
+
11
+ def create_retrying_client(token: str, workspace_id: str):
12
+ """Create a client with smart retry handling for multiple error types."""
13
+
14
+ def should_retry_status(response):
15
+ """Raise exceptions for retryable HTTP status codes."""
16
+ if response.status_code in (400, 429, 502, 503, 504):
17
+ response.raise_for_status() # This will raise HTTPStatusError
18
+
19
+ transport = AsyncTenacityTransport(
20
+ controller=AsyncRetrying(
21
+ # Retry on HTTP errors and connection issues
22
+ retry=retry_if_exception_type((HTTPStatusError, ConnectionError)),
23
+ # Smart waiting: respects Retry-After headers, falls back to exponential backoff
24
+ wait=wait_retry_after(fallback_strategy=wait_exponential(multiplier=1, max=60), max_wait=300),
25
+ # Stop after 5 attempts
26
+ stop=stop_after_attempt(5),
27
+ # Re-raise the last exception if all retries fail
28
+ reraise=True,
29
+ ),
30
+ validate_response=should_retry_status,
31
+ )
32
+ return AsyncClient(transport=transport, params={"token": token, "workspace_id": workspace_id})
7
33
 
8
34
 
9
35
  def create_model(
@@ -19,7 +45,7 @@ def create_model(
19
45
 
20
46
  client = AsyncAnthropic(
21
47
  base_url=base_url,
22
- http_client=AsyncClient(params={"token": token, "workspace_id": workspace_id}),
48
+ http_client=create_retrying_client(token, workspace_id),
23
49
  auth_token=token,
24
50
  default_headers=default_headers,
25
51
  )
@@ -257,19 +257,31 @@ def open_url(url: str, *, new_tab: bool = False) -> bool:
257
257
 
258
258
  # 2. Inside WSL, prefer `wslview` if the user has it (wslu package).
259
259
  if _running_in_wsl() and shutil.which("wslview"):
260
- subprocess.Popen(["wslview", url])
261
- return True
260
+ try:
261
+ subprocess.Popen(["wslview", url])
262
+ return True
263
+ except Exception:
264
+ # wslview not found, continue to next fallback
265
+ pass
262
266
 
263
267
  # 3. Secondary WSL fallback use Windows **start** through cmd.exe.
264
268
  # Empty "" argument is required so long URLs are not treated as a window title.
265
269
  if _running_in_wsl():
266
- subprocess.Popen(["cmd.exe", "/c", "start", "", url])
267
- return True
270
+ try:
271
+ subprocess.Popen(["cmd.exe", "/c", "start", "", url])
272
+ return True
273
+ except Exception:
274
+ # cmd.exe not found, continue to next fallback
275
+ pass
268
276
 
269
277
  # 4. Unix last-ditch fallback xdg-open (most minimal container images have it)
270
278
  if shutil.which("xdg-open"):
271
- subprocess.Popen(["xdg-open", url])
272
- return True
279
+ try:
280
+ subprocess.Popen(["xdg-open", url])
281
+ return True
282
+ except Exception:
283
+ # xdg-open not found, continue to next fallback
284
+ pass
273
285
 
274
286
  # 5. If everything failed, let the caller know.
275
287
  return False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev281
3
+ Version: 0.0.1.dev282
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/forward/commands
6
6
  Author: Tinybird
@@ -22,7 +22,8 @@ Requires-Dist: humanfriendly~=8.2
22
22
  Requires-Dist: plotext==5.3.2
23
23
  Requires-Dist: prompt_toolkit==3.0.48
24
24
  Requires-Dist: pydantic~=2.11.7
25
- Requires-Dist: pydantic-ai-slim[anthropic]~=0.4.2
25
+ Requires-Dist: pydantic-ai-slim[anthropic]~=0.5.0
26
+ Requires-Dist: pydantic-ai-slim[retries]~=0.5.0
26
27
  Requires-Dist: pyperclip==1.8.2
27
28
  Requires-Dist: pyyaml<6.1,>=6.0
28
29
  Requires-Dist: requests<3,>=2.28.1
@@ -17,7 +17,7 @@ tinybird/datafile/exceptions.py,sha256=8rw2umdZjtby85QbuRKFO5ETz_eRHwUY5l7eHsy1w
17
17
  tinybird/datafile/parse_connection.py,sha256=tRyn2Rpr1TeWet5BXmMoQgaotbGdYep1qiTak_OqC5E,1825
18
18
  tinybird/datafile/parse_datasource.py,sha256=ssW8QeFSgglVFi3sDZj_HgkJiTJ2069v2JgqnH3CkDE,1825
19
19
  tinybird/datafile/parse_pipe.py,sha256=xf4m0Tw44QWJzHzAm7Z7FwUoUUtr7noMYjU1NiWnX0k,3880
20
- tinybird/tb/__cli__.py,sha256=9wnnbBnxhukXrxUWvBtiFSmvyluJ20h0GDJBGnLWbwc,247
20
+ tinybird/tb/__cli__.py,sha256=fmFyVdes693OS-QP_zm9KaWfwKBNHpRdThEjryzzN7s,247
21
21
  tinybird/tb/check_pypi.py,sha256=Gp0HkHHDFMSDL6nxKlOY51z7z1Uv-2LRexNTZSHHGmM,552
22
22
  tinybird/tb/cli.py,sha256=FdDFEIayjmsZEVsVSSvRiVYn_FHOVg_zWQzchnzfWho,1008
23
23
  tinybird/tb/client.py,sha256=IQRaInDjOwr9Fzaz3_xXc3aUGqh94tM2lew7IZbB9eM,53733
@@ -47,7 +47,7 @@ tinybird/tb/modules/llm_utils.py,sha256=nS9r4FAElJw8yXtmdYrx-rtI2zXR8qXfi1QqUDCf
47
47
  tinybird/tb/modules/local.py,sha256=kW3IHwJPvhBsa1eMh_xzow9Az3yYpHthkzsLSHeP5HE,6512
48
48
  tinybird/tb/modules/local_common.py,sha256=mFhidxVeGnDA_UHss-bRY8_UzU0V5iZ3HGnVqlnMzY0,17730
49
49
  tinybird/tb/modules/login.py,sha256=zerXZqIv15pbFk5XRt746xGcVnp01YmL_403byBf4jQ,1245
50
- tinybird/tb/modules/login_common.py,sha256=IfthYbHmC7EtsCXCB1iF4TngPOwfaHJ6Dfi_t7oBXnI,11640
50
+ tinybird/tb/modules/login_common.py,sha256=CKXD_BjivhGUmBtNbLTJwzQDr6885C72XPZjo0GLLvI,12010
51
51
  tinybird/tb/modules/logout.py,sha256=sniI4JNxpTrVeRCp0oGJuQ3yRerG4hH5uz6oBmjv724,1009
52
52
  tinybird/tb/modules/materialization.py,sha256=8fdbTTxFSk0Sjet3pcEk_x-cs4RGpgl6toN8vrMLXJE,5630
53
53
  tinybird/tb/modules/mock.py,sha256=ET8sRpmXnQsd2sSJXH_KCdREU1_XQgkORru6T357Akc,3260
@@ -76,7 +76,7 @@ tinybird/tb/modules/agent/command_agent.py,sha256=Wcdtmo7vJZ5EbBFW9J7zPCME0ShG_K
76
76
  tinybird/tb/modules/agent/compactor.py,sha256=BK5AxZFhrp3xWnsRnYaleiYoIWtVNc-_m650Hsopt8g,13841
77
77
  tinybird/tb/modules/agent/explore_agent.py,sha256=HkzKmggfSMz7S3RSeKnZXufq-z_U0tTQJpF7JfNIaGQ,3504
78
78
  tinybird/tb/modules/agent/memory.py,sha256=vBewB_64L_wHoT4tLT6UX2uxcHwSY880QZ26F9rPqXs,3793
79
- tinybird/tb/modules/agent/models.py,sha256=IAxqlnHy8c2OeSnDrrSp2Mg38W9_r0GsDM87Wv-YNfM,925
79
+ tinybird/tb/modules/agent/models.py,sha256=eokO8XlY-kVJOsbqiVporGUAOCyKAXCO5xgTEK9SM6Y,2208
80
80
  tinybird/tb/modules/agent/prompts.py,sha256=kc_47G9iEyf2p7_C-71Fa5JEwyH2RSYc4vzBHCc1JKE,39971
81
81
  tinybird/tb/modules/agent/testing_agent.py,sha256=AtwtJViH7805i7djyBgDb7SSUtDyJnw0TWJu6lBFsrg,2953
82
82
  tinybird/tb/modules/agent/utils.py,sha256=4jsQCAH2zBx13w20DOBrrDnQq9n2rKG9sGhBkJYiPzs,31744
@@ -117,8 +117,8 @@ tinybird/tb_cli_modules/config.py,sha256=IsgdtFRnUrkY8-Zo32lmk6O7u3bHie1QCxLwgp4
117
117
  tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
118
118
  tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
119
119
  tinybird/tb_cli_modules/telemetry.py,sha256=Hh2Io8ZPROSunbOLuMvuIFU4TqwWPmQTqal4WS09K1A,10449
120
- tinybird-0.0.1.dev281.dist-info/METADATA,sha256=addYJX1brd0zshl7fSjLVDq8u-7mtD9ylBkRy0n2GXk,1763
121
- tinybird-0.0.1.dev281.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
122
- tinybird-0.0.1.dev281.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
123
- tinybird-0.0.1.dev281.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
124
- tinybird-0.0.1.dev281.dist-info/RECORD,,
120
+ tinybird-0.0.1.dev282.dist-info/METADATA,sha256=zMcjvggtB0gbH4I8m8x4OSImErFK4X55gmDX2R7i9Y8,1811
121
+ tinybird-0.0.1.dev282.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
122
+ tinybird-0.0.1.dev282.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
123
+ tinybird-0.0.1.dev282.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
124
+ tinybird-0.0.1.dev282.dist-info/RECORD,,