tinybird 0.0.1.dev142__py3-none-any.whl → 0.0.1.dev144__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.dev142'
8
- __revision__ = 'f5afbf8'
7
+ __version__ = '0.0.1.dev144'
8
+ __revision__ = 'aaeb0de'
@@ -0,0 +1,26 @@
1
+ from typing import Optional
2
+
3
+ import requests
4
+
5
+ from tinybird.feedback_manager import FeedbackManager
6
+ from tinybird.syncasync import sync_to_async
7
+ from tinybird.tb.modules.common import getenv_bool
8
+ from tinybird.tb.modules.exceptions import CLIException
9
+
10
+ PYPY_URL = "https://pypi.org/pypi/tinybird/json"
11
+ requests_get = sync_to_async(requests.get, thread_sensitive=False)
12
+
13
+
14
+ class CheckPypi:
15
+ async def get_latest_version(self) -> Optional[str]:
16
+ version: Optional[str] = None
17
+ try:
18
+ disable_ssl: bool = getenv_bool("TB_DISABLE_SSL_CHECKS", False)
19
+ response: requests.Response = await requests_get(PYPY_URL, verify=not disable_ssl)
20
+ if response.status_code != 200:
21
+ raise CLIException(FeedbackManager.error_exception(error=response.content.decode("utf-8")))
22
+ version = response.json()["info"]["version"]
23
+ except Exception as e:
24
+ raise CLIException(FeedbackManager.error_exception(error=str(e)))
25
+
26
+ return version
tinybird/tb/cli.py CHANGED
@@ -25,7 +25,6 @@ import tinybird.tb.modules.mock
25
25
  import tinybird.tb.modules.open
26
26
  import tinybird.tb.modules.pipe
27
27
  import tinybird.tb.modules.secret
28
- import tinybird.tb.modules.tag
29
28
  import tinybird.tb.modules.test
30
29
  import tinybird.tb.modules.token
31
30
  import tinybird.tb.modules.workspace
@@ -18,6 +18,7 @@ import humanfriendly
18
18
  from click import Context
19
19
 
20
20
  from tinybird.tb import __cli__
