tinybird 0.0.1.dev141__py3-none-any.whl → 0.0.1.dev143__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.dev141'
8
- __revision__ = '2f7ef0f'
7
+ __version__ = '0.0.1.dev143'
8
+ __revision__ = '1424df6'
@@ -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
@@ -8,7 +8,7 @@ import logging
8
8
  import os
9
9
  import shutil
10
10
  import sys
11
- from os import getcwd
11
+ from os import environ, getcwd
12
12
  from pathlib import Path
13
13
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
14
14
 
@@ -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,
@@ -31,7 +32,7 @@ from tinybird.tb.modules.common import (
31
32
  getenv_bool,
32
33
  try_update_config_with_remote,
33
34
  )
34
- from tinybird.tb.modules.config import CLIConfig
35
+ from tinybird.tb.modules.config import CURRENT_VERSION, CLIConfig
35
36
  from tinybird.tb.modules.datafile.build import build_graph
36
37
  from tinybird.tb.modules.datafile.pull import folder_pull
37
38
  from tinybird.tb.modules.feedback_manager import FeedbackManager
@@ -61,6 +62,12 @@ VERSION = f"{__cli__.__version__} (rev {__cli__.__revision__})"
61
62
  @click.option("--token", help="Use auth token, defaults to TB_TOKEN envvar, then to the .tinyb file.")
62
63
  @click.option("--user-token", help="Use user token, defaults to TB_USER_TOKEN envvar, then to the .tinyb file.")
63
64
  @click.option("--host", help="Use custom host, defaults to TB_HOST envvar, then to https://api.tinybird.co")
65
+ @click.option(
66
+ "--version-warning/--no-version-warning",
67
+ envvar="TB_VERSION_WARNING",
68
+ default=True,
69
+ help="Don't print version warning message if there's a new available version. You can use TB_VERSION_WARNING envar",
70
+ )
64
71
  @click.option("--show-tokens", is_flag=True, default=False, help="Enable the output of tokens.")
65
72
  @click.option("--cloud/--local", is_flag=True, default=False, help="Run against cloud or local.")
66
73
  @click.option("--staging", is_flag=True, default=False, help="Run against a staging deployment.")
