tinybird 0.0.1.dev225__py3-none-any.whl → 0.0.1.dev226__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/prompts.py +87 -0
- tinybird/tb/__cli__.py +2 -2
- tinybird/tb/modules/create.py +29 -3
- tinybird/tb/modules/feedback_manager.py +1 -0
- {tinybird-0.0.1.dev225.dist-info → tinybird-0.0.1.dev226.dist-info}/METADATA +1 -1
- {tinybird-0.0.1.dev225.dist-info → tinybird-0.0.1.dev226.dist-info}/RECORD +9 -9
- {tinybird-0.0.1.dev225.dist-info → tinybird-0.0.1.dev226.dist-info}/WHEEL +0 -0
- {tinybird-0.0.1.dev225.dist-info → tinybird-0.0.1.dev226.dist-info}/entry_points.txt +0 -0
- {tinybird-0.0.1.dev225.dist-info → tinybird-0.0.1.dev226.dist-info}/top_level.txt +0 -0
tinybird/prompts.py
CHANGED
|
@@ -974,6 +974,93 @@ Follow these instructions when evolving a datasource schema:
|
|
|
974
974
|
)
|
|
975
975
|
|
|
976
976
|
|
|
977
|
+
def claude_rules_prompt(source: Optional[str] = None) -> str:
|
|
978
|
+
base_command = source or "tb"
|
|
979
|
+
return """
|
|
980
|
+
# Tinybird CLI rules
|
|
981
|
+
|
|
982
|
+
## Commands
|
|
983
|
+
You have commands at your disposal to develop a tinybird project:
|
|
984
|
+
- {base_command} build: to build the project locally and check it works.
|
|
985
|
+
- {base_command} deployment create --wait --auto: to create a deployment and promote it automatically
|
|
986
|
+
- {base_command} test run: to run existing tests
|
|
987
|
+
- {base_command} endpoint url <pipe_name>: to get the url of an endpoint, token included.
|
|
988
|
+
- {base_command} endpoint data <pipe_name>: to get the data of an endpoint. You can pass parameters to the endpoint like this: {base_command} endpoint data <pipe_name> --param1 value1 --param2 value2
|
|
989
|
+
- {base_command} token ls: to list all the tokens
|
|
990
|
+
There are other commands that you can use, but these are the most common ones. Run `{base_command} -h` to see all the commands if needed.
|
|
991
|
+
When you need to work with resources or data in cloud, add always the --cloud flag before the command. Example: {base_command} --cloud datasource ls
|
|
992
|
+
|
|
993
|
+
## Development instructions
|
|
994
|
+
- When asking to create a tinybird data project, if the needed folders are not already created, use the following structure:
|
|
995
|
+
├── connections
|
|
996
|
+
├── copies
|
|
997
|
+
├── sinks
|
|
998
|
+
├── datasources
|
|
999
|
+
├── endpoints
|
|
1000
|
+
├── fixtures
|
|
1001
|
+
├── materializations
|
|
1002
|
+
├── pipes
|
|
1003
|
+
└── tests
|
|
1004
|
+
- The local development server will be available at http://localhost:7181. Even if some response uses another base url, use always http://localhost:7181.
|
|
1005
|
+
- After every change in your .datasource, .pipe or .ndjson files, run `{base_command} build` to build the project locally.
|
|
1006
|
+
- When you need to ingest data locally in a datasource, create a .ndjson file with the same name of the datasource and the data you want and run `{base_command} build` so the data is ingested.
|
|
1007
|
+
- The format of the generated api endpoint urls is: http://localhost:7181/v0/pipe/<pipe_name>.json?token=<token>
|
|
1008
|
+
- Before running the tests, remember to have the project built with `{base_command} build` with the latest changes.
|
|
1009
|
+
</development_instructions>
|
|
1010
|
+
When asking for ingesting data, adding data or appending data do the following depending on the environment you want to work with:
|
|
1011
|
+
|
|
1012
|
+
## Ingestion instructions
|
|
1013
|
+
- When building locally, create a .ndjson file with the data you want to ingest and do `{base_command} build` to ingest the data in the build env.
|
|
1014
|
+
- We call `cloud` the production environment.
|
|
1015
|
+
- When appending data in cloud, use `{base_command} --cloud datasource append <datasource_name> <file_name>`
|
|
1016
|
+
- When you have a response that says “there are rows in quarantine”, do `{base_command} [--cloud] datasource data <datasource_name>_quarantine` to understand what is the problem.
|
|
1017
|
+
|
|
1018
|
+
## .datasource file instructions
|
|
1019
|
+
Follow these instructions when creating or updating .datasource files:
|
|
1020
|
+
{datasource_instructions}
|
|
1021
|
+
|
|
1022
|
+
## .pipe file instructions
|
|
1023
|
+
Follow these instructions when creating or updating .pipe files:
|
|
1024
|
+
{pipe_instructions}
|
|
1025
|
+
{sql_instructions}
|
|
1026
|
+
{datasource_example}
|
|
1027
|
+
{pipe_example}
|
|
1028
|
+
{copy_pipe_instructions}
|
|
1029
|
+
{materialized_pipe_instructions}
|
|
1030
|
+
{sink_pipe_instructions}
|
|
1031
|
+
{connection_instructions}
|
|
1032
|
+
{kafka_connection_example}
|
|
1033
|
+
{gcs_connection_example}
|
|
1034
|
+
{gcs_hmac_connection_example}
|
|
1035
|
+
{s3_connection_example}
|
|
1036
|
+
|
|
1037
|
+
## .test file instructions
|
|
1038
|
+
Follow these instructions when creating or updating .yaml files for tests:
|
|
1039
|
+
{test_instructions}
|
|
1040
|
+
|
|
1041
|
+
## Deployment instructions
|
|
1042
|
+
Follow these instructions when evolving a datasource schema:
|
|
1043
|
+
{deployment_instructions}
|
|
1044
|
+
""".format(
|
|
1045
|
+
base_command=base_command,
|
|
1046
|
+
datasource_instructions=datasource_instructions,
|
|
1047
|
+
pipe_instructions=pipe_instructions,
|
|
1048
|
+
sql_instructions=sql_instructions,
|
|
1049
|
+
datasource_example=datasource_example,
|
|
1050
|
+
pipe_example=pipe_example,
|
|
1051
|
+
copy_pipe_instructions=copy_pipe_instructions,
|
|
1052
|
+
materialized_pipe_instructions=materialized_pipe_instructions,
|
|
1053
|
+
sink_pipe_instructions=sink_pipe_instructions,
|
|
1054
|
+
test_instructions=test_instructions,
|
|
1055
|
+
deployment_instructions=deployment_instructions,
|
|
1056
|
+
connection_instructions=connection_instructions,
|
|
1057
|
+
kafka_connection_example=kafka_connection_example,
|
|
1058
|
+
gcs_connection_example=gcs_connection_example,
|
|
1059
|
+
gcs_hmac_connection_example=gcs_hmac_connection_example,
|
|
1060
|
+
s3_connection_example=s3_connection_example,
|
|
1061
|
+
)
|
|
1062
|
+
|
|
1063
|
+
|
|
977
1064
|
test_instructions = """
|
|
978
1065
|
- The test file name must match the name of the pipe it is testing.
|
|
979
1066
|
- Every scenario name must be unique inside the test file.
|
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.
|
|
8
|
-
__revision__ = '
|
|
7
|
+
__version__ = '0.0.1.dev226'
|
|
8
|
+
__revision__ = '7ee5a2e'
|
tinybird/tb/modules/create.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import glob
|
|
2
2
|
import os
|
|
3
3
|
import re
|
|
4
|
+
import shutil
|
|
4
5
|
from pathlib import Path
|
|
5
6
|
from typing import Any, Dict, List, Optional
|
|
6
7
|
from urllib.parse import urlparse
|
|
@@ -8,7 +9,7 @@ from urllib.parse import urlparse
|
|
|
8
9
|
import click
|
|
9
10
|
import requests
|
|
10
11
|
|
|
11
|
-
from tinybird.prompts import create_prompt, readme_prompt, rules_prompt
|
|
12
|
+
from tinybird.prompts import claude_rules_prompt, create_prompt, readme_prompt, rules_prompt
|
|
12
13
|
from tinybird.tb.client import TinyB
|
|
13
14
|
from tinybird.tb.modules.cicd import init_cicd
|
|
14
15
|
from tinybird.tb.modules.cli import cli
|
|
@@ -144,6 +145,13 @@ async def create(
|
|
|
144
145
|
click.echo(FeedbackManager.success(message="✓ Done!\n"))
|
|
145
146
|
created_something = True
|
|
146
147
|
|
|
148
|
+
if not already_has_claude_rules(root_folder):
|
|
149
|
+
click.echo(FeedbackManager.highlight(message="\n» Creating Claude Code rules..."))
|
|
150
|
+
create_claude_rules(root_folder, "tb")
|
|
151
|
+
click.echo(FeedbackManager.info(message="CLAUDE.md"))
|
|
152
|
+
click.echo(FeedbackManager.success(message="✓ Done!\n"))
|
|
153
|
+
created_something = True
|
|
154
|
+
|
|
147
155
|
if should_generate_fixtures(result):
|
|
148
156
|
click.echo(FeedbackManager.highlight(message="\n» Generating fixtures..."))
|
|
149
157
|
|
|
@@ -246,6 +254,11 @@ def already_has_cursor_rules(folder: str) -> bool:
|
|
|
246
254
|
return any((Path(folder) / path).exists() for path in cursor_rules_paths)
|
|
247
255
|
|
|
248
256
|
|
|
257
|
+
def already_has_claude_rules(folder: str) -> bool:
|
|
258
|
+
claude_rules_path = "CLAUDE.md"
|
|
259
|
+
return (Path(folder) / claude_rules_path).exists()
|
|
260
|
+
|
|
261
|
+
|
|
249
262
|
def already_has_env_file(folder: str) -> bool:
|
|
250
263
|
env_file_pattern = ".env.*"
|
|
251
264
|
return any((Path(folder) / path).exists() for path in glob.glob(env_file_pattern))
|
|
@@ -466,9 +479,22 @@ def create_rules(folder: str, source: str, agent: str):
|
|
|
466
479
|
elif agent == "windsurf":
|
|
467
480
|
extension = ".windsurfrules"
|
|
468
481
|
else:
|
|
469
|
-
extension = ".
|
|
482
|
+
extension = ".md"
|
|
483
|
+
|
|
470
484
|
rules_file = Path(folder) / extension
|
|
471
|
-
|
|
485
|
+
rules_content = rules_prompt(source)
|
|
486
|
+
rules_file.write_text(rules_content)
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
def create_claude_rules(folder: str, source: str):
|
|
490
|
+
try:
|
|
491
|
+
is_claude_code_installed = shutil.which("claude") is not None
|
|
492
|
+
if is_claude_code_installed:
|
|
493
|
+
rules_content = claude_rules_prompt(source)
|
|
494
|
+
claude_file = Path(folder) / "CLAUDE.md"
|
|
495
|
+
claude_file.write_text(rules_content)
|
|
496
|
+
except Exception:
|
|
497
|
+
pass
|
|
472
498
|
|
|
473
499
|
|
|
474
500
|
def get_context_file() -> Path:
|
|
@@ -636,6 +636,7 @@ STEP 2: CREATE GCP SERVICE ACCOUNT
|
|
|
636
636
|
- For GCS Sink (writing to GCS), select all three roles:
|
|
637
637
|
• "Storage Object Creator" - Allows users to create objects
|
|
638
638
|
• "Storage Object Viewer" - Grants access to view objects and their metadata
|
|
639
|
+
• "Storage Bucket Viewer" - Grants access to view buckets and their metadata
|
|
639
640
|
(You can add IAM condition to provide access to selected buckets. More info in IAM Conditions: https://cloud.google.com/iam/docs/conditions-overview)
|
|
640
641
|
5. Click "Done"
|
|
641
642
|
"""
|
|
@@ -3,7 +3,7 @@ tinybird/context.py,sha256=FfqYfrGX_I7PKGTQo93utaKPDNVYWelg4Hsp3evX5wM,1291
|
|
|
3
3
|
tinybird/datatypes.py,sha256=r4WCvspmrXTJHiPjjyOTiZyZl31FO3Ynkwq4LQsYm6E,11059
|
|
4
4
|
tinybird/feedback_manager.py,sha256=1INQFfRfuMCb9lfB8KNf4r6qC2khW568hoHjtk-wshI,69305
|
|
5
5
|
tinybird/git_settings.py,sha256=Sw_8rGmribEFJ4Z_6idrVytxpFYk7ez8ei0qHULzs3E,3934
|
|
6
|
-
tinybird/prompts.py,sha256=
|
|
6
|
+
tinybird/prompts.py,sha256=BRCHfFKsVU9XBckQHIkluG5TCtgKo-MYMs3fFuR7zmQ,45322
|
|
7
7
|
tinybird/sql.py,sha256=BufnOgclQokDyihtuXesOwHBsebN6wRXIxO5wKRkOwE,48299
|
|
8
8
|
tinybird/sql_template.py,sha256=WjsTBjpQLVBHGZbY2dZuhZUurFR-rbJ_KRRy5vx4Y5E,99967
|
|
9
9
|
tinybird/sql_template_fmt.py,sha256=KUHdj5rYCYm_rKKdXYSJAE9vIyXUQLB0YSZnUXHeBlY,10196
|
|
@@ -17,7 +17,7 @@ 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=
|
|
20
|
+
tinybird/tb/__cli__.py,sha256=ZdJ5gN229WGVrUEQ1-5I8F7Lpre7HyytuDDzNgK6aCw,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
|
|
@@ -29,14 +29,14 @@ tinybird/tb/modules/common.py,sha256=F6oaoFZ3aBxEMjiDKYhthsEIUqSFPkcdlMJ7h7A49Ac
|
|
|
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=
|
|
32
|
+
tinybird/tb/modules/create.py,sha256=8kDyO_zDKPWKilmY9QVJXfJLFRjGO3I2sCD6Dt3Flxs,23214
|
|
33
33
|
tinybird/tb/modules/datasource.py,sha256=4a50A_qwB-3FUEUeB3ps6tUCJvn02rMUUwW-vHaMjTw,40846
|
|
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=
|
|
39
|
+
tinybird/tb/modules/feedback_manager.py,sha256=SMaoDjz-JGfh6hUxRiaGf2JOYZa_afDL8QFITA_M1mQ,77963
|
|
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
|
|
@@ -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.
|
|
86
|
-
tinybird-0.0.1.
|
|
87
|
-
tinybird-0.0.1.
|
|
88
|
-
tinybird-0.0.1.
|
|
89
|
-
tinybird-0.0.1.
|
|
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,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|