tinybird 0.0.1.dev66__py3-none-any.whl → 0.0.1.dev67__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/cli/introduction.html'
5
5
  __author__ = 'Tinybird'
6
6
  __author_email__ = 'support@tinybird.co'
7
- __version__ = '0.0.1.dev66'
8
- __revision__ = '449a9aa'
7
+ __version__ = '0.0.1.dev67'
8
+ __revision__ = '76a69c0'
@@ -392,7 +392,7 @@ async def create_ctx_client(ctx: Context, config: Dict[str, Any], cloud: bool, b
392
392
  return None
393
393
 
394
394
  commands_always_cloud = ["pull"]
395
- commands_always_build = ["build", "test"]
395
+ commands_always_build = ["build", "test", "dev"]
396
396
  commands_always_local = ["create", "mock"]
397
397
  if (
398
398
  (cloud or command in commands_always_cloud)
@@ -33,6 +33,7 @@ from click import Context
33
33
  from click._termui_impl import ProgressBar
34
34
  from humanfriendly.tables import format_pretty_table
35
35
  from packaging.version import Version
36
+ from thefuzz import process
36
37
 
37
38
  from tinybird.client import (
38
39
  AuthException,
@@ -277,6 +278,77 @@ variable to '1' or 'true'."""
277
278
 
278
279
  sys.exit(exit_code)
279
280
 
281
+ def get_command(self, ctx: click.Context, cmd_name: str) -> Optional[click.Command]:
282
+ """
283
+ Override get_command to add suggestion functionality.
284
+
285
+ Args:
286
+ ctx: Click context
287
+ cmd_name: Command name entered by user
288
+
289
+ Returns:
290
+ Click command if found, None otherwise
291
+ """
292
+ # First, try to get the command normally
293
+ rv = click.Group.get_command(self, ctx, cmd_name)
294
+ if rv is not None:
295
+ return rv
296
+
297
+ # Get all available commands
298
+ commands: List[str] = self.list_commands(ctx)
299
+
300
+ # Find closest matching command using thefuzz
301
+ matches = process.extract(cmd_name, commands, limit=1)
302
+ if not matches:
303
+ return None
304
+
305
+ suggestion, score = matches[0]
306
+
307
+ # Only suggest if the similarity score is high enough (adjust threshold as needed)
308
+ if score >= 65:
309
+ # Initialize lists for arguments before and after command
310
+ args_before_cmd: List[str] = []
311
+ args_after_cmd: List[str] = []
312
+
313
+ # Reconstruct the full command with all arguments
314
+ full_command = ctx.command_path # Gets the base command (e.g., 'tb')
315
+
316
+ # Add any options/arguments that came before the command
317
+ if ctx.args:
318
+ found_cmd = False
319
+ for arg in ctx.args:
320
+ if arg == cmd_name:
321
+ found_cmd = True
322
+ elif found_cmd:
323
+ args_after_cmd.append(arg)
324
+ else:
325
+ args_before_cmd.append(arg)
326
+
327
+ if args_before_cmd:
328
+ full_command += " " + " ".join(args_before_cmd)
329
+
330
+ # Add any options from params
331
+ if ctx.params:
332
+ for param, value in ctx.params.items():
333
+ if value is True:
334
+ full_command += f" --{param}"
335
+ elif value is not False and value is not None:
336
+ full_command += f" --{param} {value}"
337
+
338
+ # Add the suggested command
339
+ full_command += f" {suggestion}"
340
+
341
+ # Add any arguments that came after the command
342
+ if args_after_cmd:
343
+ full_command += " " + " ".join(args_after_cmd)
344
+
345
+ click.echo(f"\nWARNING: '{cmd_name}' is not a valid command. ", nl=False)
346
+ # Ask for confirmation
347
+ if click.confirm(f"Execute '{full_command}' instead?"):
348
+ return click.Group.get_command(self, ctx, suggestion)
349
+
350
+ return None
351
+
280
352
 
281
353
  def load_connector_config(ctx: Context, connector_name: str, debug: bool, check_uninstalled: bool = False):
282
354
  config_file = Path(getcwd()) / f".tinyb_{connector_name}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tinybird
3
- Version: 0.0.1.dev66
3
+ Version: 0.0.1.dev67
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/cli/introduction.html
6
6
  Author: Tinybird
@@ -31,6 +31,7 @@ Requires-Dist: watchdog (==6.0.0)
31
31
  Requires-Dist: wheel
32
32
  Requires-Dist: packaging (<24,>=23.1)
33
33
  Requires-Dist: llm (>=0.19)
34
+ Requires-Dist: thefuzz (==0.22.1)
34
35
  Provides-Extra: bigquery
35
36
  Requires-Dist: gsutil (==4.58) ; extra == 'bigquery'
36
37
  Requires-Dist: google-api-python-client (==2.0.2) ; extra == 'bigquery'
@@ -15,13 +15,13 @@ tinybird/syncasync.py,sha256=IPnOx6lMbf9SNddN1eBtssg8vCLHMt76SuZ6YNYm-Yk,27761
15
15
  tinybird/tornado_template.py,sha256=FL85SMPq2dH4JqKovmSbaolGdEzwOO91NqOzqXo2Qr0,41863
16
16
  tinybird/ch_utils/constants.py,sha256=aYvg2C_WxYWsnqPdZB1ZFoIr8ZY-XjUXYyHKE9Ansj0,3890
17
17
  tinybird/ch_utils/engine.py,sha256=OXkBhlzGjZotjD0vaT-rFIbSGV4tpiHxE8qO_ip0SyQ,40454
18
- tinybird/tb/__cli__.py,sha256=GRk6vijLSZx6TsCAFusMMEjXkUNS-ZUlJVmwCBHAcw4,251
18
+ tinybird/tb/__cli__.py,sha256=2EpNdvVfc3GWff-qZqg1beBtOda0GeCPTg8Ghcd9xrc,251
19
19
  tinybird/tb/cli.py,sha256=FD1pfbzu9YHJHEG6Vtn_EwPLTYhwqw-I6AxXeTaRHU8,926
20
20
  tinybird/tb/modules/auth.py,sha256=EzRWFmwRkXNhUmRaruEVFLdkbUg8xMSix0cAWl5D4Jg,9029
21
21
  tinybird/tb/modules/build.py,sha256=UN1d7EZ93VOlPCrtsay-KLgZnzxn2NCBDY3wvrUSP1Q,9198
22
22
  tinybird/tb/modules/cicd.py,sha256=xxXwy-QekJcG14kkJeGNl7LkHduhZXfvBZE8WrU6-t4,5351
23
- tinybird/tb/modules/cli.py,sha256=oE1hMCQUxfp1m2r9k6y5LlNgvJCNJhwxfilJbUHp7dY,15914
24
- tinybird/tb/modules/common.py,sha256=TWcGJUgzJCQvzI1oMKbNdx-KTRmMGvB25BawHpsaV8Q,70610
23
+ tinybird/tb/modules/cli.py,sha256=D5E5nUMyDzj3tkvkKZdI9LHO9EGFuA1zt4GjI7NKLk0,15921
24
+ tinybird/tb/modules/common.py,sha256=QjH9rugFYKkmGNd7bPBKXjrmROoRhHUtr4MA_X6n-wA,73238
25
25
  tinybird/tb/modules/config.py,sha256=mie3oMVTf5YOUFEiLs88P16U4LkJafJjSpjwyAkFHog,10979
26
26
  tinybird/tb/modules/copy.py,sha256=Aq6wh_wjRiyLQtEOKF9pKLPgJhSvbGTFWIw_LJB0t0U,5801
27
27
  tinybird/tb/modules/create.py,sha256=Q7ZY4oUmEtAYpUbBLjjyiUZ6IKlkU81qJJrmdgjduOk,13914
@@ -74,8 +74,8 @@ tinybird/tb_cli_modules/config.py,sha256=6u6B5QCdiQLbJkCkwtnKGs9H3nP-KXXhC75mF7B
74
74
  tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
75
75
  tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
76
76
  tinybird/tb_cli_modules/telemetry.py,sha256=iEGnMuCuNhvF6ln__j6X9MSTwL_0Hm-GgFHHHvhfknk,10466
77
- tinybird-0.0.1.dev66.dist-info/METADATA,sha256=-MQeZI-aYygYdJ4eu0Rex_wpY0sWsPZzo5t8gvPIhDs,2482
78
- tinybird-0.0.1.dev66.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
79
- tinybird-0.0.1.dev66.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
80
- tinybird-0.0.1.dev66.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
81
- tinybird-0.0.1.dev66.dist-info/RECORD,,
77
+ tinybird-0.0.1.dev67.dist-info/METADATA,sha256=BIAumOPjoQyYAlzUolHZOWedyyDgBNBjk33AA1VQKss,2516
78
+ tinybird-0.0.1.dev67.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
79
+ tinybird-0.0.1.dev67.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
80
+ tinybird-0.0.1.dev67.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
81
+ tinybird-0.0.1.dev67.dist-info/RECORD,,