tinybird 0.0.1.dev226__py3-none-any.whl → 0.0.1.dev228__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.dev226'
8
- __revision__ = '7ee5a2e'
7
+ __version__ = '0.0.1.dev228'
8
+ __revision__ = '1a9e75c'
@@ -177,7 +177,7 @@ class CICDGeneratorBase:
177
177
  continue
178
178
  with open(f"{path}/{cicd_file.full_path}", "wb") as f:
179
179
  f.write(content)
180
- click.echo(FeedbackManager.info(message=cicd_file.full_path.replace("./.", ".")))
180
+ click.echo(FeedbackManager.info_file_created(file=cicd_file.full_path.replace("./.", ".")))
181
181
  if cicd_file.warning_message is not None:
182
182
  return FeedbackManager.warning_for_cicd_file(
183
183
  file_name=cicd_file.file_name, warning_message=cicd_file.warning_message.format(**params)
@@ -116,10 +116,11 @@ async def create(
116
116
  readme_path.read_text(), tb_client.host, "$TB_ADMIN_TOKEN", all_resources_xml
117
117
  ),
118
118
  prompt=readme_user_prompt,
119
+ feature="tb_create_readme",
119
120
  )
120
121
  readme_result = extract_xml(readme_response, "readme")
121
122
  readme_path.write_text(readme_result)
122
- click.echo(FeedbackManager.info(message="README.md"))
123
+ click.echo(FeedbackManager.info_file_created(file="README.md"))
123
124
  created_something = True
124
125
 
125
126
  if data or prompt:
