tinybird 0.0.1.dev172__py3-none-any.whl → 0.0.1.dev174__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.dev172'
8
- __revision__ = '418a96d'
7
+ __version__ = '0.0.1.dev174'
8
+ __revision__ = '39f0b89'
@@ -74,6 +74,7 @@ VERSION = f"{__cli__.__version__} (rev {__cli__.__revision__})"
74
74
  @click.option(
75
75
  "--output", type=click.Choice(["json", "human"], case_sensitive=False), default="human", help="Output format"
76
76
  )
77
+ @click.option("--max-depth", type=int, default=3, help="Maximum depth of the project files.")
77
78
  @click.version_option(version=VERSION)
78
79
  @click.pass_context
79
80
  @coro
@@ -88,6 +89,7 @@ async def cli(
88
89
  cloud: bool,
89
90
  staging: bool,
90
91
  output: str,
92
+ max_depth: int,
91
93
  ) -> None:
92
94
  """
93
95
  Use `OBFUSCATE_REGEX_PATTERN` and `OBFUSCATE_PATTERN_SEPARATOR` environment variables to define a regex pattern and a separator (in case of a single string with multiple regex) to obfuscate secrets in the CLI output.
@@ -148,7 +150,7 @@ async def cli(
148
150
  config = await get_config(host, token, user_token=user_token, config_file=config_temp._path)
149
151
  client = _get_tb_client(config.get("token", None), config["host"])
150
152
  folder = os.path.join(config_temp._path.replace(".tinyb", ""), config.get("cwd", os.getcwd()))
151
- project = Project(folder=folder, workspace_name=config.get("name", ""))
153
+ project = Project(folder=folder, workspace_name=config.get("name", ""), max_depth=max_depth)
152
154
  config["path"] = str(project.path)
153
155
  # If they have passed a token or host as parameter and it's different that record in .tinyb, refresh the workspace id
154
156
  if token or host:
@@ -555,6 +555,5 @@ def drop_token(url: str) -> str:
555
555
  parsed = urlparse(url)
556
556
  qs = parse_qs(parsed.query)
557
557
  qs_simplify = {k: v[0] for k, v in qs.items()} # change several arguments to single one
558
- if "token" in qs_simplify:
559
- del qs_simplify["token"]
558
+ qs_simplify.pop("token", None)
560
559
  return f"{parsed.scheme}://{parsed.netloc}{parsed.path}?{urlencode(qs_simplify)}"
@@ -11,9 +11,10 @@ from tinybird.tb.modules.datafile.parse_pipe import parse_pipe
11
11
  class Project:
12
12
  extensions = ("datasource", "pipe", "connection")
13
13
 
14
- def __init__(self, folder: str, workspace_name: str):
14
+ def __init__(self, folder: str, workspace_name: str, max_depth: int = 2):
15
15
  self.folder = folder
16
16
  self.workspace_name = workspace_name
17
+ self.max_depth = max_depth
17
18
 
18
19
  @property
19
20
  def path(self) -> Path:
@@ -23,10 +24,16 @@ class Project:
23
24
  def vendor_path(self) -> str:
24
25
  return f"{self.path}/vendor"
25
26
 
27
+ def get_files(self, extension: str) -> List[str]:
28
+ project_files: List[str] = []
29
+ for level in range(self.max_depth):
30
+ project_files.extend(glob.glob(f"{self.path}{'/*' * level}/*.{extension}", recursive=True))
31
+ return project_files
32
+
26
33
  def get_project_files(self) -> List[str]:
27
34
  project_files: List[str] = []
28
35
  for extension in self.extensions:
29
- for project_file in glob.glob(f"{self.path}/**/*.{extension}", recursive=True):
36
+ for project_file in self.get_files(extension):
30
37
  if self.vendor_path in project_file:
31
38
  continue
32
39
  project_files.append(project_file)
@@ -51,13 +58,13 @@ class Project:
51
58
  return sorted([Path(f).stem for f in self.get_connection_files()])
52
59
 
53
60
  def get_datasource_files(self) -> List[str]:
54
- return glob.glob(f"{self.path}/**/*.datasource", recursive=True)
61
+ return self.get_files("datasource")
55
62
 
56
63
  def get_pipe_files(self) -> List[str]:
57
- return glob.glob(f"{self.path}/**/*.pipe", recursive=True)
64
+ return self.get_files("pipe")
58
65
 
59
66
  def get_connection_files(self) -> List[str]:
60
- return glob.glob(f"{self.path}/**/*.connection", recursive=True)
67
+ return self.get_files("connection")
61
68
 
62
69
  def get_pipe_datafile(self, filename: str) -> Optional[Datafile]:
63
70
  try:
@@ -125,8 +125,7 @@ def test_create(ctx: click.Context, name_or_filename: str, prompt: str) -> None:
125
125
  test["expected_http_status"] = response.status_code
126
126
  test["expected_result"] = response.json()["error"]
127
127
  else:
128
- if "expected_http_status" in test:
129
- del test["expected_http_status"]
128
+ test.pop("expected_http_status", None)
130
129
  test["expected_result"] = response.text or ""
131
130
 
132
131
  tests.append(test)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev172
3
+ Version: 0.0.1.dev174
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/forward/commands
6
6
  Author: Tinybird
@@ -12,14 +12,14 @@ 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=KsLyZAzU6SHnlZIzZ3NaPcvV_l0uNff_p7roROhkP0c,247
15
+ tinybird/tb/__cli__.py,sha256=qwBoknIQp-vIaHCpdb58D9NUc-GpfFDJ91MCeKskmaI,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=CSBl_JRuioPyY0H8Ac96dJ9wQXDXfrvK2lwqlOxKGoY,55715
19
19
  tinybird/tb/config.py,sha256=jT9xndpeCY_g0HdB5qE2EquC0TFRRnkPnQFWZWd04jo,3998
20
20
  tinybird/tb/modules/build.py,sha256=zakH5812Lop-XHjGmDRdOPeofPtoeyb_2un_T6e50xw,19177
21
21
  tinybird/tb/modules/cicd.py,sha256=MnShTTJzKBYeajswF2jg7p7ZzupaeCgSriAN05MeEdg,7330
22
- tinybird/tb/modules/cli.py,sha256=3gDO1smcH1e2qEvbFCGbo4oNdgubDr3hC3fsKlB4ylY,15373
22
+ tinybird/tb/modules/cli.py,sha256=dXZs-MuqYPvxStVj7aLg36LwXtEB8NzTobDmHV9nzZI,15508
23
23
  tinybird/tb/modules/common.py,sha256=lu1Z3VYImwocaHvqOW2FzBJP6F3Ev7RuXsItkCZ6jpo,83237
24
24
  tinybird/tb/modules/config.py,sha256=ziqW_t_mRVvWOd85VoB4vKyvgMkEfpXDf9H4v38p2xc,11422
25
25
  tinybird/tb/modules/connection.py,sha256=7oOR7x4PhBcm1ETFFCH2YJ_3oeGXjAbmx1cnZX9_L70,9014
@@ -45,13 +45,13 @@ tinybird/tb/modules/materialization.py,sha256=QJX5kCPhhm6IXBO1JsalVfbQdypCe_eOUD
45
45
  tinybird/tb/modules/mock.py,sha256=IyHweMUM6bUH8IhyiX2tTMpdVpTFUeAJ41lZ5P42-HQ,5303
46
46
  tinybird/tb/modules/open.py,sha256=OuctINN77oexpSjth9uoIZPCelKO4Li-yyVxeSnk1io,1371
47
47
  tinybird/tb/modules/pipe.py,sha256=AQKEDagO6e3psPVjJkS_MDbn8aK-apAiLp26k7jgAV0,2432
48
- tinybird/tb/modules/project.py,sha256=yENgJAqRx_eH_n7qalPMWWMZpjEWhAf0CMfGM6ChQrM,3220
48
+ tinybird/tb/modules/project.py,sha256=_UWO79zhh2H0UA9F0wpKXYaylFPdjhGNmNAjIOSBvT8,3425
49
49
  tinybird/tb/modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
50
50
  tinybird/tb/modules/secret.py,sha256=WsqzxxLh9W_jkuHL2JofMXdIJy0lT5WEI-7bQSIDgAc,2921
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
- tinybird/tb/modules/test.py,sha256=891Br7sgRk88Zqqj4UQHWbdIK7aI7QY2wpAaBscPxRw,13134
54
+ tinybird/tb/modules/test.py,sha256=QxyDkHGL9Ae46h7BA00z1Efb2_5dBYGqW8cgKIJer5s,13081
55
55
  tinybird/tb/modules/token.py,sha256=2fmKwu10_M0pqs6YmJVeILR9ZQB0ejRAET86agASbKM,13488
56
56
  tinybird/tb/modules/watch.py,sha256=H1FieLTVGRqmZ0hR0vELbQJ9l0CThrFCgGCta-MPuAY,8883
57
57
  tinybird/tb/modules/workspace.py,sha256=-XUvL2PB5GcviJ8m30h-ZDc5kwJcm1wy1dreYa2l4Ck,10658
@@ -69,7 +69,7 @@ tinybird/tb/modules/datafile/format_datasource.py,sha256=iWbeXruxC7OBmjNgurWt6ym
69
69
  tinybird/tb/modules/datafile/format_pipe.py,sha256=DUGdmlzI146YDqTwW-7kSIOXocz4AH-md_LFGUm9hrc,7436
70
70
  tinybird/tb/modules/datafile/parse_datasource.py,sha256=p-qSdmDF7xbXt4PrQQc8q8aFa93kVbLpU4hIi6d3QH4,1764
71
71
  tinybird/tb/modules/datafile/parse_pipe.py,sha256=WuQlYW51tflbcp2iFapJ7bxa9IkegD6Z20f4nXL78Xw,3529
72
- tinybird/tb/modules/datafile/pipe_checker.py,sha256=LnDLGIHLJ3N7qHb2ptEbPr8CoczNfGwpjOY8EMdxfHQ,24649
72
+ tinybird/tb/modules/datafile/pipe_checker.py,sha256=xv7vyjN5dPc2hcw9RnLBq2VkR4nte-8bhYDT10qceQY,24620
73
73
  tinybird/tb/modules/datafile/playground.py,sha256=94tOydeg5iQ3TQAdEWQWxLhx5Emz6xh0bEwLSao44-Y,56568
74
74
  tinybird/tb/modules/datafile/pull.py,sha256=l6bIglY8b-tTIWgEYezf4kXjS0QHAVz4iOWLuNwe7Ps,5970
75
75
  tinybird/tb/modules/tinyunit/tinyunit.py,sha256=tVynlV16gt1ex0fDmCPmcABQYyzjVnnycHq1Ou3kU0c,11718
@@ -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.dev172.dist-info/METADATA,sha256=9aQWivLU7rd3lXCxFMfmwjDLDYBIlQtD1caqljQeVp8,1607
84
- tinybird-0.0.1.dev172.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
85
- tinybird-0.0.1.dev172.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
86
- tinybird-0.0.1.dev172.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
87
- tinybird-0.0.1.dev172.dist-info/RECORD,,
83
+ tinybird-0.0.1.dev174.dist-info/METADATA,sha256=ByV0Ug-OYQaawT9rhCxOq05EaNrW5dKguHZLqws1rw0,1607
84
+ tinybird-0.0.1.dev174.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
85
+ tinybird-0.0.1.dev174.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
86
+ tinybird-0.0.1.dev174.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
87
+ tinybird-0.0.1.dev174.dist-info/RECORD,,