tinybird 0.0.1.dev127__py3-none-any.whl → 0.0.1.dev129__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.dev127'
8
- __revision__ = '7cdc84d'
7
+ __version__ = '0.0.1.dev129'
8
+ __revision__ = 'dda2ada'
@@ -63,7 +63,7 @@ def dev(ctx: click.Context, data_origin: str) -> None:
63
63
  run_watch(project=project, tb_client=tb_client, process=partial(process, project=project, tb_client=tb_client))
64
64
 
65
65
 
66
- def build_project(project: Project, tb_client: TinyB, file_changed: Optional[str] = None) -> None:
66
+ def build_project(project: Project, tb_client: TinyB, file_changed: Optional[str] = None, silent: bool = False) -> None:
67
67
  MULTIPART_BOUNDARY_DATA_PROJECT = "data_project://"
68
68
  DATAFILE_TYPE_TO_CONTENT_TYPE = {
69
69
  ".datasource": "text/plain",
@@ -112,7 +112,7 @@ def build_project(project: Project, tb_client: TinyB, file_changed: Optional[str
112
112
  pipes = build.get("new_pipe_names", [])
113
113
  connections = build.get("new_data_connector_names", [])
114
114
 
115
- if not file_changed:
115
+ if not file_changed and not silent:
116
116
  for ds in datasources:
117
117
  ds_path_str: Optional[str] = next(
118
118
  (p for p in project_files if p.endswith(ds + ".datasource")), None
@@ -261,7 +261,12 @@ def show_data(tb_client: TinyB, filename: str, diff: Optional[str] = None):
261
261
 
262
262
 
263
263
  def process(
264
- project: Project, tb_client: TinyB, watch: bool, file_changed: Optional[str] = None, diff: Optional[str] = None
264
+ project: Project,
265
+ tb_client: TinyB,
266
+ watch: bool,
267
+ file_changed: Optional[str] = None,
268
+ diff: Optional[str] = None,
269
+ silent: bool = False,
265
270
  ) -> None:
266
271
  time_start = time.time()
267
272
  build_failed = False
@@ -271,7 +276,7 @@ def process(
271
276
  rebuild_fixture_sql(project, tb_client, file_changed)
272
277
  else:
273
278
  try:
274
- build_project(project, tb_client, file_changed)
279
+ build_project(project, tb_client, file_changed, silent)
275
280
  except click.ClickException as e:
276
281
  click.echo(FeedbackManager.error(message=e))
277
282
  build_failed = True
@@ -291,7 +296,8 @@ def process(
291
296
  if not watch:
292
297
  sys.exit(1)
293
298
  else:
294
- click.echo(FeedbackManager.success(message=f"\n✓ {rebuild_str} completed in {elapsed_time:.1f}s"))
299
+ if not silent:
300
+ click.echo(FeedbackManager.success(message=f"\n✓ {rebuild_str} completed in {elapsed_time:.1f}s"))
295
301
 
296
302
 
297
303
  def run_watch(
@@ -3,6 +3,7 @@
3
3
  # - If it makes sense and only when strictly necessary, you can create utility functions in this file.
4
4
  # - But please, **do not** interleave utility functions and command definitions.
5
5
 
6
+ import asyncio
6
7
  import difflib
7
8
  import glob
8
9
  import os
@@ -17,6 +18,7 @@ from requests import Response
17
18
 
18
19
  from tinybird.prompts import test_create_prompt
19
20
  from tinybird.tb.client import TinyB
21
+ from tinybird.tb.modules.build import process
20
22
  from tinybird.tb.modules.cli import cli
21
23
  from tinybird.tb.modules.common import coro
22
24
  from tinybird.tb.modules.config import CLIConfig
@@ -79,6 +81,7 @@ async def test_create(ctx: click.Context, name_or_filename: str, prompt: str) ->
79
81
  config = CLIConfig.get_project_config()
80
82
  root_path = project.path
81
83
  folder = project.folder
84
+
82
85
  try:
83
86
  if ".pipe" in name_or_filename:
84
87
  pipe_path = Path(name_or_filename)
@@ -209,20 +212,23 @@ async def test_update(ctx: click.Context, pipe: str) -> None:
209
212
  )
210
213
  @click.argument("name", nargs=-1)
211
214
  @click.pass_context
212
- @coro
213
- async def run_tests(ctx: click.Context, name: Tuple[str, ...]) -> None:
214
- click.echo(FeedbackManager.highlight(message="\n» Running tests"))
215
+ def run_tests(ctx: click.Context, name: Tuple[str, ...]) -> None:
215
216
  client: TinyB = ctx.ensure_object(dict)["client"]
216
217
  project: Project = ctx.ensure_object(dict)["project"]
218
+ click.echo(FeedbackManager.highlight(message="\n» Building project"))
219
+ process(project=project, tb_client=client, watch=False, silent=True)
220
+ click.echo(FeedbackManager.info(message="✓ Done!"))
221
+
222
+ click.echo(FeedbackManager.highlight(message="\n» Running tests"))
217
223
  paths = [Path(n) for n in name]
218
224
  endpoints = [f"{project.path}/tests/{p.stem}.yaml" for p in paths]
219
225
  test_files: List[str] = (
220
226
  endpoints if len(endpoints) > 0 else glob.glob(f"{project.path}/tests/**/*.y*ml", recursive=True)
221
227
  )
222
228
 
223
- async def run_test(test_file):
229
+ def run_test(test_file):
224
230
  test_file_path = Path(test_file)
225
- click.echo(FeedbackManager.info(message=f"\n* {test_file_path.stem}{test_file_path.suffix}"))
231
+ click.echo(FeedbackManager.info(message=f"* {test_file_path.stem}{test_file_path.suffix}"))
226
232
  test_file_content = yaml.safe_load(test_file_path.read_text())
227
233
 
228
234
  for test in test_file_content:
@@ -230,7 +236,9 @@ async def run_tests(ctx: click.Context, name: Tuple[str, ...]) -> None:
230
236
  test_params = test["parameters"].split("?")[1] if "?" in test["parameters"] else test["parameters"]
231
237
  response = None
232
238
  try:
233
- response = await get_pipe_data(client, pipe_name=test_file_path.stem, test_params=test_params)
239
+ response = asyncio.run(
240
+ get_pipe_data(client, pipe_name=test_file_path.stem, test_params=test_params)
241
+ )
234
242
  except Exception:
235
243
  continue
236
244
 
@@ -261,7 +269,7 @@ async def run_tests(ctx: click.Context, name: Tuple[str, ...]) -> None:
261
269
  test_count = len(test_files)
262
270
 
263
271
  for test_file in test_files:
264
- if not await run_test(test_file):
272
+ if not run_test(test_file):
265
273
  failed_tests_count += 1
266
274
 
267
275
  if failed_tests_count:
@@ -164,9 +164,7 @@ class FileChangeHandler(FileSystemEventHandler):
164
164
  is_vendor = "vendor/" in path
165
165
  if is_vendor:
166
166
  return False
167
- return any(
168
- path.endswith(ext) for ext in [".datasource", ".pipe", FixtureExtension.NDJSON, FixtureExtension.CSV]
169
- )
167
+ return any(path.endswith(ext) for ext in [".pipe"])
170
168
 
171
169
  if should_process_path(event.src_path):
172
170
  return event.src_path
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev127
3
+ Version: 0.0.1.dev129
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/cli/introduction.html
6
6
  Author: Tinybird
@@ -12,12 +12,12 @@ 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=3KqggfFMeFURnwb0L7r0m5PqY_-PoLGJX36JKN8tVrc,252
15
+ tinybird/tb/__cli__.py,sha256=FIZWrRkoRrOGFwPY0bmyAzgieDBo5DOnuP6lH3WSs_8,252
16
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
20
- tinybird/tb/modules/build.py,sha256=b1fjWrurDWLwNdWjcNaEaSJh6Iko98uSExw4k_CRoTc,17244
20
+ tinybird/tb/modules/build.py,sha256=KqXMJJW8JEuTlH3KyV1ylCLUob_oFhwDTM7bYLgrK9s,17359
21
21
  tinybird/tb/modules/cicd.py,sha256=A7zJZF9HkJ6NPokplgNjmefMrpUlRbFxBbjMZhq5OTI,7110
22
22
  tinybird/tb/modules/cli.py,sha256=Y_5hu9xwyTIZw4bQoe0MYLnRIzmR7hUjql_oZBxd4Qg,13407
23
23
  tinybird/tb/modules/common.py,sha256=bdKNjHtQKcsZFyZIsLY8vEoTD0Xf-1UNBnh1pAyWPZU,83456
@@ -49,9 +49,9 @@ tinybird/tb/modules/shell.py,sha256=cvT0EKpnSRHfuo3avykBRMsCwLBqmzSR7sNUdbQ6lXA,
49
49
  tinybird/tb/modules/table.py,sha256=4XrtjM-N0zfNtxVkbvLDQQazno1EPXnxTyo7llivfXk,11035
50
50
  tinybird/tb/modules/tag.py,sha256=anPmMUBc-TbFovlpFi8GPkKA18y7Y0GczMsMms5TZsU,3502
51
51
  tinybird/tb/modules/telemetry.py,sha256=FcFw_70-0SyC_2BdToF_sjVpXpMD7i00fCm2SO4cHx8,11397
52
- tinybird/tb/modules/test.py,sha256=HxkSpdLOW8brGUNsqdBoSW8RixxyC7OCDmYwEZsIpfs,11459
52
+ tinybird/tb/modules/test.py,sha256=yJcRtlhQPRXNbifj36v7Lpr1gElL2x7Ke4O5vFazX5o,11755
53
53
  tinybird/tb/modules/token.py,sha256=2fmKwu10_M0pqs6YmJVeILR9ZQB0ejRAET86agASbKM,13488
54
- tinybird/tb/modules/watch.py,sha256=-2DGSShUGAPDYpLVkiDiONC-RqGdZbTiXOCsDtU5udw,8990
54
+ tinybird/tb/modules/watch.py,sha256=_92co0BjTikQuy7MbHr4TDu9A75QdHsrAO8v7DlYLg4,8898
55
55
  tinybird/tb/modules/workspace.py,sha256=SlK08psp0tu5t_URHyIczm696buW6KD6FPs9Lg1aNRE,6614
56
56
  tinybird/tb/modules/workspace_members.py,sha256=RYLpyPM1ECCasHRg3uvpckzXplX0_KgNFsSPZn_i6qk,8744
57
57
  tinybird/tb/modules/datafile/build.py,sha256=d_h3pRFDPFrDKGhpFx2iejY25GuB2k8yfNouj6s8caw,50973
@@ -78,8 +78,8 @@ tinybird/tb_cli_modules/config.py,sha256=IsgdtFRnUrkY8-Zo32lmk6O7u3bHie1QCxLwgp4
78
78
  tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
79
79
  tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
80
80
  tinybird/tb_cli_modules/telemetry.py,sha256=Hh2Io8ZPROSunbOLuMvuIFU4TqwWPmQTqal4WS09K1A,10449
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,,
81
+ tinybird-0.0.1.dev129.dist-info/METADATA,sha256=GoU-l5AmChWcpTWDOaKffdA3b0IIeqoO-r4YjU5fDls,1612
82
+ tinybird-0.0.1.dev129.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
83
+ tinybird-0.0.1.dev129.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
84
+ tinybird-0.0.1.dev129.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
85
+ tinybird-0.0.1.dev129.dist-info/RECORD,,