tinybird 0.0.1.dev126__py3-none-any.whl → 0.0.1.dev127__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.dev126'
8
- __revision__ = '7860cec'
7
+ __version__ = '0.0.1.dev127'
8
+ __revision__ = '7cdc84d'
tinybird/tb/cli.py CHANGED
@@ -14,7 +14,6 @@ import tinybird.tb.modules.create
14
14
  import tinybird.tb.modules.datasource
15
15
  import tinybird.tb.modules.deployment
16
16
  import tinybird.tb.modules.endpoint
17
- import tinybird.tb.modules.fmt
18
17
  import tinybird.tb.modules.infra
19
18
  import tinybird.tb.modules.job
20
19
  import tinybird.tb.modules.local
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev126
3
+ Version: 0.0.1.dev127
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/cli/introduction.html
6
6
  Author: Tinybird
@@ -12,8 +12,8 @@ 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=R_56U8k8apqKnW-xs-fk-jaby1hlI4th1HnLHIpF8bc,252
16
- tinybird/tb/cli.py,sha256=uDLwcbwSJfVFw-pceijZJqaq26z5jNsey0QaUGFjt7w,1097
15
+ tinybird/tb/__cli__.py,sha256=3KqggfFMeFURnwb0L7r0m5PqY_-PoLGJX36JKN8tVrc,252
16
+ tinybird/tb/cli.py,sha256=Xw5EhwCQu6Xx55DzoJsZJODdi7tkA391mii-xgGnpEU,1066
17
17
  tinybird/tb/client.py,sha256=oa0pR46WvzDoqpyaDU-lRu33I0cZhtZVDqDQz2RHMWQ,56085
18
18
  tinybird/tb/config.py,sha256=iIia7F67UI9p51Ja4jALonyttIi4eH7PwOn3HvcvOb8,4008
19
19
  tinybird/tb/modules/auth.py,sha256=_OeYnmTH83lnqCgQEdS6K0bx1KBUeRmZk2M7JnRmWpk,9037
@@ -30,7 +30,6 @@ tinybird/tb/modules/deployment.py,sha256=4Zt7jPbqt18fB5kPx7DbO91Bh6xzBBTEUFY7O89
30
30
  tinybird/tb/modules/endpoint.py,sha256=XySDt3pk66vxOZ0egUfz4bY8bEk3BjOXkv-L0OIJ3sc,12083
31
31
  tinybird/tb/modules/exceptions.py,sha256=4A2sSjCEqKUMqpP3WI00zouCWW4uLaghXXLZBSw04mY,3363
32
32
  tinybird/tb/modules/feedback_manager.py,sha256=8I6n5JFPS4xP-Pfb9iu7hqx5VX773uGDXH2E5QeANeg,74179
33
- tinybird/tb/modules/fmt.py,sha256=qpf9APqKTKL2uphNgdbj4OMVyLkAxZn6dn4eHF99L5g,3553
34
33
  tinybird/tb/modules/infra.py,sha256=eX0StUipaXaxIhMxO82cnAnFKTCa7EPOt-e8pWoSLX0,33206
35
34
  tinybird/tb/modules/job.py,sha256=n4dSSBgnA8NqD7srGahf2xRj6wxkmX9Vl0J-QJ_a2w0,2966
36
35
  tinybird/tb/modules/llm.py,sha256=KfsCYmKeW1VQz0iDZhGKCRkQv_Y3kTHh6JuxvofOguE,1076
@@ -79,8 +78,8 @@ tinybird/tb_cli_modules/config.py,sha256=IsgdtFRnUrkY8-Zo32lmk6O7u3bHie1QCxLwgp4
79
78
  tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
80
79
  tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
81
80
  tinybird/tb_cli_modules/telemetry.py,sha256=Hh2Io8ZPROSunbOLuMvuIFU4TqwWPmQTqal4WS09K1A,10449
