tinybird 0.0.1.dev93__py3-none-any.whl → 0.0.1.dev94__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 +2 -2
- tinybird/tb/cli.py +1 -0
- tinybird/tb/modules/cli.py +2 -2
- tinybird/tb/modules/common.py +24 -0
- tinybird/tb/modules/local_common.py +7 -2
- tinybird/tb/modules/open.py +42 -0
- {tinybird-0.0.1.dev93.dist-info → tinybird-0.0.1.dev94.dist-info}/METADATA +1 -1
- {tinybird-0.0.1.dev93.dist-info → tinybird-0.0.1.dev94.dist-info}/RECORD +11 -10
- {tinybird-0.0.1.dev93.dist-info → tinybird-0.0.1.dev94.dist-info}/WHEEL +0 -0
- {tinybird-0.0.1.dev93.dist-info → tinybird-0.0.1.dev94.dist-info}/entry_points.txt +0 -0
- {tinybird-0.0.1.dev93.dist-info → tinybird-0.0.1.dev94.dist-info}/top_level.txt +0 -0
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.
|
|
8
|
-
__revision__ = '
|
|
7
|
+
__version__ = '0.0.1.dev94'
|
|
8
|
+
__revision__ = '97387e2'
|
tinybird/tb/cli.py
CHANGED
|
@@ -21,6 +21,7 @@ import tinybird.tb.modules.login
|
|
|
21
21
|
import tinybird.tb.modules.logout
|
|
22
22
|
import tinybird.tb.modules.materialization
|
|
23
23
|
import tinybird.tb.modules.mock
|
|
24
|
+
import tinybird.tb.modules.open
|
|
24
25
|
import tinybird.tb.modules.pipe
|
|
25
26
|
import tinybird.tb.modules.playground
|
|
26
27
|
import tinybird.tb.modules.secret
|
tinybird/tb/modules/cli.py
CHANGED
|
@@ -110,7 +110,7 @@ async def cli(
|
|
|
110
110
|
folder = os.path.join(config_temp._path.replace(".tinyb", ""), config.get("cwd", os.getcwd()))
|
|
111
111
|
project = Project(folder=folder)
|
|
112
112
|
config["path"] = str(project.path)
|
|
113
|
-
# If they have passed a token or host as
|
|
113
|
+
# If they have passed a token or host as parameter and it's different that record in .tinyb, refresh the workspace id
|
|
114
114
|
if token or host:
|
|
115
115
|
try:
|
|
116
116
|
workspace = await client.workspace_info()
|
|
@@ -393,7 +393,7 @@ def __unpatch_click_output():
|
|
|
393
393
|
|
|
394
394
|
|
|
395
395
|
async def create_ctx_client(ctx: Context, config: Dict[str, Any], cloud: bool, build: bool, staging: bool):
|
|
396
|
-
commands_without_ctx_client = ["auth", "check", "
|
|
396
|
+
commands_without_ctx_client = ["auth", "check", "local", "login", "logout", "update", "upgrade"]
|
|
397
397
|
command = ctx.invoked_subcommand
|
|
398
398
|
if command in commands_without_ctx_client:
|
|
399
399
|
return None
|
tinybird/tb/modules/common.py
CHANGED
|
@@ -2138,3 +2138,27 @@ async def get_user_token(config: CLIConfig, user_token: Optional[str] = None) ->
|
|
|
2138
2138
|
await check_user_token_with_client(client, user_token)
|
|
2139
2139
|
|
|
2140
2140
|
return user_token
|
|
2141
|
+
|
|
2142
|
+
|
|
2143
|
+
def get_ui_url(api_host: str) -> str:
|
|
2144
|
+
"""Transforms API URLs into their corresponding UI URLs.
|
|
2145
|
+
Examples:
|
|
2146
|
+
>>> get_ui_url("http://localhost:8000")
|
|
2147
|
+
'https://cloud.tinybird.co/local/8000'
|
|
2148
|
+
>>> get_ui_url("https://api.europe-west2.gcp.tinybird.co")
|
|
2149
|
+
'https://cloud.tinybird.co/gcp/europe-west2'
|
|
2150
|
+
>>> get_ui_url("https://other-domain.com")
|
|
2151
|
+
'https://other-domain.com'
|
|
2152
|
+
"""
|
|
2153
|
+
if "//localhost" in api_host:
|
|
2154
|
+
port = api_host.split(":")[-1] or "80"
|
|
2155
|
+
return f"https://cloud.tinybird.co/local/{port}"
|
|
2156
|
+
|
|
2157
|
+
if api_host.endswith("tinybird.co") and "api." in api_host:
|
|
2158
|
+
parts = api_host.split(".")
|
|
2159
|
+
if len(parts) >= 4:
|
|
2160
|
+
region = parts[1] or "europe-west2"
|
|
2161
|
+
cloud = parts[2] or "gcp"
|
|
2162
|
+
return f"https://cloud.tinybird.co/{cloud}/{region}"
|
|
2163
|
+
|
|
2164
|
+
return api_host
|
|
@@ -17,6 +17,7 @@ TB_LOCAL_HOST = f"http://localhost:{TB_LOCAL_PORT}"
|
|
|
17
17
|
|
|
18
18
|
async def get_tinybird_local_client(config_obj: Dict[str, Any], build: bool = False, staging: bool = False) -> TinyB:
|
|
19
19
|
"""Get a Tinybird client connected to the local environment."""
|
|
20
|
+
|
|
20
21
|
config = await get_tinybird_local_config(config_obj, build=build)
|
|
21
22
|
return config.get_client(host=TB_LOCAL_HOST, staging=staging)
|
|
22
23
|
|
|
@@ -40,9 +41,8 @@ async def get_tinybird_local_config(config_obj: Dict[str, Any], build: bool = Fa
|
|
|
40
41
|
default_token = tokens["workspace_admin_token"]
|
|
41
42
|
# Create a new workspace if path is provided. This is used to isolate the build in a different workspace.
|
|
42
43
|
if path:
|
|
43
|
-
folder_hash = hashlib.sha256(path.encode()).hexdigest()
|
|
44
44
|
user_client = config.get_client(host=TB_LOCAL_HOST, token=user_token)
|
|
45
|
-
ws_name =
|
|
45
|
+
ws_name = get_build_workspace_name(path) if build else config.get("name") or config_obj.get("name")
|
|
46
46
|
if not ws_name:
|
|
47
47
|
raise AuthNoTokenException()
|
|
48
48
|
|
|
@@ -74,3 +74,8 @@ async def get_tinybird_local_config(config_obj: Dict[str, Any], build: bool = Fa
|
|
|
74
74
|
|
|
75
75
|
config.set_user_token(user_token)
|
|
76
76
|
return config
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def get_build_workspace_name(path: str) -> str:
|
|
80
|
+
folder_hash = hashlib.sha256(path.encode()).hexdigest()
|
|
81
|
+
return f"Tinybird_Local_Build_{folder_hash}"
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import webbrowser
|
|
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, get_ui_url
|
|
8
|
+
from tinybird.tb.modules.exceptions import CLIException
|
|
9
|
+
from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
10
|
+
from tinybird.tb.modules.local_common import get_build_workspace_name
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@cli.command()
|
|
14
|
+
@click.option(
|
|
15
|
+
"--workspace",
|
|
16
|
+
help="Set the workspace you want to open. If unset, your current workspace will be used.",
|
|
17
|
+
)
|
|
18
|
+
@click.pass_context
|
|
19
|
+
@coro
|
|
20
|
+
async def open(ctx: Context, workspace: str):
|
|
21
|
+
"""Open workspace in the browser."""
|
|
22
|
+
|
|
23
|
+
config = ctx.ensure_object(dict)["config"]
|
|
24
|
+
client = ctx.ensure_object(dict)["client"]
|
|
25
|
+
env = ctx.ensure_object(dict)["env"]
|
|
26
|
+
|
|
27
|
+
url_host = get_ui_url(client.host)
|
|
28
|
+
|
|
29
|
+
if not workspace:
|
|
30
|
+
workspace = get_build_workspace_name(config.get("path")) if env == "build" else config.get("name")
|
|
31
|
+
|
|
32
|
+
if not workspace:
|
|
33
|
+
raise CLIException(
|
|
34
|
+
FeedbackManager.error(
|
|
35
|
+
message="No workspace found. Run 'tb login' first or pass a workspace using the --workspace parameter"
|
|
36
|
+
)
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
click.echo(FeedbackManager.highlight(message=f"» Opening workspace {workspace} in the browser"))
|
|
40
|
+
|
|
41
|
+
auth_url = f"{url_host}/{workspace}"
|
|
42
|
+
webbrowser.open(auth_url)
|
|
@@ -15,13 +15,13 @@ tinybird/syncasync.py,sha256=IPnOx6lMbf9SNddN1eBtssg8vCLHMt76SuZ6YNYm-Yk,27761
|
|
|
15
15
|
tinybird/tornado_template.py,sha256=jjNVDMnkYFWXflmT8KU_Ssbo5vR8KQq3EJMk5vYgXRw,41959
|
|
16
16
|
tinybird/ch_utils/constants.py,sha256=aYvg2C_WxYWsnqPdZB1ZFoIr8ZY-XjUXYyHKE9Ansj0,3890
|
|
17
17
|
tinybird/ch_utils/engine.py,sha256=BZuPM7MFS7vaEKK5tOMR2bwSAgJudPrJt27uVEwZmTY,40512
|
|
18
|
-
tinybird/tb/__cli__.py,sha256=
|
|
19
|
-
tinybird/tb/cli.py,sha256=
|
|
18
|
+
tinybird/tb/__cli__.py,sha256=NDM11e05WwpBFqDae6OVPT3I2exwaDoMuTDk7bU6M7Q,251
|
|
19
|
+
tinybird/tb/cli.py,sha256=D_SjS5SU0eTcsKs06I1W39vxQTUEt2TOIYpWAWwYQqA,1102
|
|
20
20
|
tinybird/tb/modules/auth.py,sha256=L1IatO2arRSzys3t8px8xVt8uPWUL5EVD0sFzAV_uVU,9022
|
|
21
21
|
tinybird/tb/modules/build.py,sha256=-lRGBxKtuipmyl3pmiGcfp67fH1Ed-COfHAZKdgLIWo,10483
|
|
22
22
|
tinybird/tb/modules/cicd.py,sha256=T0lb9u_bDdTUVe8TwNNb1qQ5KnSPHMVjqPfKF4BBNBw,5347
|
|
23
|
-
tinybird/tb/modules/cli.py,sha256
|
|
24
|
-
tinybird/tb/modules/common.py,sha256=
|
|
23
|
+
tinybird/tb/modules/cli.py,sha256=-xZ6-yrbKxcA-ou7K02H6gsMeZuvWsuEMNSleU_G9Fc,16467
|
|
24
|
+
tinybird/tb/modules/common.py,sha256=Qrc-fOyBOO2Z57pZyvnOQaaLToEgj13ZR1s2LmgJB9w,81246
|
|
25
25
|
tinybird/tb/modules/config.py,sha256=BVZg-4f_R3vJTwCChXY2AXaH67SRk62xoP_IymquosI,11404
|
|
26
26
|
tinybird/tb/modules/connection.py,sha256=WKeDxbTpSsQ1PUmsT730g3S5RT2PtR5mPpVEanD1nbM,3933
|
|
27
27
|
tinybird/tb/modules/copy.py,sha256=MAVqKip8_QhOYq99U_XuqSO6hCLJEh5sFtbhcXtI3SI,5802
|
|
@@ -36,11 +36,12 @@ tinybird/tb/modules/job.py,sha256=956Pj8BEEsiD2GZsV9RKKVM3I_CveOLgS82lykO5ukk,29
|
|
|
36
36
|
tinybird/tb/modules/llm.py,sha256=AC0VSphTOM2t-v1_3NLvNN_FIbgMo4dTyMqIv5nniPo,835
|
|
37
37
|
tinybird/tb/modules/llm_utils.py,sha256=nS9r4FAElJw8yXtmdYrx-rtI2zXR8qXfi1QqUDCfxvg,3469
|
|
38
38
|
tinybird/tb/modules/local.py,sha256=revEEYP-Oq5nqURgmZmc0kt1_tEjM31dyUtcH5YbOuc,5842
|
|
39
|
-
tinybird/tb/modules/local_common.py,sha256=
|
|
39
|
+
tinybird/tb/modules/local_common.py,sha256=Uty8vhn4FxRASqcMldpbadKcDiOeLx4PK01Nk_SbAsY,3144
|
|
40
40
|
tinybird/tb/modules/login.py,sha256=NB-evr7b00ChKPulX7c8YLN3EX6cr0CwALN0wroAq3o,6147
|
|
41
41
|
tinybird/tb/modules/logout.py,sha256=ULooy1cDBD02-r7voZmhV7udA0ML5tVuflJyShrh56Y,1022
|
|
42
42
|
tinybird/tb/modules/materialization.py,sha256=r8Q9HXcYEmfrEzP4WpiasCKDJdSkTPaAKJtZMoJKhi8,5749
|
|
43
43
|
tinybird/tb/modules/mock.py,sha256=3q4i6CXKcS-zsgevbN_zpAP4AnB9_WIVxmVSJV3FNPQ,3881
|
|
44
|
+
tinybird/tb/modules/open.py,sha256=s3eJLFtF6OnXX5OLZzBz58dYaG-TGDCYFSJHttm919g,1317
|
|
44
45
|
tinybird/tb/modules/pipe.py,sha256=gcLz0qHgwKDLsWFY3yFLO9a0ETAV1dFbI8YeLHi9460,2429
|
|
45
46
|
tinybird/tb/modules/playground.py,sha256=bN0whphoSO6p1_u3b6OAUoc3ieG5Cl3qNXwt2HcUOp8,4834
|
|
46
47
|
tinybird/tb/modules/project.py,sha256=ei0TIAuRksdV2g2FJqByuV4DPyivQGrZ42z_eQDNBgI,2963
|
|
@@ -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.
|
|
83
|
-
tinybird-0.0.1.
|
|
84
|
-
tinybird-0.0.1.
|
|
85
|
-
tinybird-0.0.1.
|
|
86
|
-
tinybird-0.0.1.
|
|
83
|
+
tinybird-0.0.1.dev94.dist-info/METADATA,sha256=7WmXBgGh3t5FjEws21d7CibjcqSWh13R2_gxP1KUbIc,2585
|
|
84
|
+
tinybird-0.0.1.dev94.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
85
|
+
tinybird-0.0.1.dev94.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
|
|
86
|
+
tinybird-0.0.1.dev94.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
|
|
87
|
+
tinybird-0.0.1.dev94.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|