tinybird 0.0.1.dev153__py3-none-any.whl → 0.0.1.dev155__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
@@ -1,8 +1,8 @@
1
1
 
2
2
  __name__ = 'tinybird'
3
3
  __description__ = 'Tinybird Command Line Tool'
4
- __url__ = 'https://www.tinybird.co/docs/cli/introduction.html'
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.dev153'
8
- __revision__ = '24d7d4a'
7
+ __version__ = '0.0.1.dev155'
8
+ __revision__ = '4d0ff0d'
@@ -184,7 +184,7 @@ def build_project(project: Project, tb_client: TinyB, file_changed: Optional[str
184
184
  build_errors = result.get("errors")
185
185
  full_error_msg = ""
186
186
  for build_error in build_errors:
187
- filename_bit = build_error.get("filename", "")
187
+ filename_bit = build_error.get("filename", build_error.get("resource", ""))
188
188
  error_bit = build_error.get("error") or build_error.get("message") or ""
189
189
  error_msg = ((filename_bit + "\n") if filename_bit else "") + error_bit
190
190
  full_error_msg += error_msg + "\n\n"
@@ -7,6 +7,7 @@ from typing import Optional
7
7
 
8
8
  import boto3
9
9
  import click
10
+ import requests
10
11
 
11
12
  import docker
12
13
  from docker.client import DockerClient
@@ -15,7 +16,8 @@ from tinybird.tb.modules.cli import cli
15
16
  from tinybird.tb.modules.common import coro
16
17
  from tinybird.tb.modules.exceptions import CLIException, CLILocalException
17
18
  from tinybird.tb.modules.feedback_manager import FeedbackManager
18
- from tinybird.tb.modules.local_common import TB_CONTAINER_NAME, TB_IMAGE_NAME, TB_LOCAL_PORT
19
+ from tinybird.tb.modules.local_common import TB_CONTAINER_NAME, TB_IMAGE_NAME, TB_LOCAL_ADDRESS, TB_LOCAL_PORT
20
+ from tinybird.tb.modules.telemetry import add_telemetry_event
19
21
 
20
22
 
21
23
  def start_tinybird_local(
@@ -131,16 +133,70 @@ def get_docker_client() -> DockerClient:
131
133
  if not docker_host:
132
134
  # Try to get docker host from docker context
133
135
  try:
134
- output = subprocess.check_output(["docker", "context", "inspect"], text=True)
135
- context = json.loads(output)
136
+ try:
137
+ output = subprocess.check_output(["docker", "context", "inspect"], text=True)
138
+ except Exception as e:
139
+ add_telemetry_event(
140
+ "docker_error",
141
+ data={
142
+ "error_kind": "docker_context_inspect_error",
143
+ "exception": str(e),
144
+ },
145
+ )
146
+ raise e
147
+ try:
148
+ context = json.loads(output)
149
+ except Exception as e:
150
+ add_telemetry_event(
151
+ "docker_error",
152
+ data={
153
+ "error_kind": "docker_context_inspect_parse_output_error",
154
+ "exception": str(e),
155
+ "docker_context_inspect_output": output,
156
+ },
157
+ )
158
+ raise e
136
159
  if context and len(context) > 0:
137
- docker_host = context[0].get("Endpoints", {}).get("docker", {}).get("Host")
138
- if docker_host:
139
- os.environ["DOCKER_HOST"] = docker_host
160
+ try:
161
+ docker_host = context[0].get("Endpoints", {}).get("docker", {}).get("Host")
162
+ if docker_host:
163
+ os.environ["DOCKER_HOST"] = docker_host
164
+ except Exception as e:
165
+ add_telemetry_event(
166
+ "docker_error",
167
+ data={
168
+ "error_kind": "docker_context_parse_host_error",
169
+ "exception": str(e),
170
+ "context": json.dumps(context),
171
+ },
172
+ )
173
+ raise e
140
174
  except Exception:
141
175
  pass
142
- client = docker.from_env() # type: ignore
143
- client.ping()
176
+ try:
177
+ client = docker.from_env() # type: ignore
178
+ except Exception as e:
179
+ add_telemetry_event(
180
+ "docker_error",
181
+ data={
182
+ "error_kind": "docker_get_client_from_env_error",
183
+ "exception": str(e),
184
+ },
185
+ )
186
+ raise e
187
+ try:
188
+ client.ping()
189
+ except Exception as e:
190
+ client_dict_non_sensitive = {k: v for k, v in client.api.__dict__.items() if "auth" not in k}
191
+ add_telemetry_event(
192
+ "docker_error",
193
+ data={
194
+ "error_kind": "docker_ping_error",
195
+ "exception": str(e),
196
+ "client": repr(client_dict_non_sensitive),
197
+ },
198
+ )
199
+ raise e
144
200
  return client
145
201
  except Exception:
146
202
  raise CLILocalException(
@@ -342,3 +398,10 @@ async def restart(use_aws_creds: bool) -> None:
342
398
  click.echo(FeedbackManager.info(message="✓ Tinybird Local stopped"))
343
399
  start_tinybird_local(docker_client, use_aws_creds)
344
400
  click.echo(FeedbackManager.success(message="✓ Tinybird Local is ready!"))
401
+
402
+
403
+ @local.command()
404
+ def version() -> None:
405
+ """Show Tinybird Local version"""
406
+ response = requests.get(f"{TB_LOCAL_ADDRESS}/version")
407
+ click.echo(FeedbackManager.success(message=f"✓ Tinybird Local version: {response.text}"))
@@ -2,6 +2,7 @@ import hashlib
2
2
  import logging
3
3
  import os
4
4
  import re
5
+ import subprocess
5
6
  from typing import Any, Dict
6
7
 
7
8
  import requests
@@ -10,6 +11,7 @@ from tinybird.tb.client import AuthNoTokenException, TinyB
10
11
  from tinybird.tb.modules.config import CLIConfig
11
12
  from tinybird.tb.modules.exceptions import CLILocalException
12
13
  from tinybird.tb.modules.feedback_manager import FeedbackManager
14
+ from tinybird.tb.modules.telemetry import add_telemetry_event
13
15
 
14
16
  TB_IMAGE_NAME = "tinybirdco/tinybird-local:latest"
15
17
  TB_CONTAINER_NAME = "tinybird-local"
@@ -37,6 +39,22 @@ async def get_tinybird_local_config(config_obj: Dict[str, Any], test: bool = Fal
37
39
  # ruff: noqa: ASYNC210
38
40
  tokens = requests.get(f"{TB_LOCAL_ADDRESS}/tokens").json()
39
41
  except Exception:
42
+ try:
43
+ # Check if tinybird-local is running with docker, in case it's a config issue
44
+ output = subprocess.check_output(["docker", "ps"], text=True) # noqa: ASYNC221
45
+ header_row = next((line for line in output.splitlines() if "CONTAINER ID" in line), "")
46
+ tb_local_row = next(
47
+ (line for line in output.splitlines() if TB_CONTAINER_NAME in line),
48
+ f"{TB_CONTAINER_NAME} not found in output",
49
+ )
50
+ add_telemetry_event(
51
+ "docker_debug",
52
+ data={
53
+ "docker_ps_output": header_row + tb_local_row,
54
+ },
55
+ )
56
+ except Exception:
57
+ pass
40
58
  raise CLILocalException(
41
59
  FeedbackManager.error(message="Tinybird local is not running. Please run `tb local start` first.")
42
60
  )
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev153
3
+ Version: 0.0.1.dev155
4
4
  Summary: Tinybird Command Line Tool
5
- Home-page: https://www.tinybird.co/docs/cli/introduction.html
5
+ Home-page: https://www.tinybird.co/docs/forward/commands
6
6
  Author: Tinybird
7
7
  Author-email: support@tinybird.co
8
8
  Requires-Python: >=3.9, <3.14
@@ -12,13 +12,13 @@ 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=BZuPM7MFS7vaEKK5tOMR2bwSAgJudPrJt27uVEwZmTY,40512
15
- tinybird/tb/__cli__.py,sha256=V2P7LUM2Vw2frXY-02zxDbU0UWJW6e_-DJj6Csa4P5Y,252
15
+ tinybird/tb/__cli__.py,sha256=c0frnD9sSC9DoVv6tmOBeg9cbiU8bfwHuvqBYJ8hu0Y,247
16
16
  tinybird/tb/check_pypi.py,sha256=rW4QmDRbtgKdUUwJCnBkVjmTjZSZGN-XgZhx7vMkC0w,1009
17
17
  tinybird/tb/cli.py,sha256=uPV6pvi4aYVfaiGs0DQO-eoi1g9dHlrgvhutkXkdJko,1075
18
18
  tinybird/tb/client.py,sha256=aaPKq5C77e72kR7IMv9WrvnvNki8mKMOTi9EsCp0eUc,55962
19
19
  tinybird/tb/config.py,sha256=jT9xndpeCY_g0HdB5qE2EquC0TFRRnkPnQFWZWd04jo,3998
20
20
  tinybird/tb/modules/auth.py,sha256=_OeYnmTH83lnqCgQEdS6K0bx1KBUeRmZk2M7JnRmWpk,9037
21
- tinybird/tb/modules/build.py,sha256=PJxsI4Wqw8lRkSw0RrQqkwAHYClikJ4ZKd9i1_gRdkk,18488
21
+ tinybird/tb/modules/build.py,sha256=sj77FyQRAtAQdifY8sqVzPzeIUKsxUDwPsz17NSRsVA,18517
22
22
  tinybird/tb/modules/cicd.py,sha256=Cn1DyE28w2maQgIJF4IjZU7J7ULPvMG11DjN2OH-cqE,7161
23
23
  tinybird/tb/modules/cli.py,sha256=TCms3gyokv3ES1yD6WuL_mLNEqBcAFQHSvgOnr6RYDY,14266
24
24
  tinybird/tb/modules/common.py,sha256=WzF_zRtAl3FKqbzK6yi_IjeeGIjQNu6SKnP-PX-o3Kk,85196
@@ -37,8 +37,8 @@ tinybird/tb/modules/infra.py,sha256=fve30Gj3mG9zbquGxS2e4ipcOYOxviWQCpNFfEzJN_Q,
37
37
  tinybird/tb/modules/job.py,sha256=n4dSSBgnA8NqD7srGahf2xRj6wxkmX9Vl0J-QJ_a2w0,2966
38
38
  tinybird/tb/modules/llm.py,sha256=KfsCYmKeW1VQz0iDZhGKCRkQv_Y3kTHh6JuxvofOguE,1076
39
39
  tinybird/tb/modules/llm_utils.py,sha256=nS9r4FAElJw8yXtmdYrx-rtI2zXR8qXfi1QqUDCfxvg,3469
40
- tinybird/tb/modules/local.py,sha256=kxdF8NXZYYwtUwlFHxHKq_PA9CpMrG-rXOg_i_hlvnY,12158
41
- tinybird/tb/modules/local_common.py,sha256=jNbVG_nk5sNduPo3JDSNtop1H2X1Tdd5j4q3xXUR6W8,3965
40
+ tinybird/tb/modules/local.py,sha256=4CJfqAyojnwj1fN2UuKMWO28DeOGrGJ9WkHUUDAfPas,14568
41
+ tinybird/tb/modules/local_common.py,sha256=GMbA0aKaDXzOIHVCfi_IJyQ7ziWPUhTWk0I_CZm8nmQ,4763
42
42
  tinybird/tb/modules/login.py,sha256=fmXPSdvJnKPv03chptGuu3_Fm6LhP6kUsUKhrmT8rJc,8269
43
43
  tinybird/tb/modules/logout.py,sha256=ULooy1cDBD02-r7voZmhV7udA0ML5tVuflJyShrh56Y,1022
44
44
  tinybird/tb/modules/materialization.py,sha256=QJX5kCPhhm6IXBO1JsalVfbQdypCe_eOUDZ_WHJZWS8,5478
@@ -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.dev153.dist-info/METADATA,sha256=ssrKpwmrdIOxtjrzdNFLCOKObE89ZhkF0hO0VSOC-tA,1612
84
- tinybird-0.0.1.dev153.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
85
- tinybird-0.0.1.dev153.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
86
- tinybird-0.0.1.dev153.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
87
- tinybird-0.0.1.dev153.dist-info/RECORD,,
83
+ tinybird-0.0.1.dev155.dist-info/METADATA,sha256=j8A-XBOYKUMU7mB9rvXYDikP6UqX0zLcOrHO861Bg7k,1607
84
+ tinybird-0.0.1.dev155.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
85
+ tinybird-0.0.1.dev155.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
86
+ tinybird-0.0.1.dev155.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
87
+ tinybird-0.0.1.dev155.dist-info/RECORD,,