tinybird 0.0.1.dev51__py3-none-any.whl → 0.0.1.dev53__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.dev51'
8
- __revision__ = '0583356'
7
+ __version__ = '0.0.1.dev53'
8
+ __revision__ = '883fa46'
@@ -391,7 +391,7 @@ def __unpatch_click_output():
391
391
 
392
392
 
393
393
  async def create_ctx_client(ctx: Context, config: Dict[str, Any], cloud: bool, build: bool, project: Project):
394
- commands_without_ctx_client = ["auth", "check", "login", "local"]
394
+ commands_without_ctx_client = ["auth", "check", "login", "local", "upgrade"]
395
395
  command = ctx.invoked_subcommand
396
396
  if command in commands_without_ctx_client:
397
397
  return None
@@ -28,12 +28,10 @@ def start_tinybird_local(
28
28
  pull_show_prompt = False
29
29
  pull_required = True
30
30
 
31
- if (
32
- pull_show_prompt
33
- and click.prompt(
34
- FeedbackManager.warning(message="△ New version detected, download? [y/N]"), default="n"
35
- ).lower()
36
- == "y"
31
+ if pull_show_prompt and click.confirm(
32
+ FeedbackManager.warning(message="△ New version detected, download? [y/N]:"),
33
+ show_default=False,
34
+ prompt_suffix="",
37
35
  ):
38
36
  click.echo(FeedbackManager.info(message="* Downloading latest version of Tinybird Local..."))
39
37
  pull_required = True
@@ -34,35 +34,16 @@ class AuthHandler(http.server.SimpleHTTPRequestHandler):
34
34
  height: 100vh;
35
35
  margin: 0;
36
36
  }
37
- .message {
38
- background: white;
39
- padding: 2rem 3rem;
40
- border-radius: 8px;
41
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
42
- text-align: center;
43
- display: flex;
44
- flex-direction: column;
45
- align-items: center;
46
- }
47
- h1 {
48
- color: #25283D;
49
- font-size: 1.2rem;
50
- margin: 0;
51
- font-weight: 500;
52
- }
53
37
  </style>
54
38
  </head>
55
39
  <body>
56
- <div class="message">
57
- <h1>Authenticating...</h1>
58
- </div>
59
40
  <script>
60
- var hash = window.location.hash.substr(1);
61
- var access_token = new URLSearchParams(hash).get('access_token');
62
- window.history.pushState({}, '', '/');
63
- fetch('/?token=' + access_token, {method: 'POST'})
41
+ const searchParams = new URLSearchParams(window.location.search);
42
+ const code = searchParams.get('code');
43
+ const workspace = searchParams.get('workspace');
44
+ fetch('/?code=' + code, {method: 'POST'})
64
45
  .then(() => {
65
- document.querySelector('.message h1').textContent = 'Authentication successful! You can close this window.';
46
+ window.location.href = "https://cloud.tinybird.co/cli-login?workspace=" + workspace;
66
47
  });
67
48
  </script>
68
49
  </body>
@@ -73,13 +54,13 @@ class AuthHandler(http.server.SimpleHTTPRequestHandler):
73
54
  parsed_path = urllib.parse.urlparse(self.path)
74
55
  query_params = urllib.parse.parse_qs(parsed_path.query)
75
56
 
76
- if "token" in query_params:
77
- token = query_params["token"][0]
78
- self.server.auth_callback(token) # type: ignore
57
+ if "code" in query_params:
58
+ code = query_params["code"][0]
59
+ self.server.auth_callback(code) # type: ignore
79
60
  self.send_response(200)
80
61
  self.end_headers()
81
62
  else:
82
- self.send_error(400, "Missing 'token' parameter")
63
+ self.send_error(400, "Missing 'code' parameter")
83
64
 
84
65
  self.server.shutdown()
85
66
 
@@ -112,15 +93,20 @@ def start_server(auth_callback):
112
93
  "--host",
113
94
  help="Set custom host if it's different than https://api.tinybird.co. See https://www.tinybird.co/docs/api-reference/overview#regions-and-endpoints for the available list of regions.",
114
95
  )
96
+ @click.option(
97
+ "--auth-host",
98
+ default="https://cloud.tinybird.co",
99
+ help="Set the host to authenticate to. If unset, the default host will be used.",
100
+ )
115
101
  @click.option(
116
102
  "--workspace",
117
103
  help="Set the workspace to authenticate to. If unset, the default workspace will be used.",
118
104
  )
119
105
  @coro
120
- async def login(host: str, workspace: str):
106
+ async def login(host: str, auth_host: str, workspace: str):
121
107
  """Authenticate using the browser."""
122
108
  auth_event = threading.Event()
123
- auth_code = [None] # Using a list to store the code, as it's mutable
109
+ auth_code: list[str] = [] # Using a list to store the code, as it's mutable
124
110
  host = host or "https://api.wadus2.gcp.tinybird.co"
