tinybird 0.0.1.dev200__py3-none-any.whl → 0.0.1.dev202__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.dev200'
8
- __revision__ = '1cfd3bf'
7
+ __version__ = '0.0.1.dev202'
8
+ __revision__ = '63a6016'
@@ -306,8 +306,19 @@ def process(
306
306
  build_status.building = True
307
307
  if file_changed and (file_changed.endswith(FixtureExtension.NDJSON) or file_changed.endswith(FixtureExtension.CSV)):
308
308
  rebuild_fixture(project, tb_client, file_changed)
309
+ if build_status:
310
+ build_status.building = False
311
+ build_status.error = None
309
312
  elif file_changed and file_changed.endswith(".sql"):
310
313
  rebuild_fixture_sql(project, tb_client, file_changed)
314
+ if build_status:
315
+ build_status.building = False
316
+ build_status.error = None
317
+ elif file_changed and (file_changed.endswith(".env.local") or file_changed.endswith(".env")):
318
+ load_secrets(project, tb_client)
319
+ if build_status:
320
+ build_status.building = False
321
+ build_status.error = None
311
322
  else:
312
323
  try:
313
324
  build_result = build_project(project, tb_client, silent)
@@ -38,6 +38,7 @@ from tinybird.tb.modules.create import (
38
38
  from tinybird.tb.modules.exceptions import CLIConnectionException
39
39
  from tinybird.tb.modules.feedback_manager import FeedbackManager
40
40
  from tinybird.tb.modules.project import Project
41
+ from tinybird.tb.modules.secret import save_secret_to_env_file
41
42
 
42
43
  DATA_CONNECTOR_SETTINGS: Dict[DataConnectorType, List[str]] = {
43
44
  DataConnectorType.KAFKA: [
@@ -186,7 +187,7 @@ async def connection_create_s3(ctx: Context) -> None:
186
187
  )
187
188
  unique_suffix = uuid.uuid4().hex[:8] # Use first 8 chars of a UUID for brevity
188
189
  secret_name = f"s3_role_arn_{connection_name}_{unique_suffix}"
189
- await client.create_secret(name=secret_name, value=role_arn)
190
+ save_secret_to_env_file(project=project, name=secret_name, value=role_arn)
190
191
 
191
192
  create_in_cloud = (
192
193
  click.confirm(FeedbackManager.prompt_connection_in_cloud_confirmation(), default=True)
@@ -241,7 +242,6 @@ async def connection_create_gcs(ctx: Context) -> None:
241
242
  """
242
243
  project: Project = ctx.ensure_object(dict)["project"]
243
244
  obj: Dict[str, Any] = ctx.ensure_object(dict)
244
- client: TinyB = obj["client"]
245
245
 
246
246
  service = DataConnectorType.GCLOUD_STORAGE
247
247
  click.echo(FeedbackManager.prompt_gcs_connection_header())
@@ -250,7 +250,7 @@ async def connection_create_gcs(ctx: Context) -> None:
250
250
  creds_json = get_gcs_svc_account_creds()
251
251
  unique_suffix = uuid.uuid4().hex[:8] # Use first 8 chars of a UUID for brevity
252
252
  secret_name = f"gcs_svc_account_creds_{connection_name}_{unique_suffix}"
253
- await client.create_secret(name=secret_name, value=creds_json)
253
+ save_secret_to_env_file(project=project, name=secret_name, value=creds_json)
254
254
 
255
255
  connection_path = await generate_gcs_connection_file_with_secrets(
256
256
  name=connection_name,
@@ -356,7 +356,6 @@ async def connection_create_kafka(
356
356
  security_protocol="SASL_SSL",
357
357
  skip_secrets=False,
358
358
  ) -> Tuple[str, str, str, str, str, str, str, str, List[str]]:
359
- client: TinyB = ctx.ensure_object(dict)["client"]
360
359
  obj: Dict[str, Any] = ctx.ensure_object(dict)
361
360
  click.echo(FeedbackManager.gray(message="\n» Creating Kafka connection..."))
362
361
  project: Project = ctx.ensure_object(dict)["project"]
@@ -374,7 +373,7 @@ async def connection_create_kafka(
374
373
 
375
374
  validate_kafka_bootstrap_servers(bootstrap_servers)
376
375
  secret_required = not skip_secrets and click.confirm(
377
- FeedbackManager.highlight(message=" ? Do you want to store the bootstrap server in a Tinybird Secret? [Y/n]"),
376
+ FeedbackManager.highlight(message=" ? Do you want to store the bootstrap server in a .env.local file? [Y/n]"),
378
377
  default=True,
379
378
  show_default=False,
380
379
  )
@@ -385,7 +384,7 @@ async def connection_create_kafka(
385
384
  if secret_required:
386
385
  tb_secret_bootstrap_servers = str(click.prompt(FeedbackManager.highlight(message=" ? Secret name")))
387
386
  try:
388
- await client.create_secret(name=tb_secret_bootstrap_servers, value=bootstrap_servers)
387
+ save_secret_to_env_file(project=project, name=tb_secret_bootstrap_servers, value=bootstrap_servers)
389
388
  except Exception as e:
390
389
  raise CLIConnectionException(FeedbackManager.error(message=str(e)))
391
390
 
@@ -395,7 +394,7 @@ async def connection_create_kafka(
395
394
  validate_kafka_key(key)
396
395
 
397
396
  secret_required = not skip_secrets and click.confirm(
398
- FeedbackManager.highlight(message=" ? Do you want to store the Kafka key in a Tinybird Secret? [Y/n]"),
397
+ FeedbackManager.highlight(message=" ? Do you want to store the Kafka key in a .env.local file? [Y/n]"),
399
398
  default=True,
400
399
  show_default=False,
401
400
  )
@@ -403,7 +402,7 @@ async def connection_create_kafka(
403
402
  if secret_required:
404
403
  tb_secret_key = str(click.prompt(FeedbackManager.highlight(message=" ? Secret name")))
405
404
  try:
406
- await client.create_secret(name=tb_secret_key, value=key)
405
+ save_secret_to_env_file(project=project, name=tb_secret_key, value=key)
407
406
  except Exception as e:
408
407
  raise CLIConnectionException(FeedbackManager.error(message=str(e)))
409
408
 
@@ -413,7 +412,7 @@ async def connection_create_kafka(
413
412
  validate_kafka_secret(secret)
414
413
 
415
414
  secret_required = not skip_secrets and click.confirm(
416
- FeedbackManager.highlight(message=" ? Do you want to store the Kafka secret in a Tinybird Secret? [Y/n]"),
415
+ FeedbackManager.highlight(message=" ? Do you want to store the Kafka secret in a .env.local file? [Y/n]"),
417
416
  default=True,
418
417
  show_default=False,
419
418
  )
@@ -421,7 +420,7 @@ async def connection_create_kafka(
421
420
  if secret_required:
422
421
  tb_secret_secret = str(click.prompt(FeedbackManager.highlight(message=" ? Secret name")))
423
422
  try:
424
- await client.create_secret(name=tb_secret_secret, value=secret)
423
+ save_secret_to_env_file(project=project, name=tb_secret_secret, value=secret)
425
424
  except Exception as e:
426
425
  raise CLIConnectionException(FeedbackManager.error(message=str(e)))
427
426
 
@@ -124,6 +124,12 @@ async def create(
124
124
  if data or prompt:
125
125
  click.echo(FeedbackManager.success(message="✓ Resources created!\n"))
126
126
 
127
+ if not already_has_env_file(root_folder):
128
+ click.echo(FeedbackManager.highlight(message="\n» Creating .env.local file..."))
129
+ create_env_file(root_folder)
130
+ click.echo(FeedbackManager.success(message="✓ Done!\n"))
131
+ created_something = True
132
+
127
133
  if not already_has_cicd(root_folder):
128
134
  click.echo(FeedbackManager.highlight(message="\n» Creating CI/CD files for GitHub and GitLab..."))
129
135
  init_git(root_folder)
@@ -230,6 +236,11 @@ def already_has_cursor_rules(folder: str) -> bool:
230
236
  return any((Path(folder) / path).exists() for path in cursor_rules_paths)
231
237
 
232
238
 
239
+ def already_has_env_file(folder: str) -> bool:
240
+ env_file_pattern = ".env.*"
241
+ return any((Path(folder) / path).exists() for path in glob.glob(env_file_pattern))
242
+
243
+
233
244
  def create_project_structure(folder: str):
234
245
  folder_path = Path(folder)
235
246
  PROJECT_PATHS_DESCRIPTIONS = {
@@ -433,6 +444,11 @@ GCS_SERVICE_ACCOUNT_CREDENTIALS_JSON {{{{ tb_secret("{svc_account_creds}") }}}}
433
444
  return file_path
434
445
 
435
446
 
447
+ def create_env_file(folder: str):
448
+ env_file = Path(folder) / ".env.local"
449
+ env_file.write_text("")
450
+
451
+
436
452
  def create_rules(folder: str, source: str, agent: str):
437
453
  if agent == "cursor":
438
454
  extension = ".cursorrules"
@@ -2,7 +2,7 @@ import re
2
2
  from typing import Dict, Optional
3
3
 
4
4
  import click
5
- from dotenv import dotenv_values
5
+ from dotenv import dotenv_values, set_key
6
6
 
7
7
  from tinybird.syncasync import async_to_sync
8
8
  from tinybird.tb.client import TinyB
@@ -137,3 +137,12 @@ def load_secrets(project: Project, client: TinyB):
137
137
  click.echo(FeedbackManager.success(message="✓ Secrets loaded!"))
138
138
  except Exception as e:
139
139
  click.echo(FeedbackManager.error(message=f"✗ Error: {e}"))
140
+
141
+
142
+ def save_secret_to_env_file(project: Project, name: str, value: str):
143
+ env_path = project.path / ".env.local"
144
+
145
+ if not env_path.exists():
146
+ env_path.touch()
147
+
148
+ set_key(env_path, key_to_set=name, value_to_set=value)
@@ -23,7 +23,16 @@ from tinybird.tb.modules.shell import Shell
23
23
 
24
24
 
25
25
  class WatchProjectHandler(PatternMatchingEventHandler):
26
- valid_extensions = [".datasource", ".pipe", "connection", FixtureExtension.CSV, FixtureExtension.NDJSON, ".sql"]
26
+ valid_extensions = [
27
+ ".datasource",
28
+ ".pipe",
29
+ "connection",
30
+ FixtureExtension.CSV,
31
+ FixtureExtension.NDJSON,
32
+ ".sql",
33
+ ".env",
34
+ ".env.local",
35
+ ]
27
36
 
28
37
  def __init__(self, shell: Shell, project: Project, process: Callable):
29
38
  self.shell = shell
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev200
3
+ Version: 0.0.1.dev202
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/forward/commands
6
6
  Author: Tinybird
@@ -12,19 +12,19 @@ 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=DiQBRU0k9K-SDyrntZsY1l2JRmWLeIjyAaWQBT3cB-4,247
15
+ tinybird/tb/__cli__.py,sha256=RoHTMy_eFgLfOsfLrQ7GJrLxsOdAManctqTsut70TNI,247
16
16
  tinybird/tb/check_pypi.py,sha256=rW4QmDRbtgKdUUwJCnBkVjmTjZSZGN-XgZhx7vMkC0w,1009
17
17
  tinybird/tb/cli.py,sha256=u3eGOhX0MHkuT6tiwaZ0_3twqLmqKXDAOxF7yV_Nn9Q,1075
18
18
  tinybird/tb/client.py,sha256=CO-dQw8h28X6T6IO-Z79yPBKaJQT1Rwya5b6gexvw58,56491
19
19
  tinybird/tb/config.py,sha256=jT9xndpeCY_g0HdB5qE2EquC0TFRRnkPnQFWZWd04jo,3998
20
- tinybird/tb/modules/build.py,sha256=GtIhPL60_LsHy0cVPxaNpexq66vNJF5x1QBnoOpEmGI,19497
20
+ tinybird/tb/modules/build.py,sha256=96J_n8IWYPLN0JORPb6QXgT4-3JXw4JSXmAtzQcqN7E,19951
21
21
  tinybird/tb/modules/cicd.py,sha256=Njb6eZOHHbUkoJJx6KoixO9PsfA_T-3Ybkya9-50Ca8,7328
22
22
  tinybird/tb/modules/cli.py,sha256=qmD1tNoPXxpDuTD_Vu4YIR9egc3m1eS0NIhaQzacOYo,15605
23
23
  tinybird/tb/modules/common.py,sha256=R675BLZTnPlCoPphCTcy3S1lsf1MF_H3U_ox9yPNCqg,84187
24
24
  tinybird/tb/modules/config.py,sha256=ziqW_t_mRVvWOd85VoB4vKyvgMkEfpXDf9H4v38p2xc,11422
25
- tinybird/tb/modules/connection.py,sha256=bULX6oru3MINhQGuXOmlALAJUTgLltO0kMOMtmLVNxg,17746
25
+ tinybird/tb/modules/connection.py,sha256=FJZHTAR6sf5VbPIotxbyMgO-6UCCbnsKj6I0EjeCa-g,17791
26
26
  tinybird/tb/modules/copy.py,sha256=2Mm4FWKehOG7CoOhiF1m9UZJgJn0W1_cMolqju8ONYg,5805
27
- tinybird/tb/modules/create.py,sha256=57oxoXl9a0swV7YFP43lcrmOChKaj9dcLcWrmiYDNyg,21543
27
+ tinybird/tb/modules/create.py,sha256=sncG6iaeS_AApY1EmmfYEdj9B6-1CPZJzvTmfJQj_Rc,22112
28
28
  tinybird/tb/modules/datasource.py,sha256=qbASM0g49JK8LCFy12g18DdAPOJ-mdfWCCfg8Fhu-ME,38450
29
29
  tinybird/tb/modules/deployment.py,sha256=QeLYvk6vNmOFC2FAvhR5tzFIYDkSCVgT08CGEIxr4fU,28154
30
30
  tinybird/tb/modules/deprecations.py,sha256=rrszC1f_JJeJ8mUxGoCxckQTJFBCR8wREf4XXXN-PRc,4507
@@ -47,13 +47,13 @@ tinybird/tb/modules/open.py,sha256=OuctINN77oexpSjth9uoIZPCelKO4Li-yyVxeSnk1io,1
47
47
  tinybird/tb/modules/pipe.py,sha256=AQKEDagO6e3psPVjJkS_MDbn8aK-apAiLp26k7jgAV0,2432
48
48
  tinybird/tb/modules/project.py,sha256=xaXzLytWieNvSfK8DRvFJMXWxVNTAp4mI7Jkvozauoc,5599
49
49
  tinybird/tb/modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
50
- tinybird/tb/modules/secret.py,sha256=jjSb2dWW2neeq_lkZxRARSMiSoH88VNkDiQOi89dbeM,4705
50
+ tinybird/tb/modules/secret.py,sha256=jw1DIDKmS1L1U-y7LRYo65sVSGuRcpIHGo5CNiKHjo4,4945
51
51
  tinybird/tb/modules/shell.py,sha256=Zd_4Ak_5tKVX-cw6B4ag36xZeEGHeh-jZpAsIXkoMoE,14116
52
52
  tinybird/tb/modules/table.py,sha256=4XrtjM-N0zfNtxVkbvLDQQazno1EPXnxTyo7llivfXk,11035
53
53
  tinybird/tb/modules/telemetry.py,sha256=X0p5AVkM8BNsK_Rhdcg4p2eIf6OHimHO_VLldBqHQ8o,11386
54
54
  tinybird/tb/modules/test.py,sha256=XakpYi0Q2gGKItpPdtRVLKzQldkvCPqzPhwwbUxyrmc,13292
55
55
  tinybird/tb/modules/token.py,sha256=2fmKwu10_M0pqs6YmJVeILR9ZQB0ejRAET86agASbKM,13488
56
- tinybird/tb/modules/watch.py,sha256=H1FieLTVGRqmZ0hR0vELbQJ9l0CThrFCgGCta-MPuAY,8883
56
+ tinybird/tb/modules/watch.py,sha256=tkt2s8CLxBvB9Ty7YVgdh4wBTWIisZA5pstZTG7sZy8,8976
57
57
  tinybird/tb/modules/workspace.py,sha256=WDi3Vu9t60b4Ht5vbPsakUErFmsECtFRcfXb1l300xc,11057
58
58
  tinybird/tb/modules/workspace_members.py,sha256=RYLpyPM1ECCasHRg3uvpckzXplX0_KgNFsSPZn_i6qk,8744
59
59
  tinybird/tb/modules/datafile/build.py,sha256=MTzX8gWlxHov9C8c1PduyDDsp1dxxWSl26mCVyTvJPg,51395
@@ -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.dev200.dist-info/METADATA,sha256=8RxXJeb1UA6_yPuJMwgAUYHVuXeuHOF-YnkTHpoDUJ0,1682
84
- tinybird-0.0.1.dev200.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
85
- tinybird-0.0.1.dev200.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
86
- tinybird-0.0.1.dev200.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
87
- tinybird-0.0.1.dev200.dist-info/RECORD,,
83
+ tinybird-0.0.1.dev202.dist-info/METADATA,sha256=tzzM6EJY5C0LWX2EB8Fqub-xCt0FWuNl2aLkJlXTfms,1682
84
+ tinybird-0.0.1.dev202.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
85
+ tinybird-0.0.1.dev202.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
86
+ tinybird-0.0.1.dev202.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
87
+ tinybird-0.0.1.dev202.dist-info/RECORD,,