@@ -73,6 +80,7 @@ async def cli(
73
80
  token: str,
74
81
  user_token: str,
75
82
  host: str,
83
+ version_warning: bool,
76
84
  show_tokens: bool,
77
85
  cloud: bool,
78
86
  staging: bool,
@@ -89,6 +97,21 @@ async def cli(
89
97
  if getenv_bool("TB_DISABLE_SSL_CHECKS", False):
90
98
  click.echo(FeedbackManager.warning_disabled_ssl_checks())
91
99
 
100
+ if not environ.get("PYTEST", None) and version_warning and not token:
101
+ latest_version = await CheckPypi().get_latest_version()
102
+
103
+ if "x.y.z" in CURRENT_VERSION:
104
+ click.echo(FeedbackManager.warning_development_cli())
105
+
106
+ if "x.y.z" not in CURRENT_VERSION and latest_version != CURRENT_VERSION:
107
+ click.echo(
108
+ FeedbackManager.warning(message=f"** New version available. {CURRENT_VERSION} -> {latest_version}")
109
+ )
110
+ click.echo(
111
+ FeedbackManager.warning(
112
+ message="** Run `tb update` to update or `export TB_VERSION_WARNING=0` to skip the check.\n"
113
+ )
114
+ )
92
115
  if debug:
93
116
  logging.basicConfig(level=logging.DEBUG)
94
117
 
@@ -726,9 +726,9 @@ STEP 3: ADD KEY TO SERVICE ACCOUNT
726
726
  )
727
727
  warning_fixture_not_found = warning_message("** Warning: No fixture found for the datasource {datasource_name}")
728
728
  warning_update_version = warning_message(
729
- '** UPDATE AVAILABLE: please run "pip install tinybird=={latest_version}" to update or `export TB_VERSION_WARNING=0` to skip the check.'
729
+ "** VERSION {latest_version} AVAILABLE: please run `tb update` to update or `export TB_VERSION_WARNING=0` to skip the check."
730
730
  )
731
- warning_current_version = warning_message("** current: tinybird {current_version}\n")
731
+ warning_current_version = warning_message("** Current version: {current_version}\n")
732
732
  warning_confirm_truncate_datasource = prompt_message(
733
733
  "Do you want to truncate {datasource}? Once truncated, your data can't be recovered"
734
734
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev141
3
+ Version: 0.0.1.dev143
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=HatbYmPEFnba3j4qc8NOBm4CILHsE8TZVBx4rD__eLc,252
15
+ tinybird/tb/__cli__.py,sha256=9EeTlKgqbi_u5xvGReU9kR6x0ytXafOiTEjw0iYH0MU,252
16
+ tinybird/tb/check_pypi.py,sha256=rW4QmDRbtgKdUUwJCnBkVjmTjZSZGN-XgZhx7vMkC0w,1009
16
17
  tinybird/tb/cli.py,sha256=6X7pMjscB1yDsnzBaZBnF4pCBJ7tZgCC500CtPEP-qQ,1106
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=qz12sIfTYbFVIADJGyb1HXrHP4S7KudVSv7YKP0pPzw,13052
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
@@ -30,7 +31,7 @@ tinybird/tb/modules/deployment.py,sha256=M3NPFQXIEsDh9-J-pzPLuHF9k4SIZVvgUnHp05K
30
31
  tinybird/tb/modules/deprecations.py,sha256=gBbg7cvad85u_lKDURZTZjRdFMoM0UDolJ_6zR1BXtQ,526
31
32
  tinybird/tb/modules/endpoint.py,sha256=XySDt3pk66vxOZ0egUfz4bY8bEk3BjOXkv-L0OIJ3sc,12083
32
33
  tinybird/tb/modules/exceptions.py,sha256=5jK91w1LPmtqIUfDpHe_Op5OxGz8-p1BPgtLREMIni0,5217
33
- tinybird/tb/modules/feedback_manager.py,sha256=YrKz1qHLmCKYVNvW2SDobmI6ozMjf2eZL-AnFowSfm8,77664
34
+ tinybird/tb/modules/feedback_manager.py,sha256=Ncenxx48-vWJjDLPuuIPOOT_1oaAVjuMLHIfbez7v0U,77652
34
35
  tinybird/tb/modules/infra.py,sha256=fve30Gj3mG9zbquGxS2e4ipcOYOxviWQCpNFfEzJN_Q,33195
35
36
  tinybird/tb/modules/job.py,sha256=n4dSSBgnA8NqD7srGahf2xRj6wxkmX9Vl0J-QJ_a2w0,2966
36
37
  tinybird/tb/modules/llm.py,sha256=KfsCYmKeW1VQz0iDZhGKCRkQv_Y3kTHh6JuxvofOguE,1076
@@ -79,8 +80,8 @@ tinybird/tb_cli_modules/config.py,sha256=IsgdtFRnUrkY8-Zo32lmk6O7u3bHie1QCxLwgp4
79
80
  tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
80
81
  tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
81
82
  tinybird/tb_cli_modules/telemetry.py,sha256=Hh2Io8ZPROSunbOLuMvuIFU4TqwWPmQTqal4WS09K1A,10449
82
- tinybird-0.0.1.dev141.dist-info/METADATA,sha256=fKlvi9USAvvAJMIZlfVRRWGxJrAXIPtR3Bv0hSWEivU,1612
83
- tinybird-0.0.1.dev141.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
84
- tinybird-0.0.1.dev141.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
85
- tinybird-0.0.1.dev141.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
86
- tinybird-0.0.1.dev141.dist-info/RECORD,,
83
+ tinybird-0.0.1.dev143.dist-info/METADATA,sha256=hS0Itd2jL-PCljQBtYEQgFFD0a0PvZlSvrQzjJdghpE,1612
84
+ tinybird-0.0.1.dev143.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
85
+ tinybird-0.0.1.dev143.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
86
+ tinybird-0.0.1.dev143.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
87
+ tinybird-0.0.1.dev143.dist-info/RECORD,,