21
+ from tinybird.tb.check_pypi import CheckPypi
21
22
  from tinybird.tb.client import (
22
23
  AuthException,
23
24
  AuthNoTokenException,
@@ -97,8 +98,6 @@ async def cli(
97
98
  click.echo(FeedbackManager.warning_disabled_ssl_checks())
98
99
 
99
100
  if not environ.get("PYTEST", None) and version_warning and not token:
100
- from tinybird.check_pypi import CheckPypi
101
-
102
101
  latest_version = await CheckPypi().get_latest_version()
103
102
 
104
103
  if "x.y.z" in CURRENT_VERSION:
@@ -1,6 +1,93 @@
1
1
  import click
2
2
 
3
3
  from tinybird.tb.modules.cli import cli
4
+ from tinybird.tb.modules.feedback_manager import FeedbackManager
5
+
6
+
7
+ @cli.command(
8
+ name="branch",
9
+ context_settings=dict(
10
+ ignore_unknown_options=True,
11
+ ),
12
+ )
13
+ @click.argument("args", nargs=-1, type=click.UNPROCESSED)
14
+ def branch(args) -> None:
15
+ """
16
+ `tb branch` is deprecated. You should rely on your version control system to manage branches.
17
+ """
18
+ click.echo(FeedbackManager.warning(
19
+ message="This command is deprecated. You should rely on your version control system to manage branches."
20
+ ))
21
+ click.echo("You are using Tinybird Forward CLI.\nYou can find more information in the docs at https://www.tinybird.co/docs/forward")
22
+
23
+
24
+ @cli.command(
25
+ name="check",
26
+ context_settings=dict(
27
+ ignore_unknown_options=True,
28
+ ),
29
+ )
30
+ @click.argument("args", nargs=-1, type=click.UNPROCESSED)
31
+ def check(args) -> None:
32
+ """
33
+ `tb check` is deprecated.
34
+ """
35
+ click.echo(FeedbackManager.warning(
36
+ message="This command is deprecated."
37
+ ))
38
+ click.echo("You are using Tinybird Forward CLI.\nYou can find more information in the docs at https://www.tinybird.co/docs/forward")
39
+
40
+
41
+ @cli.command(
42
+ name="diff",
43
+ context_settings=dict(
44
+ ignore_unknown_options=True,
45
+ ),
46
+ )
47
+ @click.argument("args", nargs=-1, type=click.UNPROCESSED)
48
+ def diff(args) -> None:
49
+ """
50
+ `tb diff` is deprecated.
51
+ """
52
+ click.echo(FeedbackManager.warning(
53
+ message="This command is deprecated."
54
+ ))
55
+ click.echo("You are using Tinybird Forward CLI.\nYou can find more information in the docs at https://www.tinybird.co/docs/forward")
56
+
57
+
58
+ @cli.command(
59
+ name="fmt",
60
+ context_settings=dict(
61
+ ignore_unknown_options=True,
62
+ ),
63
+ )
64
+ @click.argument("args", nargs=-1, type=click.UNPROCESSED)
65
+ def fmt(args) -> None:
66
+ """
67
+ `tb fmt` is deprecated.
68
+ """
69
+ click.echo(FeedbackManager.warning(
70
+ message="This command is deprecated."
71
+ ))
72
+ click.echo("You are using Tinybird Forward CLI.\nYou can find more information in the docs at https://www.tinybird.co/docs/forward")
73
+
74
+
75
+ @cli.command(
76
+ name="init",
77
+ context_settings=dict(
78
+ ignore_unknown_options=True,
79
+ ),
80
+ )
81
+ @click.argument("args", nargs=-1, type=click.UNPROCESSED)
82
+ def init(args) -> None:
83
+ """
84
+ `tb init` is deprecated. Use `tb create` instead.
85
+ """
86
+ click.echo(FeedbackManager.warning(
87
+ message="This command is deprecated. Use `tb create` instead."
88
+ ))
89
+ click.echo("You are using Tinybird Forward CLI.\nYou can find more information in the docs at https://www.tinybird.co/docs/forward")
90
+
4
91
 
5
92
 
6
93
  @cli.command(
@@ -14,7 +101,27 @@ def push(args) -> None:
14
101
  """
15
102
  `tb push` is deprecated. Use `tb deploy` instead.
16
103
  """
17
- click.echo(
18
- "You are using Tinybird Forward CLI. This command is deprecated. Use `tb deploy` instead. "
19
- "You can find more information in the docs at https://www.tinybird.co/docs/forward"
20
- )
104
+ click.echo(FeedbackManager.warning(
105
+ message="This command is deprecated. Use `tb deploy` instead."
106
+ ))
107
+ click.echo("You are using Tinybird Forward CLI.\nYou can find more information in the docs at https://www.tinybird.co/docs/forward")
108
+
109
+
110
+
111
+ @cli.command(
112
+ name="tag",
113
+ context_settings=dict(
114
+ ignore_unknown_options=True,
115
+ ),
116
+ )
117
+ @click.argument("args", nargs=-1, type=click.UNPROCESSED)
118
+ def tag(args) -> None:
119
+ """
120
+ `tb tag` is deprecated
121
+ """
122
+ click.echo(FeedbackManager.warning(
123
+ message="This command is deprecated."
124
+ ))
125
+ click.echo("You are using Tinybird Forward CLI.\nYou can find more information in the docs at https://www.tinybird.co/docs/forward")
126
+
127
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev142
3
+ Version: 0.0.1.dev144
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/cli/introduction.html
6
6
  Author: Tinybird
@@ -12,14 +12,15 @@ 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=FiDNG4mtU95TLlzBQHhR-AONnTf_kHYcJ-aOS9NiGJY,252
16
- tinybird/tb/cli.py,sha256=6X7pMjscB1yDsnzBaZBnF4pCBJ7tZgCC500CtPEP-qQ,1106
15
+ tinybird/tb/__cli__.py,sha256=-PHfFRznzuBvEG3g6AbuDkouqGyBqBQDwhOZsXjDA3c,252
16
+ tinybird/tb/check_pypi.py,sha256=rW4QmDRbtgKdUUwJCnBkVjmTjZSZGN-XgZhx7vMkC0w,1009
17
+ tinybird/tb/cli.py,sha256=uPV6pvi4aYVfaiGs0DQO-eoi1g9dHlrgvhutkXkdJko,1075
17
18
  tinybird/tb/client.py,sha256=aaPKq5C77e72kR7IMv9WrvnvNki8mKMOTi9EsCp0eUc,55962
18
19
  tinybird/tb/config.py,sha256=HLMHbJg6BjeGZ2KiJA-BCCVnk8w959xsSaDEEePakZg,3981
19
20
  tinybird/tb/modules/auth.py,sha256=_OeYnmTH83lnqCgQEdS6K0bx1KBUeRmZk2M7JnRmWpk,9037
20
21
  tinybird/tb/modules/build.py,sha256=5SX59ssq0KaRrgzk21KmYUnB6xOdQ_O59n7rxFBQQ1Y,17393
21
22
  tinybird/tb/modules/cicd.py,sha256=Ug7LijuHDIqKR6rm8OLZispWp75Zv6TyonAme8K9jaI,7114
22
- tinybird/tb/modules/cli.py,sha256=AHtGb8UHpuJwD8CPP9MuMvMxrV-NXOb0nP2N9EvTq7c,14081
23
+ tinybird/tb/modules/cli.py,sha256=V8fC0GLt5HWtOTk6TOZM5xUAY9PoH05kyJxE6Zu4MT4,14075
23
24
  tinybird/tb/modules/common.py,sha256=jThkqkIJ_blXXUZ2-3HdjG1dpLKOCE_TjXA0jSesIx0,85712
24
25
  tinybird/tb/modules/config.py,sha256=ziqW_t_mRVvWOd85VoB4vKyvgMkEfpXDf9H4v38p2xc,11422
25
26
  tinybird/tb/modules/connection.py,sha256=7oOR7x4PhBcm1ETFFCH2YJ_3oeGXjAbmx1cnZX9_L70,9014
@@ -27,7 +28,7 @@ tinybird/tb/modules/copy.py,sha256=2Mm4FWKehOG7CoOhiF1m9UZJgJn0W1_cMolqju8ONYg,5
27
28
  tinybird/tb/modules/create.py,sha256=VMX8b5ukgQm0VDUbBX91TsIsxqQid2UXRwlKekQp3M4,16792
28
29
  tinybird/tb/modules/datasource.py,sha256=V314rkpdVxVMjsp5qcSCTqDlmp4Vu--qM07BoWh-aqs,17783
29
30
  tinybird/tb/modules/deployment.py,sha256=M3NPFQXIEsDh9-J-pzPLuHF9k4SIZVvgUnHp05KOf-E,20448
30
- tinybird/tb/modules/deprecations.py,sha256=gBbg7cvad85u_lKDURZTZjRdFMoM0UDolJ_6zR1BXtQ,526
31
+ tinybird/tb/modules/deprecations.py,sha256=vDf9RgCM8FoSGrFMJLMdNhfvmtMw5t30W-fsOJq3FzI,3607
31
32
  tinybird/tb/modules/endpoint.py,sha256=XySDt3pk66vxOZ0egUfz4bY8bEk3BjOXkv-L0OIJ3sc,12083
32
33
  tinybird/tb/modules/exceptions.py,sha256=5jK91w1LPmtqIUfDpHe_Op5OxGz8-p1BPgtLREMIni0,5217
33
34
  tinybird/tb/modules/feedback_manager.py,sha256=Ncenxx48-vWJjDLPuuIPOOT_1oaAVjuMLHIfbez7v0U,77652
@@ -48,7 +49,6 @@ tinybird/tb/modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGM
48
49
  tinybird/tb/modules/secret.py,sha256=WsqzxxLh9W_jkuHL2JofMXdIJy0lT5WEI-7bQSIDgAc,2921
49
50
  tinybird/tb/modules/shell.py,sha256=Zd_4Ak_5tKVX-cw6B4ag36xZeEGHeh-jZpAsIXkoMoE,14116
50
51
  tinybird/tb/modules/table.py,sha256=4XrtjM-N0zfNtxVkbvLDQQazno1EPXnxTyo7llivfXk,11035
51
- tinybird/tb/modules/tag.py,sha256=anPmMUBc-TbFovlpFi8GPkKA18y7Y0GczMsMms5TZsU,3502
52
52
  tinybird/tb/modules/telemetry.py,sha256=IHHks8-jnrkyQIY_Y6ZmU8hdVHMGSS0pkSUOgCPcYY8,11346
53
53
  tinybird/tb/modules/test.py,sha256=WmPoZBSHBORiM66xp54KxfY3s0YwjFMN_ZTT8xObFO4,12377
54
54
  tinybird/tb/modules/token.py,sha256=2fmKwu10_M0pqs6YmJVeILR9ZQB0ejRAET86agASbKM,13488
@@ -79,8 +79,8 @@ tinybird/tb_cli_modules/config.py,sha256=IsgdtFRnUrkY8-Zo32lmk6O7u3bHie1QCxLwgp4
79
79
  tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
80
80
  tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
81
81
  tinybird/tb_cli_modules/telemetry.py,sha256=Hh2Io8ZPROSunbOLuMvuIFU4TqwWPmQTqal4WS09K1A,10449
82
- tinybird-0.0.1.dev142.dist-info/METADATA,sha256=cLQ2idtXHX8zrnepIevHMdqAhr-OkgPdom1t_SGM050,1612
83
- tinybird-0.0.1.dev142.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
84
- tinybird-0.0.1.dev142.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
85
- tinybird-0.0.1.dev142.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
86
- tinybird-0.0.1.dev142.dist-info/RECORD,,
82
+ tinybird-0.0.1.dev144.dist-info/METADATA,sha256=h6PqqBI0uIalHK2gTkQ4Bd4vrVZkm18OOiaxiT8TFzM,1612
83
+ tinybird-0.0.1.dev144.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
84
+ tinybird-0.0.1.dev144.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
85
+ tinybird-0.0.1.dev144.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
86
+ tinybird-0.0.1.dev144.dist-info/RECORD,,
@@ -1,100 +0,0 @@
1
- from typing import Optional
2
-
3
- import click
4
- from click import Context
5
-
6
- from tinybird.tb.modules.cli import cli
7
- from tinybird.tb.modules.common import coro, echo_safe_humanfriendly_tables_format_smart_table
8
- from tinybird.tb.modules.feedback_manager import FeedbackManager
9
-
10
-
11
- @cli.group(hidden=True)
12
- @click.pass_context
13
- def tag(ctx: Context) -> None:
14
- """Tag commands"""
15
-
16
-
17
- @tag.command(name="ls")
18
- @click.argument("tag_name", required=False)
19
- @click.pass_context
20
- @coro
21
- async def tag_ls(ctx: Context, tag_name: Optional[str]) -> None:
22
- """List all the tags of the current Workspace or the resources associated to a specific tag."""
23
-
24
- client = ctx.ensure_object(dict)["client"]
25
- response = await client.get_all_tags()
26
-
27
- if tag_name:
28
- the_tag = [tag for tag in response["tags"] if tag["name"] == tag_name]
29
-
30
- columns = ["name", "id", "type"]
31
- table = []
32
-
33
- if len(the_tag) > 0:
34
- for resource in the_tag[0]["resources"]:
35
- table.append([resource["name"], resource["id"], resource["type"]])
36
-
37
- click.echo(FeedbackManager.info_tag_resources(tag_name=tag_name))
38
- echo_safe_humanfriendly_tables_format_smart_table(table, column_names=columns)
39
- return
40
-
41
- columns = ["tag", "resources"]
42
- table = []
43
-
44
- for tag in response["tags"]:
45
- unique_resources = []
46
- for resource in tag["resources"]:
47
- if resource.get("name", "") not in unique_resources:
48
- unique_resources.append(resource) # Reducing by name in case there are duplicates.
49
- table.append([tag["name"], len(unique_resources)])
50
-
51
- click.echo(FeedbackManager.info_tag_list())
52
- echo_safe_humanfriendly_tables_format_smart_table(table, column_names=columns)
53
-
54
-
55
- @tag.command(name="create")
56
- @click.argument("tag_name")
57
- @click.pass_context
58
- @coro
59
- async def tag_create(ctx: Context, tag_name: str) -> None:
60
- """Create a tag in the current Workspace."""
61
-
62
- client = ctx.ensure_object(dict)["client"]
63
- await client.create_tag(name=tag_name)
64
-
65
- click.echo(FeedbackManager.success_tag_created(tag_name=tag_name))
66
-
67
-
68
- @tag.command(name="rm")
69
- @click.argument("tag_name")
70
- @click.option("--yes", is_flag=True, default=False, help="Do not ask for confirmation to delete the tag.")
71
- @click.pass_context
72
- @coro
73
- async def tag_rm(ctx: Context, tag_name: str, yes: bool) -> None:
74
- """Remove a tag from the current Workspace."""
75
-
76
- client = ctx.ensure_object(dict)["client"]
77
- remove_tag = True
78
-
79
- if not yes:
80
- all_tags = await client.get_all_tags()
81
- the_tag = [tag for tag in all_tags["tags"] if tag["name"] == tag_name]
82
- if len(the_tag) > 0:
83
- unique_resources = []
84
- for resource in the_tag[0]["resources"]:
85
- if resource.get("name", "") not in unique_resources:
86
- unique_resources.append(resource) # Reducing by name in case there are duplicates.
87
-
88
- if len(unique_resources) > 0:
89
- remove_tag = click.confirm(
90
- FeedbackManager.warning_tag_remove(tag_name=tag_name, resources_len=len(unique_resources))
91
- )
92
- else:
93
- remove_tag = click.confirm(FeedbackManager.warning_tag_remove_no_resources(tag_name=tag_name))
94
- else:
95
- remove_tag = False
96
- click.echo(FeedbackManager.error_tag_not_found(tag_name=tag_name))
97
-
98
- if remove_tag:
99
- await client.delete_tag(tag_name)
100
- click.echo(FeedbackManager.success_tag_removed(tag_name=tag_name))