125
111
 
126
112
  def auth_callback(code):
@@ -135,30 +121,23 @@ async def login(host: str, workspace: str):
135
121
  server_thread.start()
136
122
 
137
123
  # Open the browser to the auth page
138
- if "wadus" in host:
139
- client_id = "Rpl7Uy9aSjqoPCSvHgGl3zNQuZcSOXBe"
140
- base_auth_url = "https://auth.wadus1.tinybird.co"
141
- else:
142
- client_id = "T6excMo8IKguvUw4vFNYfqlt9pe6msCU"
143
- base_auth_url = "https://auth.tinybird.co"
144
124
  callback_url = f"http://localhost:{AUTH_SERVER_PORT}"
145
125
  params = {
146
- "client_id": client_id,
147
126
  "redirect_uri": callback_url,
148
- "response_type": "token",
149
- "scope": "openid profile email",
150
127
  }
151
- auth_url = f"{base_auth_url}/authorize?{urlencode(params)}"
128
+
129
+ if workspace:
130
+ params["workspace"] = workspace
131
+
132
+ auth_url = f"{auth_host}/api/cli-login?{urlencode(params)}"
152
133
  webbrowser.open(auth_url)
153
134
 
154
135
  # Wait for the authentication to complete or timeout
155
136
  if auth_event.wait(timeout=60): # Wait for up to 60 seconds
156
137
  params = {}
157
- if workspace:
158
- params["workspace_id"] = workspace
138
+ params["code"] = auth_code[0]
159
139
  response = requests.get( # noqa: ASYNC210
160
- f"{host}/v0/user/tokens?{urlencode(params)}",
161
- headers={"Authorization": f"Bearer {auth_code[0]}"},
140
+ f"{auth_host}/api/cli-login?{urlencode(params)}",
162
141
  )
163
142
 
164
143
  data = response.json()
@@ -168,15 +147,15 @@ async def login(host: str, workspace: str):
168
147
  cli_config.set_user_token(data.get("user_token", ""))
169
148
  cli_config.set_host(host)
170
149
 
171
- ws = await cli_config.get_client().workspace_info()
150
+ ws = await cli_config.get_client(token=data.get("workspace_token", "")).workspace_info()
172
151
  for k in ("id", "name", "user_email", "user_id", "scope"):
173
152
  if k in ws:
174
153
  cli_config[k] = ws[k]
175
154
 
176
155
  cli_config.persist_to_file()
177
- click.echo(FeedbackManager.info(message="\nWorkspace: %s" % ws["name"]))
178
- click.echo(FeedbackManager.info(message="User: %s" % ws["user_email"]))
179
- click.echo(FeedbackManager.info(message="Host: %s" % host))
156
+ click.echo(FeedbackManager.gray(message="\nWorkspace: ") + FeedbackManager.info(message=ws["name"]))
157
+ click.echo(FeedbackManager.gray(message="User: ") + FeedbackManager.info(message=ws["user_email"]))
158
+ click.echo(FeedbackManager.gray(message="Host: ") + FeedbackManager.info(message=host))
180
159
  click.echo(FeedbackManager.success(message="\n✓ Authentication successful!"))
181
160
  else:
182
161
  click.echo(FeedbackManager.error(message="Authentication failed or timed out."))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tinybird
3
- Version: 0.0.1.dev51
3
+ Version: 0.0.1.dev53
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/cli/introduction.html
6
6
  Author: Tinybird
@@ -15,12 +15,12 @@ tinybird/syncasync.py,sha256=IPnOx6lMbf9SNddN1eBtssg8vCLHMt76SuZ6YNYm-Yk,27761
15
15
  tinybird/tornado_template.py,sha256=FL85SMPq2dH4JqKovmSbaolGdEzwOO91NqOzqXo2Qr0,41863
16
16
  tinybird/ch_utils/constants.py,sha256=aYvg2C_WxYWsnqPdZB1ZFoIr8ZY-XjUXYyHKE9Ansj0,3890
17
17
  tinybird/ch_utils/engine.py,sha256=OXkBhlzGjZotjD0vaT-rFIbSGV4tpiHxE8qO_ip0SyQ,40454
18
- tinybird/tb/__cli__.py,sha256=lueSRn8bo9ZPTsNz1ZtYf4nXUKMWsEvOcZMMSBXqYKQ,251
18
+ tinybird/tb/__cli__.py,sha256=yRBGGckfEd47ez8Wv86X_i5w2NuzrJLnctH0B-A-3Po,251
19
19
  tinybird/tb/cli.py,sha256=FD1pfbzu9YHJHEG6Vtn_EwPLTYhwqw-I6AxXeTaRHU8,926
