tinybird 0.0.1.dev12__tar.gz → 0.0.1.dev13__tar.gz
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.
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/PKG-INFO +1 -1
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/cli.py +1 -0
- tinybird-0.0.1.dev13/tinybird/tb/modules/login.py +166 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird.egg-info/PKG-INFO +1 -1
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird.egg-info/SOURCES.txt +1 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/setup.cfg +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/__cli__.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/ch_utils/constants.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/ch_utils/engine.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/check_pypi.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/client.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/config.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/connectors.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/context.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/datafile.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/datatypes.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/feedback_manager.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/git_settings.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/sql.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/sql_template.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/sql_template_fmt.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/sql_toolset.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/syncasync.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/auth.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/branch.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/build.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/cicd.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/cli.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/common.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/config.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/connection.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/create.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/datafile/build.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/datafile/build_common.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/datafile/build_datasource.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/datafile/build_pipe.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/datafile/common.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/datafile/diff.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/datafile/exceptions.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/datafile/fixture.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/datafile/format_common.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/datafile/format_datasource.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/datafile/format_pipe.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/datafile/parse_datasource.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/datafile/parse_pipe.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/datafile/pipe_checker.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/datafile/pull.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/datasource.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/exceptions.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/fmt.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/job.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/llm.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/local.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/mock.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/pipe.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/prompts.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/regions.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/table.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/tag.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/telemetry.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/test.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/tinyunit/tinyunit.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/tinyunit/tinyunit_lib.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/token.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/workspace.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/workspace_members.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb_cli.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb_cli_modules/auth.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb_cli_modules/branch.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb_cli_modules/cicd.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb_cli_modules/cli.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb_cli_modules/common.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb_cli_modules/config.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb_cli_modules/connection.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb_cli_modules/datasource.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb_cli_modules/exceptions.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb_cli_modules/fmt.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb_cli_modules/job.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb_cli_modules/pipe.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb_cli_modules/regions.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb_cli_modules/tag.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb_cli_modules/telemetry.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb_cli_modules/test.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb_cli_modules/workspace.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb_cli_modules/workspace_members.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tornado_template.py +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird.egg-info/dependency_links.txt +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird.egg-info/entry_points.txt +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird.egg-info/requires.txt +0 -0
- {tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird.egg-info/top_level.txt +0 -0
|
@@ -14,6 +14,7 @@ import tinybird.tb.modules.create
|
|
|
14
14
|
import tinybird.tb.modules.datasource
|
|
15
15
|
import tinybird.tb.modules.fmt
|
|
16
16
|
import tinybird.tb.modules.job
|
|
17
|
+
import tinybird.tb.modules.login
|
|
17
18
|
import tinybird.tb.modules.mock
|
|
18
19
|
import tinybird.tb.modules.pipe
|
|
19
20
|
import tinybird.tb.modules.tag
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import http.server
|
|
2
|
+
import socketserver
|
|
3
|
+
import threading
|
|
4
|
+
import time
|
|
5
|
+
import urllib.parse
|
|
6
|
+
import webbrowser
|
|
7
|
+
from urllib.parse import urlencode
|
|
8
|
+
|
|
9
|
+
import click
|
|
10
|
+
import requests
|
|
11
|
+
|
|
12
|
+
from tinybird.feedback_manager import FeedbackManager
|
|
13
|
+
from tinybird.tb.modules.cli import CLIConfig, cli
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class AuthHandler(http.server.SimpleHTTPRequestHandler):
|
|
17
|
+
def do_GET(self):
|
|
18
|
+
# The access_token is in the URL fragment, which is not sent to the server
|
|
19
|
+
# We'll send a small HTML page that extracts the token and sends it back to the server
|
|
20
|
+
self.send_response(200)
|
|
21
|
+
self.send_header("Content-type", "text/html")
|
|
22
|
+
self.end_headers()
|
|
23
|
+
self.wfile.write(b"""
|
|
24
|
+
<html>
|
|
25
|
+
<head>
|
|
26
|
+
<style>
|
|
27
|
+
body {
|
|
28
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
29
|
+
background: #f5f5f5;
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
height: 100vh;
|
|
34
|
+
margin: 0;
|
|
35
|
+
}
|
|
36
|
+
.message {
|
|
37
|
+
background: white;
|
|
38
|
+
padding: 2rem 3rem;
|
|
39
|
+
border-radius: 8px;
|
|
40
|
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
41
|
+
text-align: center;
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
align-items: center;
|
|
45
|
+
}
|
|
46
|
+
h1 {
|
|
47
|
+
color: #25283D;
|
|
48
|
+
font-size: 1.2rem;
|
|
49
|
+
margin: 0;
|
|
50
|
+
font-weight: 500;
|
|
51
|
+
}
|
|
52
|
+
</style>
|
|
53
|
+
</head>
|
|
54
|
+
<body>
|
|
55
|
+
<div class="message">
|
|
56
|
+
<h1>Authenticating...</h1>
|
|
57
|
+
</div>
|
|
58
|
+
<script>
|
|
59
|
+
var hash = window.location.hash.substr(1);
|
|
60
|
+
var access_token = new URLSearchParams(hash).get('access_token');
|
|
61
|
+
window.history.pushState({}, '', '/');
|
|
62
|
+
fetch('/?token=' + access_token, {method: 'POST'})
|
|
63
|
+
.then(() => {
|
|
64
|
+
document.querySelector('.message h1').textContent = 'Authentication successful! You can close this window.';
|
|
65
|
+
});
|
|
66
|
+
</script>
|
|
67
|
+
</body>
|
|
68
|
+
</html>
|
|
69
|
+
""")
|
|
70
|
+
|
|
71
|
+
def do_POST(self):
|
|
72
|
+
parsed_path = urllib.parse.urlparse(self.path)
|
|
73
|
+
query_params = urllib.parse.parse_qs(parsed_path.query)
|
|
74
|
+
|
|
75
|
+
if "token" in query_params:
|
|
76
|
+
token = query_params["token"][0]
|
|
77
|
+
self.server.auth_callback(token)
|
|
78
|
+
self.send_response(200)
|
|
79
|
+
self.end_headers()
|
|
80
|
+
else:
|
|
81
|
+
self.send_error(400, "Missing 'token' parameter")
|
|
82
|
+
|
|
83
|
+
self.server.shutdown()
|
|
84
|
+
|
|
85
|
+
def log_message(self, format, *args):
|
|
86
|
+
# Suppress log messages
|
|
87
|
+
return
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class AuthServer(socketserver.TCPServer):
|
|
91
|
+
allow_reuse_address = True
|
|
92
|
+
|
|
93
|
+
def __init__(self, server_address, RequestHandlerClass, auth_callback):
|
|
94
|
+
self.auth_callback = auth_callback
|
|
95
|
+
super().__init__(server_address, RequestHandlerClass)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def start_server(auth_callback):
|
|
99
|
+
with AuthServer(("", 3000), AuthHandler, auth_callback) as httpd:
|
|
100
|
+
httpd.timeout = 30
|
|
101
|
+
start_time = time.time()
|
|
102
|
+
while time.time() - start_time < 60: # Run for a maximum of 60 seconds
|
|
103
|
+
httpd.handle_request()
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
@cli.command()
|
|
107
|
+
@click.option(
|
|
108
|
+
"--host",
|
|
109
|
+
help="Set custom host if it's different than https://api.tinybird.co. Check https://www.tinybird.co/docs/api-reference/overview#regions-and-endpoints for the available list of regions",
|
|
110
|
+
)
|
|
111
|
+
@click.option(
|
|
112
|
+
"--workspace",
|
|
113
|
+
help="Set the workspace to authenticate to. If not set, the default workspace will be used.",
|
|
114
|
+
)
|
|
115
|
+
def login(host: str, workspace: str):
|
|
116
|
+
"""Authenticate via browser."""
|
|
117
|
+
auth_event = threading.Event()
|
|
118
|
+
auth_code = [None] # Using a list to store the code, as it's mutable
|
|
119
|
+
config = CLIConfig.get_project_config()
|
|
120
|
+
host = host or "https://api.tinybird.co"
|
|
121
|
+
|
|
122
|
+
def auth_callback(code):
|
|
123
|
+
auth_code[0] = code
|
|
124
|
+
auth_event.set()
|
|
125
|
+
|
|
126
|
+
click.echo("Opening browser for authentication...")
|
|
127
|
+
|
|
128
|
+
# Start the local server in a separate thread
|
|
129
|
+
server_thread = threading.Thread(target=start_server, args=(auth_callback,))
|
|
130
|
+
server_thread.daemon = True
|
|
131
|
+
server_thread.start()
|
|
132
|
+
|
|
133
|
+
# Open the browser to the auth page
|
|
134
|
+
client_id = "T6excMo8IKguvUw4vFNYfqlt9pe6msCU"
|
|
135
|
+
callback_url = "http://localhost:3000"
|
|
136
|
+
params = {
|
|
137
|
+
"client_id": client_id,
|
|
138
|
+
"redirect_uri": callback_url,
|
|
139
|
+
"response_type": "token",
|
|
140
|
+
"scope": "openid profile email",
|
|
141
|
+
}
|
|
142
|
+
auth_url = f"https://auth.tinybird.co/authorize?{urlencode(params)}"
|
|
143
|
+
webbrowser.open(auth_url)
|
|
144
|
+
|
|
145
|
+
# Wait for the authentication to complete or timeout
|
|
146
|
+
if auth_event.wait(timeout=60): # Wait for up to 60 seconds
|
|
147
|
+
params = {}
|
|
148
|
+
if workspace:
|
|
149
|
+
params["workspace_id"] = workspace
|
|
150
|
+
response = requests.get(
|
|
151
|
+
f"https://api.tinybird.co/v0/user/tokens?{urlencode(params)}",
|
|
152
|
+
headers={"Authorization": f"Bearer {auth_code[0]}"},
|
|
153
|
+
)
|
|
154
|
+
data = response.json()
|
|
155
|
+
cli_config = CLIConfig.get_project_config()
|
|
156
|
+
workspace_token = data["workspace_token"]
|
|
157
|
+
user_token = data["user_token"]
|
|
158
|
+
cli_config.set_token(workspace_token)
|
|
159
|
+
cli_config.set_token_for_host(workspace_token, host)
|
|
160
|
+
cli_config.set_user_token(user_token)
|
|
161
|
+
config.set_host(host)
|
|
162
|
+
|
|
163
|
+
cli_config.persist_to_file()
|
|
164
|
+
click.echo(FeedbackManager.success(message="✓ Authentication successful!"))
|
|
165
|
+
else:
|
|
166
|
+
click.echo(FeedbackManager.error(message="Authentication failed or timed out."))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/datafile/build_datasource.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/datafile/format_datasource.py
RENAMED
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb/modules/datafile/parse_datasource.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev12 → tinybird-0.0.1.dev13}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|