tinybird 0.0.1.dev210__py3-none-any.whl → 0.0.1.dev211__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.dev210'
8
- __revision__ = 'd56b861'
7
+ __version__ = '0.0.1.dev211'
8
+ __revision__ = 'b26a42d'
@@ -1,6 +1,9 @@
1
1
  import http.server
2
2
  import os
3
+ import platform
4
+ import shutil
3
5
  import socketserver
6
+ import subprocess
4
7
  import sys
5
8
  import threading
6
9
  import time
@@ -173,7 +176,7 @@ async def login(host: Optional[str], auth_host: str, workspace: str, interactive
173
176
  params["workspace"] = workspace
174
177
 
175
178
  auth_url = f"{auth_host}/api/cli-login?{urlencode(params)}"
176
- webbrowser.open(auth_url)
179
+ open_url(auth_url)
177
180
 
178
181
  click.echo(FeedbackManager.info(message="\nIf browser does not open, please open the following URL manually:"))
179
182
  click.echo(FeedbackManager.info(message=auth_url))
@@ -217,3 +220,55 @@ async def login(host: Optional[str], auth_host: str, workspace: str, interactive
217
220
  raise Exception("Authentication failed or timed out.")
218
221
  except Exception as e:
219
222
  raise CLILoginException(FeedbackManager.error(message=str(e)))
223
+
224
+
225
+ def _running_in_wsl() -> bool:
226
+ """Return True when Python is executing inside a WSL distro."""
227
+ # Fast positive check (modern WSL always sets at least one of these):
228
+ if "WSL_DISTRO_NAME" in os.environ or "WSL_INTEROP" in os.environ:
229
+ return True
230
+
231
+ # Fall back to kernel /proc data
232
+ release = platform.uname().release.lower()
233
+ if "microsoft" in release: # covers stock WSL kernels
234
+ return True
235
+ try:
236
+ if "microsoft" in open("/proc/version").read().lower():
237
+ return True
238
+ except FileNotFoundError:
239
+ pass
240
+ return False
241
+
242
+
243
+ def open_url(url: str, *, new_tab: bool = False) -> bool:
244
+ # 1. Try the standard library first on CPython ≥ 3.11 this already
245
+ # recognises WSL and fires up the Windows default browser for us.
246
+ try:
247
+ wb: Any = webbrowser.get() # mypy: Any for Py < 3.10
248
+ if new_tab:
249
+ if wb.open_new_tab(url):
250
+ return True
251
+ else:
252
+ if wb.open(url):
253
+ return True
254
+ except webbrowser.Error:
255
+ pass # keep going
256
+
257
+ # 2. Inside WSL, prefer `wslview` if the user has it (wslu package).
258
+ if _running_in_wsl() and shutil.which("wslview"):
259
+ subprocess.Popen(["wslview", url])
260
+ return True
261
+
262
+ # 3. Secondary WSL fallback use Windows **start** through cmd.exe.
263
+ # Empty "" argument is required so long URLs are not treated as a window title.
264
+ if _running_in_wsl():
265
+ subprocess.Popen(["cmd.exe", "/c", "start", "", url])
266
+ return True
267
+
268
+ # 4. Unix last-ditch fallback xdg-open (most minimal container images have it)
269
+ if shutil.which("xdg-open"):
270
+ subprocess.Popen(["xdg-open", url])
271
+ return True
272
+
273
+ # 5. If everything failed, let the caller know.
274
+ return False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev210
3
+ Version: 0.0.1.dev211
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/forward/commands
6
6
  Author: Tinybird
@@ -12,7 +12,7 @@ tinybird/syncasync.py,sha256=IPnOx6lMbf9SNddN1eBtssg8vCLHMt76SuZ6YNYm-Yk,27761
12
12
  tinybird/tornado_template.py,sha256=jjNVDMnkYFWXflmT8KU_Ssbo5vR8KQq3EJMk5vYgXRw,41959
13
13
  tinybird/ch_utils/constants.py,sha256=aYvg2C_WxYWsnqPdZB1ZFoIr8ZY-XjUXYyHKE9Ansj0,3890
14
14
  tinybird/ch_utils/engine.py,sha256=X4tE9OrfaUy6kO9cqVEzyI9cDcmOF3IAssRRzsTsfEQ,40781
15
- tinybird/tb/__cli__.py,sha256=1cwlex24JRhH9FGFepOdSnSGpEXzXtXArCkp1M8V9mA,247
15
+ tinybird/tb/__cli__.py,sha256=dJnaXvzVEcL8O2Ju7bSj2suNdnw0CQh9c7dE9BwRK9g,247
16
16
  tinybird/tb/check_pypi.py,sha256=i3l2L8IajeB7sreikR7oPlYJki9MtS3c_M4crnmbByc,760
17
17
  tinybird/tb/cli.py,sha256=u3eGOhX0MHkuT6tiwaZ0_3twqLmqKXDAOxF7yV_Nn9Q,1075
18
18
  tinybird/tb/client.py,sha256=0zUAi9Lclo2JusQKlQnSnSP1XCiCK9I03XtLqmk8e04,56487
@@ -39,7 +39,7 @@ tinybird/tb/modules/llm.py,sha256=KfsCYmKeW1VQz0iDZhGKCRkQv_Y3kTHh6JuxvofOguE,10
39
39
  tinybird/tb/modules/llm_utils.py,sha256=nS9r4FAElJw8yXtmdYrx-rtI2zXR8qXfi1QqUDCfxvg,3469
40
40
  tinybird/tb/modules/local.py,sha256=9riA3PrCTUXWeDTWMhd14M2-9pFHI6fedpjY4m_lRpU,14359
41
41
  tinybird/tb/modules/local_common.py,sha256=msAZDNPPVenNyL9Dqfb0Z5uFC_1O809xdAi7j1iKmJA,17066
42
- tinybird/tb/modules/login.py,sha256=7Wax0hzuUpGPOxTz7ef1w3olSy_4cRrHycKbh9hofJI,8344
42
+ tinybird/tb/modules/login.py,sha256=qfY17J3FryTPl8A0ucQgxiyJ7jLy81qHdlHXgqohi0c,10170
43
43
  tinybird/tb/modules/logout.py,sha256=sniI4JNxpTrVeRCp0oGJuQ3yRerG4hH5uz6oBmjv724,1009
44
44
  tinybird/tb/modules/materialization.py,sha256=QJX5kCPhhm6IXBO1JsalVfbQdypCe_eOUDZ_WHJZWS8,5478
45
45
  tinybird/tb/modules/mock.py,sha256=IyHweMUM6bUH8IhyiX2tTMpdVpTFUeAJ41lZ5P42-HQ,5303
@@ -80,8 +80,8 @@ tinybird/tb_cli_modules/config.py,sha256=IsgdtFRnUrkY8-Zo32lmk6O7u3bHie1QCxLwgp4
80
80
  tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
81
81
  tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
82
82
  tinybird/tb_cli_modules/telemetry.py,sha256=Hh2Io8ZPROSunbOLuMvuIFU4TqwWPmQTqal4WS09K1A,10449
83
- tinybird-0.0.1.dev210.dist-info/METADATA,sha256=o32bxuzCr9smZP4A_c1Q2fGG8gKr5IrRiEueTbiXIQA,1682
84
- tinybird-0.0.1.dev210.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
85
- tinybird-0.0.1.dev210.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
86
- tinybird-0.0.1.dev210.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
87
- tinybird-0.0.1.dev210.dist-info/RECORD,,
83
+ tinybird-0.0.1.dev211.dist-info/METADATA,sha256=h5xeu9k1bFy0oL7O4fSN21kkx06osHCf0mpS8kzUXfw,1682
84
+ tinybird-0.0.1.dev211.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
85
+ tinybird-0.0.1.dev211.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
86
+ tinybird-0.0.1.dev211.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
87
+ tinybird-0.0.1.dev211.dist-info/RECORD,,