@@ -141,14 +142,14 @@ async def create(
141
142
  if not already_has_cursor_rules(root_folder):
142
143
  click.echo(FeedbackManager.highlight(message="\n» Creating rules..."))
143
144
  create_rules(root_folder, "tb", agent)
144
- click.echo(FeedbackManager.info(message=".cursorrules"))
145
+ click.echo(FeedbackManager.info_file_created(file=".cursorrules"))
145
146
  click.echo(FeedbackManager.success(message="✓ Done!\n"))
146
147
  created_something = True
147
148
 
148
149
  if not already_has_claude_rules(root_folder):
149
150
  click.echo(FeedbackManager.highlight(message="\n» Creating Claude Code rules..."))
150
151
  create_claude_rules(root_folder, "tb")
151
- click.echo(FeedbackManager.info(message="CLAUDE.md"))
152
+ click.echo(FeedbackManager.info_file_created(file="CLAUDE.md"))
152
153
  click.echo(FeedbackManager.success(message="✓ Done!\n"))
153
154
  created_something = True
154
155
 
@@ -169,7 +170,7 @@ async def create(
169
170
 
170
171
  ds_name = ds_path.stem
171
172
  datasource_path = Path(folder) / "datasources" / f"{ds_name}.datasource"
172
- click.echo(FeedbackManager.info(message=f"/fixtures/{ds_name}.{data_format}"))
173
+ click.echo(FeedbackManager.info_file_created(file=f"fixtures/{ds_name}.{data_format}"))
173
174
  persist_fixture(ds_name, data_content, folder, format=data_format)
174
175
  click.echo(FeedbackManager.success(message="✓ Done!"))
175
176
  created_something = True
@@ -195,7 +196,7 @@ async def create(
195
196
  )
196
197
  if mock_data:
197
198
  persist_fixture(datasource_name, mock_data, folder, format="ndjson")
198
- click.echo(FeedbackManager.info(message=f"/fixtures/{datasource_name}.ndjson"))
199
+ click.echo(FeedbackManager.info_file_created(file=f"fixtures/{datasource_name}.ndjson"))
199
200
  click.echo(FeedbackManager.success(message="✓ Done!"))
200
201
  created_something = True
201
202
 
@@ -284,7 +285,7 @@ def create_project_structure(folder: str):
284
285
  f = folder_path / path
285
286
  f.mkdir()
286
287
  click.echo(
287
- FeedbackManager.info(message=f"/{x} ") + FeedbackManager.gray(message=PROJECT_PATHS_DESCRIPTIONS[x])
288
+ FeedbackManager.info(message=f"./{x} ") + FeedbackManager.gray(message=PROJECT_PATHS_DESCRIPTIONS[x])
288
289
  )
289
290
  except FileExistsError:
290
291
  pass
@@ -295,6 +296,7 @@ async def create_resources_from_prompt(
295
296
  user_token: str,
296
297
  prompt: str,
297
298
  project: Project,
299
+ feature: str = "tb_create_resources",
298
300
  ) -> List[Path]:
299
301
  result: List[Path] = []
300
302
  datasource_paths = [Path(ds_file) for ds_file in project.get_datasource_files()]
@@ -325,7 +327,7 @@ async def create_resources_from_prompt(
325
327
  ]
326
328
  )
327
329
  llm = LLM(user_token=user_token, host=tb_client.host)
328
- prompt_result = llm.ask(system_prompt=create_prompt(resources_xml), prompt=prompt)
330
+ prompt_result = llm.ask(system_prompt=create_prompt(resources_xml), prompt=prompt, feature=feature)
329
331
  prompt_result = extract_xml(prompt_result, "response")
330
332
  resources = parse_xml(prompt_result, "resource")
331
333
  datasources = []
@@ -384,7 +386,7 @@ def init_git(folder: str):
384
386
  else:
385
387
  gitignore_file.write_text(".tinyb\n.terraform\n")
386
388
 
387
- click.echo(FeedbackManager.info(message=".gitignore"))
389
+ click.echo(FeedbackManager.info_file_created(file=".gitignore"))
388
390
  except Exception as e:
389
391
  raise Exception(f"Error initializing Git: {e}")
390
392
 
@@ -781,7 +781,7 @@ async def datasource_create(
781
781
  raise Exception("This action requires authentication. Run 'tb login' first.")
782
782
  project_config = CLIConfig.get_project_config()
783
783
  tb_client: TinyB = project_config.get_client(token=config.get("token"), host=config.get("host"))
784
- await create_resources_from_prompt(tb_client, user_token, prompt, project)
784
+ await create_resources_from_prompt(tb_client, user_token, prompt, project, feature="tb_datasource_create")
785
785
  click.echo(FeedbackManager.success(message="✓ .datasource created!"))
786
786
  return
787
787
 
@@ -1023,6 +1023,7 @@ async def analyze_quarantine(datasource_name: str, project: Project, client: Tin
1023
1023
  response_llm = llm.ask(
1024
1024
  system_prompt=quarantine_prompt(datasource_definition),
1025
1025
  prompt=f"The quarantine errors are:\n{json.dumps(quarantine_data)}",
1026
+ feature="tb_datasource_append_analyze_quarantine",
1026
1027
  )
1027
1028
  response = extract_xml(response_llm, "quarantine_errors")
1028
1029
  error_message += "\n" + response
@@ -895,9 +895,9 @@ STEP 3: ADD KEY TO SERVICE ACCOUNT
895
895
  info_removing_pipe = info_message("** Removing pipe {pipe}")
896
896
  info_removing_pipe_not_found = info_message("** {pipe} not found")
897
897
  info_dry_removing_pipe = info_message("** [DRY RUN] Removing pipe {pipe}")
898
- info_path_created = info_message("/{path}")
899
- info_file_created = info_message("/{file}")
900
- info_path_already_exists = info_message("/{path} already exists, skipping")
898
+ info_path_created = info_message("./{path}")
899
+ info_file_created = info_message("./{file}")
900
+ info_path_already_exists = info_message("./{path} already exists, skipping")
901
901
  info_dottinyb_already_ignored = info_message("** - '.tinyb' already in .gitignore, skipping")
902
902
  info_dotdifftemp_already_ignored = info_message("** - '.diff_tmp' not found or already in .gitignore, skipping")
903
903
  info_dottinyenv_already_exists = info_message("** - '.tinyenv' already exists, skipping")
@@ -1,5 +1,9 @@
1
+ import urllib.parse
2
+ from typing import Optional
3
+
1
4
  import requests
2
5
 
6
+ from tinybird.tb.modules.cli import CLIConfig
3
7
  from tinybird.tb.modules.feedback_manager import FeedbackManager
4
8
 
5
9
 
@@ -16,7 +20,7 @@ class LLM:
16
20
  self.host = host
17
21
  self.user_token = user_token
18
22
 
19
- def ask(self, system_prompt: str, prompt: str) -> str:
23
+ def ask(self, system_prompt: str, prompt: str, feature: Optional[str] = None) -> str:
20
24
  """
21
25
  Calls the model with the given prompt and returns the response.
22
26
 
@@ -29,14 +33,23 @@ class LLM:
29
33
  """
30
34
 
31
35
  data = {"system": system_prompt, "prompt": prompt}
32
-
36
+ params = {"origin": "cli"}
37
+ if feature:
38
+ params["feature"] = feature
39
+ cli_config = CLIConfig.get_project_config()
40
+ workspace_id = cli_config.get("id")
41
+ params_str = urllib.parse.urlencode(params)
42
+ if workspace_id:
43
+ llm_url = f"{self.host}/v0/llm/{workspace_id}?{params_str}"
44
+ else:
45
+ llm_url = f"{self.host}/v0/llm?{params_str}"
33
46
  response = requests.post(
34
- f"{self.host}/v0/llm",
47
+ llm_url,
35
48
  headers={"Authorization": f"Bearer {self.user_token}"},
36
49
  data=data,
37
50
  )
38
51
 
39
52
  if not response.ok:
40
- raise LLMException(FeedbackManager.error_request_failed(status_code=response.status_code))
53
+ raise LLMException(FeedbackManager.error(message=response.text))
41
54
 
42
55
  return response.json().get("result", "")
@@ -132,7 +132,7 @@ async def create_mock_data(
132
132
  sql_path = None
133
133
  while True:
134
134
  try:
135
- response = llm.ask(system_prompt=mock_prompt(rows, error), prompt=prompt)
135
+ response = llm.ask(system_prompt=mock_prompt(rows, error), prompt=prompt, feature="tb_mock")
136
136
  sql = extract_xml(response, "sql")
137
137
  sql_path = persist_fixture_sql(datasource_name, sql, folder)
138
138
  sql_format = "JSON" if format_ == "ndjson" else "CSV"
@@ -149,7 +149,9 @@ async def create_mock_data(
149
149
  error = str(e)
150
150
  attempts += 1
151
151
  if attempts > 5:
152
- raise Exception(f"Failed to generate a valid solution. Check {str(sql_path)} and try again.")
152
+ raise Exception(
153
+ f"Failed to generate a valid solution. Check {str(sql_path or '.sql path')} and try again."
154
+ )
153
155
  else:
154
156
  continue
155
157
  return data
@@ -102,7 +102,7 @@ def test_create(ctx: click.Context, name_or_filename: str, prompt: str) -> None:
102
102
  raise Exception("No user token found")
103
103
 
104
104
  llm = LLM(user_token=user_token, host=config.get_client().host)
105
- response_llm = llm.ask(system_prompt=system_prompt, prompt=prompt)
105
+ response_llm = llm.ask(system_prompt=system_prompt, prompt=prompt, feature="tb_test_create")
106
106
  response_xml = extract_xml(response_llm, "response")
107
107
  tests_content = parse_xml(response_xml, "test")
108
108
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev226
3
+ Version: 0.0.1.dev228
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/forward/commands
6
6
  Author: Tinybird
@@ -17,37 +17,37 @@ tinybird/datafile/exceptions.py,sha256=8rw2umdZjtby85QbuRKFO5ETz_eRHwUY5l7eHsy1w
17
17
  tinybird/datafile/parse_connection.py,sha256=tRyn2Rpr1TeWet5BXmMoQgaotbGdYep1qiTak_OqC5E,1825
18
18
  tinybird/datafile/parse_datasource.py,sha256=ssW8QeFSgglVFi3sDZj_HgkJiTJ2069v2JgqnH3CkDE,1825
19
19
  tinybird/datafile/parse_pipe.py,sha256=xf4m0Tw44QWJzHzAm7Z7FwUoUUtr7noMYjU1NiWnX0k,3880
20
- tinybird/tb/__cli__.py,sha256=ZdJ5gN229WGVrUEQ1-5I8F7Lpre7HyytuDDzNgK6aCw,247
20
+ tinybird/tb/__cli__.py,sha256=6UmdzNjS-aX3yoDOzf3ApvaWpj5UPI69igaZUUi7P1A,247
21
21
  tinybird/tb/check_pypi.py,sha256=i3l2L8IajeB7sreikR7oPlYJki9MtS3c_M4crnmbByc,760
22
22
  tinybird/tb/cli.py,sha256=0xYk2Ip4vb3nNFbxfTdG3VoIgdRvUKVbUVU_mviErPA,1107
23
23
  tinybird/tb/client.py,sha256=FKj61vY9STPW03kfVcxYuY1_csI-kP-mc1ERQfqJtg8,56505
24
24
  tinybird/tb/config.py,sha256=jT9xndpeCY_g0HdB5qE2EquC0TFRRnkPnQFWZWd04jo,3998
25
25
  tinybird/tb/modules/build.py,sha256=T36msoBK5g9AZlrJnFRPvlZbrdE265LY1q3Y4YqvS3w,20067
26
- tinybird/tb/modules/cicd.py,sha256=Njb6eZOHHbUkoJJx6KoixO9PsfA_T-3Ybkya9-50Ca8,7328
26
+ tinybird/tb/modules/cicd.py,sha256=H22MaMsqAeDv-OmeHFOlUOAmfNzEzTFaEV9TQ0g4ehs,7338
27
27
  tinybird/tb/modules/cli.py,sha256=zTUob6oSZszCx-lk6MJbQ_VuNOXBo8b0DOHPWezzMOg,15997
28
28
  tinybird/tb/modules/common.py,sha256=F6oaoFZ3aBxEMjiDKYhthsEIUqSFPkcdlMJ7h7A49Ac,83114
29
29
  tinybird/tb/modules/config.py,sha256=VnzYVUo4q1RBEEMMce4_OCrKp4erhgkRPHElydVlKj0,11488
30
30
  tinybird/tb/modules/connection.py,sha256=dAOv8z3ym9Tt62j7AI8R9PgFwgiCIFdgIMpUiMdtxaQ,18906
31
31
  tinybird/tb/modules/copy.py,sha256=zHN1d5NA-MFsgbk2kKJq2P9qA8dNOnIsIa60QpVnSwc,4458
32
- tinybird/tb/modules/create.py,sha256=8kDyO_zDKPWKilmY9QVJXfJLFRjGO3I2sCD6Dt3Flxs,23214
33
- tinybird/tb/modules/datasource.py,sha256=4a50A_qwB-3FUEUeB3ps6tUCJvn02rMUUwW-vHaMjTw,40846
32
+ tinybird/tb/modules/create.py,sha256=56_x6nwj_oAr72X7AvdxXAuXCDKGJp-w1dP6E2XdxqU,23376
33
+ tinybird/tb/modules/datasource.py,sha256=UiQXDkSEmQIPj4NcUD_I4bAJe9IGVmlVW07yGgSu6kY,40941
34
34
  tinybird/tb/modules/deployment.py,sha256=ByXIgEvwxB49pJEKKj0EJIfORWyflCYr04k8961nBkA,28391
35
35
  tinybird/tb/modules/deprecations.py,sha256=rrszC1f_JJeJ8mUxGoCxckQTJFBCR8wREf4XXXN-PRc,4507
36
36
  tinybird/tb/modules/dev_server.py,sha256=57FCKuWpErwYUYgHspYDkLWEm9F4pbvVOtMrFXX1fVU,10129
37
37
  tinybird/tb/modules/endpoint.py,sha256=rC1CZiEZDMb5chByf4xZhv5PsfkoLeIVDScHQ-QcBsE,12072
38
38
  tinybird/tb/modules/exceptions.py,sha256=5jK91w1LPmtqIUfDpHe_Op5OxGz8-p1BPgtLREMIni0,5217
39
- tinybird/tb/modules/feedback_manager.py,sha256=SMaoDjz-JGfh6hUxRiaGf2JOYZa_afDL8QFITA_M1mQ,77963
39
+ tinybird/tb/modules/feedback_manager.py,sha256=5N2S_ymq0nJPQcFetzoQOWfR6hhx8_gaTp318pe76zU,77966
40
40
  tinybird/tb/modules/info.py,sha256=NqSsoyzFqbtUEGH_tSowNOI_jSsNuixibln6-plsfOY,6810
41
41
  tinybird/tb/modules/infra.py,sha256=fve30Gj3mG9zbquGxS2e4ipcOYOxviWQCpNFfEzJN_Q,33195
42
42
  tinybird/tb/modules/job.py,sha256=AsUCRNzy7HG5oJ4fyk9NpIm5NtNJgBZSy8MtJdXBe5A,3167
43
- tinybird/tb/modules/llm.py,sha256=KfsCYmKeW1VQz0iDZhGKCRkQv_Y3kTHh6JuxvofOguE,1076
43
+ tinybird/tb/modules/llm.py,sha256=QbHRcMLgFmLKEh4zVb2ctR_5tIGUGdFJrAiRCDtMxDw,1572
44
44
  tinybird/tb/modules/llm_utils.py,sha256=nS9r4FAElJw8yXtmdYrx-rtI2zXR8qXfi1QqUDCfxvg,3469
45
45
  tinybird/tb/modules/local.py,sha256=TWT7pGXQ3cOy0M_piyw7WhrzoxZE18PmfOLzHD5CoEc,6096
46
46
  tinybird/tb/modules/local_common.py,sha256=8CSEVygFi0fIISatYxCStcHizugXCA9WNTLO_zDKmXw,17195
47
47
  tinybird/tb/modules/login.py,sha256=VxxCzyjG5dpFm1lmlNPVcM-0-jqURAFp4HEkMMBdiGo,12617
48
48
  tinybird/tb/modules/logout.py,sha256=sniI4JNxpTrVeRCp0oGJuQ3yRerG4hH5uz6oBmjv724,1009
49
49
  tinybird/tb/modules/materialization.py,sha256=neugOziGfh50GSOgfZJX8giVPKgauoE313LUw6kXowo,5467
50
- tinybird/tb/modules/mock.py,sha256=IyHweMUM6bUH8IhyiX2tTMpdVpTFUeAJ41lZ5P42-HQ,5303
50
+ tinybird/tb/modules/mock.py,sha256=pp7NN79chzStHua4FKVMejI6NLYvzXjP6P7nzf6nSxM,5375
51
51
  tinybird/tb/modules/open.py,sha256=OuctINN77oexpSjth9uoIZPCelKO4Li-yyVxeSnk1io,1371
52
52
  tinybird/tb/modules/pipe.py,sha256=ExDOk3ze76JacNEVrN4DbIopNvSurDCSR7QR9ii2xGQ,2421
53
53
  tinybird/tb/modules/project.py,sha256=pOcvtgsR0ibPi0sNu-6GuAI4WS2DORRALezisjN3xY8,5662
@@ -57,7 +57,7 @@ tinybird/tb/modules/shell.py,sha256=Zd_4Ak_5tKVX-cw6B4ag36xZeEGHeh-jZpAsIXkoMoE,
57
57
  tinybird/tb/modules/sink.py,sha256=bIjLjog4XH42yfp944cMnaE4il7Kl7Wn7F-nLKfH2Bc,3913
58
58
  tinybird/tb/modules/table.py,sha256=4XrtjM-N0zfNtxVkbvLDQQazno1EPXnxTyo7llivfXk,11035
59
59
  tinybird/tb/modules/telemetry.py,sha256=T9gtsQffWqG_4hRBaUJPzOfMkPwz7mH-R6Bn1XRYViA,11482
60
- tinybird/tb/modules/test.py,sha256=XakpYi0Q2gGKItpPdtRVLKzQldkvCPqzPhwwbUxyrmc,13292
60
+ tinybird/tb/modules/test.py,sha256=ZRWzrYcoaUB16pAEAxtCaE0rgc1srMx7VuOTqvrpsjk,13318
61
61
  tinybird/tb/modules/token.py,sha256=pSlDed5RzcadJlvIKQh22Y49gt1Rfw-0rCTko6x4y3g,12879
62
62
  tinybird/tb/modules/watch.py,sha256=HhruZoUrehlxL_nFIK3BlpHp2uyzKAM9cmNXBCa4Zgs,8965
63
63
  tinybird/tb/modules/workspace.py,sha256=ngn5yGG9K9sFaUzm0W42j_vQnm3pQS2Jh38GNgbMtP0,11607
@@ -82,8 +82,8 @@ tinybird/tb_cli_modules/config.py,sha256=IsgdtFRnUrkY8-Zo32lmk6O7u3bHie1QCxLwgp4
82
82
  tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
83
83
  tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
84
84
  tinybird/tb_cli_modules/telemetry.py,sha256=Hh2Io8ZPROSunbOLuMvuIFU4TqwWPmQTqal4WS09K1A,10449
85
- tinybird-0.0.1.dev226.dist-info/METADATA,sha256=SUGVILsWllsp3gp8DsH5S75zVZGQQk-1Mr22a5Ppqg0,1682
86
- tinybird-0.0.1.dev226.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
87
- tinybird-0.0.1.dev226.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
88
- tinybird-0.0.1.dev226.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
89
- tinybird-0.0.1.dev226.dist-info/RECORD,,
85
+ tinybird-0.0.1.dev228.dist-info/METADATA,sha256=-XnISmLBDTR6JLoON6Q6W3v4uFAflsOiBq2yHlQOfFI,1682
86
+ tinybird-0.0.1.dev228.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
87
+ tinybird-0.0.1.dev228.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
88
+ tinybird-0.0.1.dev228.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
89
+ tinybird-0.0.1.dev228.dist-info/RECORD,,