82
- tinybird-0.0.1.dev126.dist-info/METADATA,sha256=PNr5bUR9Fhz3S1GSg0aY6BCFGdTnfwz-eCBSRfJMFAg,1612
83
- tinybird-0.0.1.dev126.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
84
- tinybird-0.0.1.dev126.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
85
- tinybird-0.0.1.dev126.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
86
- tinybird-0.0.1.dev126.dist-info/RECORD,,
81
+ tinybird-0.0.1.dev127.dist-info/METADATA,sha256=hH0rsEj2V3CxbLjJ3ueHSa2rbjfnYmk-oTYAPzIon_Q,1612
82
+ tinybird-0.0.1.dev127.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
83
+ tinybird-0.0.1.dev127.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
84
+ tinybird-0.0.1.dev127.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
85
+ tinybird-0.0.1.dev127.dist-info/RECORD,,
@@ -1,94 +0,0 @@
1
- import difflib
2
- import sys
3
- from pathlib import Path
4
- from typing import List, Optional
5
-
6
- import aiofiles
7
- import click
8
- from click import Context
9
-
10
- from tinybird.tb.modules.cli import cli
11
- from tinybird.tb.modules.common import coro
12
- from tinybird.tb.modules.datafile.common import is_file_a_datasource
13
- from tinybird.tb.modules.datafile.diff import color_diff, peek
14
- from tinybird.tb.modules.datafile.format_datasource import format_datasource
15
- from tinybird.tb.modules.datafile.format_pipe import format_pipe
16
- from tinybird.tb.modules.feedback_manager import FeedbackManager
17
-
18
-
19
- @cli.command()
20
- @click.argument("filenames", type=click.Path(exists=True), nargs=-1, required=True)
21
- @click.option(
22
- "--line-length",
23
- is_flag=False,
24
- default=100,
25
- help="A number indicating the maximum characters per line in the node SQL, lines will be splitted based on the SQL syntax and the number of characters passed as a parameter",
26
- )
27
- @click.option("--dry-run", is_flag=True, default=False, help="Don't ask to override the local file")
28
- @click.option("--yes", is_flag=True, default=False, help="Do not ask for confirmation to overwrite the local file")
29
- @click.option(
30
- "--diff",
31
- is_flag=True,
32
- default=False,
33
- help="Formats local file, prints the diff and exits 1 if different, 0 if equal",
34
- )
35
- @click.pass_context
36
- @coro
37
- async def fmt(
38
- ctx: Context, filenames: List[str], line_length: int, dry_run: bool, yes: bool, diff: bool
39
- ) -> Optional[str]:
40
- """
41
- Formats a .datasource, .pipe or .incl file.
42
-
43
- This command removes comments starting with # from the file, use DESCRIPTION instead.
44
-
45
- The format command tries to parse the datafile so syntax errors might rise.
46
-
47
- .incl files must contain a NODE definition.
48
- """
49
-
50
- result = ""
51
- failed = []
52
- for filename in filenames:
53
- if not diff:
54
- click.echo(filename)
55
- extensions = Path(filename).suffixes
56
- if is_file_a_datasource(filename):
57
- result = await format_datasource(filename, skip_eval=True)
58
- elif (".pipe" in extensions) or (".incl" in extensions):
59
- result = await format_pipe(filename, line_length, skip_eval=True)
60
- else:
61
- click.echo("Unsupported file type. Supported files types are: .pipe and .datasource")
62
- return None
63
-
64
- if diff:
65
- result = result.rstrip("\n")
66
- lines_fmt = [f"{line}\n" for line in result.split("\n")]
67
- async with aiofiles.open(filename, "r") as file:
68
- lines_file = await file.readlines()
69
- diff_result = difflib.unified_diff(
70
- lines_file, lines_fmt, fromfile=f"{Path(filename).name} local", tofile="fmt datafile"
71
- )
72
- diff_result = color_diff(diff_result)
73
- not_empty, diff_lines = peek(diff_result)
74
- if not_empty:
75
- sys.stdout.writelines(diff_lines)
76
- failed.append(filename)
77
- click.echo("")
78
- else:
79
- click.echo(result)
80
- if dry_run:
81
- return None
82
-
83
- if yes or click.confirm(FeedbackManager.prompt_override_local_file(name=filename)):
84
- async with aiofiles.open(f"{filename}", "w") as file:
85
- await file.write(result)
86
-
87
- click.echo(FeedbackManager.success_generated_local_file(file=filename))
88
-
89
- if len(failed):
90
- click.echo(FeedbackManager.error_failed_to_format_files(number=len(failed)))
91
- for f in failed:
92
- click.echo(f"tb fmt {f} --yes")
93
- sys.exit(1)
94
- return result