20
20
  tinybird/tb/modules/auth.py,sha256=EzRWFmwRkXNhUmRaruEVFLdkbUg8xMSix0cAWl5D4Jg,9029
21
21
  tinybird/tb/modules/build.py,sha256=bGx4sON9g90zVBVCd16La-1yV1nWZ_AY-2RZ77sco0s,8361
22
22
  tinybird/tb/modules/cicd.py,sha256=xxXwy-QekJcG14kkJeGNl7LkHduhZXfvBZE8WrU6-t4,5351
23
- tinybird/tb/modules/cli.py,sha256=ILZ39TNbT7QuimzRayAU1NAYBmWWhE66pAbVDUlKWMU,16167
23
+ tinybird/tb/modules/cli.py,sha256=hom-69SKIWSyc-reh424G-eLGYokx7XBLM8Aaa1yS3c,16178
24
24
  tinybird/tb/modules/common.py,sha256=TWcGJUgzJCQvzI1oMKbNdx-KTRmMGvB25BawHpsaV8Q,70610
25
25
  tinybird/tb/modules/config.py,sha256=mie3oMVTf5YOUFEiLs88P16U4LkJafJjSpjwyAkFHog,10979
26
26
  tinybird/tb/modules/copy.py,sha256=wxyxZg8BPiWDgbW5HXJKYQp7_EumBXmAilo3McbCQOo,5916
@@ -34,9 +34,9 @@ tinybird/tb/modules/fmt.py,sha256=poh6_cwVGSf-sBu6LKWuO2TANL_J8Sgm25sPpwxa3Aw,35
34
34
  tinybird/tb/modules/job.py,sha256=956Pj8BEEsiD2GZsV9RKKVM3I_CveOLgS82lykO5ukk,2963
35
35
  tinybird/tb/modules/llm.py,sha256=AC0VSphTOM2t-v1_3NLvNN_FIbgMo4dTyMqIv5nniPo,835
36
36
  tinybird/tb/modules/llm_utils.py,sha256=nS9r4FAElJw8yXtmdYrx-rtI2zXR8qXfi1QqUDCfxvg,3469
37
- tinybird/tb/modules/local.py,sha256=x4xuCGVkoa8KLYGZEJnFUP8HUkKX05Frp_djRVjVjTs,5669
37
+ tinybird/tb/modules/local.py,sha256=_PIa-1M-72bv9rhLwqaNthJM1ZhvcjWXFChZAfEPXRs,5658
38
38
  tinybird/tb/modules/local_common.py,sha256=W1fEnB1vBQ4YC5U1PdA0w0g3cTV78bQ5R-lRxdDj5-Y,2868
39
- tinybird/tb/modules/login.py,sha256=cnB2Vwjc94FpG9C-7Y-l7Lb0Xilp2oUFDzqbQW0tpkU,6519
39
+ tinybird/tb/modules/login.py,sha256=qk7_Xq7X6sR1N858eWhmBZeoMUtZh0y4GtIAsmCqpKY,5740
40
40
  tinybird/tb/modules/materialization.py,sha256=HQKRTH6lkcYiDQJihbFqF_in58ezXG4ggZ_7Ywp_nUM,5738
41
41
  tinybird/tb/modules/mock.py,sha256=PzFtZL-6bZAZ3EiCC2nYJo058I4m50fD7FcBHISn3cI,5235
42
42
  tinybird/tb/modules/pipe.py,sha256=pH2KwgH6Xbvl3kT8vMelpKvT6bcyB4EKFDvGfOsxXbg,2418
@@ -74,8 +74,8 @@ tinybird/tb_cli_modules/config.py,sha256=6u6B5QCdiQLbJkCkwtnKGs9H3nP-KXXhC75mF7B
74
74
  tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
75
75
  tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
76
76
  tinybird/tb_cli_modules/telemetry.py,sha256=iEGnMuCuNhvF6ln__j6X9MSTwL_0Hm-GgFHHHvhfknk,10466
77
- tinybird-0.0.1.dev51.dist-info/METADATA,sha256=H-1sJl0564IrJq5ph6Bg_i7At_H6LsejUDNmEkGpJF8,2482
78
- tinybird-0.0.1.dev51.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
79
- tinybird-0.0.1.dev51.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
80
- tinybird-0.0.1.dev51.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
81
- tinybird-0.0.1.dev51.dist-info/RECORD,,
77
+ tinybird-0.0.1.dev53.dist-info/METADATA,sha256=XJMz84MQxJCPD0mv_L9ZSpAkb6oHI5i3XnFy-jgSGBw,2482
78
+ tinybird-0.0.1.dev53.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
79
+ tinybird-0.0.1.dev53.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
80
+ tinybird-0.0.1.dev53.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
81
+ tinybird-0.0.1.dev53.dist-info/RECORD,,