tinybird 0.0.1.dev126__tar.gz → 0.0.1.dev128__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.
Potentially problematic release.
This version of tinybird might be problematic. Click here for more details.
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/PKG-INFO +1 -1
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/__cli__.py +2 -2
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/cli.py +0 -1
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/build.py +11 -5
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/test.py +8 -2
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/watch.py +1 -3
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird.egg-info/PKG-INFO +1 -1
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird.egg-info/SOURCES.txt +0 -1
- tinybird-0.0.1.dev126/tinybird/tb/modules/fmt.py +0 -94
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/setup.cfg +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/__cli__.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/ch_utils/constants.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/ch_utils/engine.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/check_pypi.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/client.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/config.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/connectors.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/context.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/datafile.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/datatypes.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/feedback_manager.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/git_settings.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/prompts.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/sql.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/sql_template.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/sql_template_fmt.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/sql_toolset.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/syncasync.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/client.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/config.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/auth.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/cicd.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/cli.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/common.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/config.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/connection.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/copy.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/create.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/datafile/build.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/datafile/build_common.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/datafile/build_datasource.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/datafile/build_pipe.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/datafile/common.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/datafile/diff.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/datafile/exceptions.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/datafile/fixture.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/datafile/format_common.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/datafile/format_datasource.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/datafile/format_pipe.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/datafile/parse_datasource.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/datafile/parse_pipe.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/datafile/pipe_checker.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/datafile/playground.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/datafile/pull.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/datasource.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/deployment.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/endpoint.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/exceptions.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/feedback_manager.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/infra.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/job.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/llm.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/llm_utils.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/local.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/local_common.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/login.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/logout.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/materialization.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/mock.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/open.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/pipe.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/project.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/regions.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/secret.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/shell.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/table.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/tag.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/telemetry.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/tinyunit/tinyunit.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/tinyunit/tinyunit_lib.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/token.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/workspace.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/workspace_members.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb_cli.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb_cli_modules/auth.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb_cli_modules/branch.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb_cli_modules/cicd.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb_cli_modules/cli.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb_cli_modules/common.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb_cli_modules/config.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb_cli_modules/connection.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb_cli_modules/datasource.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb_cli_modules/exceptions.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb_cli_modules/fmt.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb_cli_modules/job.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb_cli_modules/pipe.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb_cli_modules/regions.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb_cli_modules/tag.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb_cli_modules/telemetry.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb_cli_modules/test.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb_cli_modules/workspace.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb_cli_modules/workspace_members.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tornado_template.py +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird.egg-info/dependency_links.txt +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird.egg-info/entry_points.txt +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird.egg-info/requires.txt +0 -0
- {tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird.egg-info/top_level.txt +0 -0
|
@@ -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.dev128'
|
|
8
|
+
__revision__ = '1631c37'
|
|
@@ -14,7 +14,6 @@ import tinybird.tb.modules.create
|
|
|
14
14
|
import tinybird.tb.modules.datasource
|
|
15
15
|
import tinybird.tb.modules.deployment
|
|
16
16
|
import tinybird.tb.modules.endpoint
|
|
17
|
-
import tinybird.tb.modules.fmt
|
|
18
17
|
import tinybird.tb.modules.infra
|
|
19
18
|
import tinybird.tb.modules.job
|
|
20
19
|
import tinybird.tb.modules.local
|
|
@@ -63,7 +63,7 @@ def dev(ctx: click.Context, data_origin: str) -> None:
|
|
|
63
63
|
run_watch(project=project, tb_client=tb_client, process=partial(process, project=project, tb_client=tb_client))
|
|
64
64
|
|
|
65
65
|
|
|
66
|
-
def build_project(project: Project, tb_client: TinyB, file_changed: Optional[str] = None) -> None:
|
|
66
|
+
def build_project(project: Project, tb_client: TinyB, file_changed: Optional[str] = None, silent: bool = False) -> None:
|
|
67
67
|
MULTIPART_BOUNDARY_DATA_PROJECT = "data_project://"
|
|
68
68
|
DATAFILE_TYPE_TO_CONTENT_TYPE = {
|
|
69
69
|
".datasource": "text/plain",
|
|
@@ -112,7 +112,7 @@ def build_project(project: Project, tb_client: TinyB, file_changed: Optional[str
|
|
|
112
112
|
pipes = build.get("new_pipe_names", [])
|
|
113
113
|
connections = build.get("new_data_connector_names", [])
|
|
114
114
|
|
|
115
|
-
if not file_changed:
|
|
115
|
+
if not file_changed and not silent:
|
|
116
116
|
for ds in datasources:
|
|
117
117
|
ds_path_str: Optional[str] = next(
|
|
118
118
|
(p for p in project_files if p.endswith(ds + ".datasource")), None
|
|
@@ -261,7 +261,12 @@ def show_data(tb_client: TinyB, filename: str, diff: Optional[str] = None):
|
|
|
261
261
|
|
|
262
262
|
|
|
263
263
|
def process(
|
|
264
|
-
project: Project,
|
|
264
|
+
project: Project,
|
|
265
|
+
tb_client: TinyB,
|
|
266
|
+
watch: bool,
|
|
267
|
+
file_changed: Optional[str] = None,
|
|
268
|
+
diff: Optional[str] = None,
|
|
269
|
+
silent: bool = False,
|
|
265
270
|
) -> None:
|
|
266
271
|
time_start = time.time()
|
|
267
272
|
build_failed = False
|
|
@@ -271,7 +276,7 @@ def process(
|
|
|
271
276
|
rebuild_fixture_sql(project, tb_client, file_changed)
|
|
272
277
|
else:
|
|
273
278
|
try:
|
|
274
|
-
build_project(project, tb_client, file_changed)
|
|
279
|
+
build_project(project, tb_client, file_changed, silent)
|
|
275
280
|
except click.ClickException as e:
|
|
276
281
|
click.echo(FeedbackManager.error(message=e))
|
|
277
282
|
build_failed = True
|
|
@@ -291,7 +296,8 @@ def process(
|
|
|
291
296
|
if not watch:
|
|
292
297
|
sys.exit(1)
|
|
293
298
|
else:
|
|
294
|
-
|
|
299
|
+
if not silent:
|
|
300
|
+
click.echo(FeedbackManager.success(message=f"\n✓ {rebuild_str} completed in {elapsed_time:.1f}s"))
|
|
295
301
|
|
|
296
302
|
|
|
297
303
|
def run_watch(
|
|
@@ -17,6 +17,7 @@ from requests import Response
|
|
|
17
17
|
|
|
18
18
|
from tinybird.prompts import test_create_prompt
|
|
19
19
|
from tinybird.tb.client import TinyB
|
|
20
|
+
from tinybird.tb.modules.build import process
|
|
20
21
|
from tinybird.tb.modules.cli import cli
|
|
21
22
|
from tinybird.tb.modules.common import coro
|
|
22
23
|
from tinybird.tb.modules.config import CLIConfig
|
|
@@ -79,6 +80,7 @@ async def test_create(ctx: click.Context, name_or_filename: str, prompt: str) ->
|
|
|
79
80
|
config = CLIConfig.get_project_config()
|
|
80
81
|
root_path = project.path
|
|
81
82
|
folder = project.folder
|
|
83
|
+
|
|
82
84
|
try:
|
|
83
85
|
if ".pipe" in name_or_filename:
|
|
84
86
|
pipe_path = Path(name_or_filename)
|
|
@@ -211,9 +213,13 @@ async def test_update(ctx: click.Context, pipe: str) -> None:
|
|
|
211
213
|
@click.pass_context
|
|
212
214
|
@coro
|
|
213
215
|
async def run_tests(ctx: click.Context, name: Tuple[str, ...]) -> None:
|
|
214
|
-
click.echo(FeedbackManager.highlight(message="\n» Running tests"))
|
|
215
216
|
client: TinyB = ctx.ensure_object(dict)["client"]
|
|
216
217
|
project: Project = ctx.ensure_object(dict)["project"]
|
|
218
|
+
click.echo(FeedbackManager.highlight(message="\n» Building project"))
|
|
219
|
+
process(project=project, tb_client=client, watch=False, silent=True)
|
|
220
|
+
click.echo(FeedbackManager.info(message="✓ Done!"))
|
|
221
|
+
|
|
222
|
+
click.echo(FeedbackManager.highlight(message="\n» Running tests"))
|
|
217
223
|
paths = [Path(n) for n in name]
|
|
218
224
|
endpoints = [f"{project.path}/tests/{p.stem}.yaml" for p in paths]
|
|
219
225
|
test_files: List[str] = (
|
|
@@ -222,7 +228,7 @@ async def run_tests(ctx: click.Context, name: Tuple[str, ...]) -> None:
|
|
|
222
228
|
|
|
223
229
|
async def run_test(test_file):
|
|
224
230
|
test_file_path = Path(test_file)
|
|
225
|
-
click.echo(FeedbackManager.info(message=f"
|
|
231
|
+
click.echo(FeedbackManager.info(message=f"* {test_file_path.stem}{test_file_path.suffix}"))
|
|
226
232
|
test_file_content = yaml.safe_load(test_file_path.read_text())
|
|
227
233
|
|
|
228
234
|
for test in test_file_content:
|
|
@@ -164,9 +164,7 @@ class FileChangeHandler(FileSystemEventHandler):
|
|
|
164
164
|
is_vendor = "vendor/" in path
|
|
165
165
|
if is_vendor:
|
|
166
166
|
return False
|
|
167
|
-
return any(
|
|
168
|
-
path.endswith(ext) for ext in [".datasource", ".pipe", FixtureExtension.NDJSON, FixtureExtension.CSV]
|
|
169
|
-
)
|
|
167
|
+
return any(path.endswith(ext) for ext in [".pipe"])
|
|
170
168
|
|
|
171
169
|
if should_process_path(event.src_path):
|
|
172
170
|
return event.src_path
|
|
@@ -42,7 +42,6 @@ tinybird/tb/modules/deployment.py
|
|
|
42
42
|
tinybird/tb/modules/endpoint.py
|
|
43
43
|
tinybird/tb/modules/exceptions.py
|
|
44
44
|
tinybird/tb/modules/feedback_manager.py
|
|
45
|
-
tinybird/tb/modules/fmt.py
|
|
46
45
|
tinybird/tb/modules/infra.py
|
|
47
46
|
tinybird/tb/modules/job.py
|
|
48
47
|
tinybird/tb/modules/llm.py
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import difflib
|
|
2
|
-
import sys
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
from typing import List, Optional
|
|
5
|
-
|
|
6
|
-
import aiofiles
|
|
7
|
-
import click
|
|
8
|
-
from click import Context
|
|
9
|
-
|
|
10
|
-
from tinybird.tb.modules.cli import cli
|
|
11
|
-
from tinybird.tb.modules.common import coro
|
|
12
|
-
from tinybird.tb.modules.datafile.common import is_file_a_datasource
|
|
13
|
-
from tinybird.tb.modules.datafile.diff import color_diff, peek
|
|
14
|
-
from tinybird.tb.modules.datafile.format_datasource import format_datasource
|
|
15
|
-
from tinybird.tb.modules.datafile.format_pipe import format_pipe
|
|
16
|
-
from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
@cli.command()
|
|
20
|
-
@click.argument("filenames", type=click.Path(exists=True), nargs=-1, required=True)
|
|
21
|
-
@click.option(
|
|
22
|
-
"--line-length",
|
|
23
|
-
is_flag=False,
|
|
24
|
-
default=100,
|
|
25
|
-
help="A number indicating the maximum characters per line in the node SQL, lines will be splitted based on the SQL syntax and the number of characters passed as a parameter",
|
|
26
|
-
)
|
|
27
|
-
@click.option("--dry-run", is_flag=True, default=False, help="Don't ask to override the local file")
|
|
28
|
-
@click.option("--yes", is_flag=True, default=False, help="Do not ask for confirmation to overwrite the local file")
|
|
29
|
-
@click.option(
|
|
30
|
-
"--diff",
|
|
31
|
-
is_flag=True,
|
|
32
|
-
default=False,
|
|
33
|
-
help="Formats local file, prints the diff and exits 1 if different, 0 if equal",
|
|
34
|
-
)
|
|
35
|
-
@click.pass_context
|
|
36
|
-
@coro
|
|
37
|
-
async def fmt(
|
|
38
|
-
ctx: Context, filenames: List[str], line_length: int, dry_run: bool, yes: bool, diff: bool
|
|
39
|
-
) -> Optional[str]:
|
|
40
|
-
"""
|
|
41
|
-
Formats a .datasource, .pipe or .incl file.
|
|
42
|
-
|
|
43
|
-
This command removes comments starting with # from the file, use DESCRIPTION instead.
|
|
44
|
-
|
|
45
|
-
The format command tries to parse the datafile so syntax errors might rise.
|
|
46
|
-
|
|
47
|
-
.incl files must contain a NODE definition.
|
|
48
|
-
"""
|
|
49
|
-
|
|
50
|
-
result = ""
|
|
51
|
-
failed = []
|
|
52
|
-
for filename in filenames:
|
|
53
|
-
if not diff:
|
|
54
|
-
click.echo(filename)
|
|
55
|
-
extensions = Path(filename).suffixes
|
|
56
|
-
if is_file_a_datasource(filename):
|
|
57
|
-
result = await format_datasource(filename, skip_eval=True)
|
|
58
|
-
elif (".pipe" in extensions) or (".incl" in extensions):
|
|
59
|
-
result = await format_pipe(filename, line_length, skip_eval=True)
|
|
60
|
-
else:
|
|
61
|
-
click.echo("Unsupported file type. Supported files types are: .pipe and .datasource")
|
|
62
|
-
return None
|
|
63
|
-
|
|
64
|
-
if diff:
|
|
65
|
-
result = result.rstrip("\n")
|
|
66
|
-
lines_fmt = [f"{line}\n" for line in result.split("\n")]
|
|
67
|
-
async with aiofiles.open(filename, "r") as file:
|
|
68
|
-
lines_file = await file.readlines()
|
|
69
|
-
diff_result = difflib.unified_diff(
|
|
70
|
-
lines_file, lines_fmt, fromfile=f"{Path(filename).name} local", tofile="fmt datafile"
|
|
71
|
-
)
|
|
72
|
-
diff_result = color_diff(diff_result)
|
|
73
|
-
not_empty, diff_lines = peek(diff_result)
|
|
74
|
-
if not_empty:
|
|
75
|
-
sys.stdout.writelines(diff_lines)
|
|
76
|
-
failed.append(filename)
|
|
77
|
-
click.echo("")
|
|
78
|
-
else:
|
|
79
|
-
click.echo(result)
|
|
80
|
-
if dry_run:
|
|
81
|
-
return None
|
|
82
|
-
|
|
83
|
-
if yes or click.confirm(FeedbackManager.prompt_override_local_file(name=filename)):
|
|
84
|
-
async with aiofiles.open(f"{filename}", "w") as file:
|
|
85
|
-
await file.write(result)
|
|
86
|
-
|
|
87
|
-
click.echo(FeedbackManager.success_generated_local_file(file=filename))
|
|
88
|
-
|
|
89
|
-
if len(failed):
|
|
90
|
-
click.echo(FeedbackManager.error_failed_to_format_files(number=len(failed)))
|
|
91
|
-
for f in failed:
|
|
92
|
-
click.echo(f"tb fmt {f} --yes")
|
|
93
|
-
sys.exit(1)
|
|
94
|
-
return result
|
|
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.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/datafile/build_common.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/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
|
{tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/datafile/format_common.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/datafile/format_datasource.py
RENAMED
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/datafile/parse_datasource.py
RENAMED
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/modules/datafile/pipe_checker.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
|
{tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb/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
|
|
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.dev126 → tinybird-0.0.1.dev128}/tinybird/tb_cli_modules/tinyunit/tinyunit.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py
RENAMED
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev126 → tinybird-0.0.1.dev128}/tinybird/tb_cli_modules/workspace_members.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|