tinybird 4.4.2.dev0__tar.gz → 4.4.3.dev0__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.
Files changed (126) hide show
  1. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/PKG-INFO +6 -1
  2. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/git_settings.py +1 -1
  3. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/sql_template.py +4 -3
  4. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/__cli__.py +2 -2
  5. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/build.py +38 -1
  6. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/cli.py +16 -4
  7. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/common.py +10 -6
  8. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/info.py +1 -1
  9. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/local_common.py +24 -9
  10. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/preview.py +2 -2
  11. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird.egg-info/PKG-INFO +6 -1
  12. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/setup.cfg +0 -0
  13. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/__cli__.py +0 -0
  14. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/ch_utils/constants.py +0 -0
  15. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/ch_utils/engine.py +0 -0
  16. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/check_pypi.py +0 -0
  17. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/client.py +0 -0
  18. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/config.py +0 -0
  19. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/context.py +0 -0
  20. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/datafile/common.py +0 -0
  21. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/datafile/exceptions.py +0 -0
  22. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/datafile/parse_connection.py +0 -0
  23. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/datafile/parse_datasource.py +0 -0
  24. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/datafile/parse_pipe.py +0 -0
  25. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/datatypes.py +0 -0
  26. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/feedback_manager.py +0 -0
  27. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/prompts.py +0 -0
  28. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/service_datasources.py +0 -0
  29. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/sql.py +0 -0
  30. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/sql_template_fmt.py +0 -0
  31. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/sql_toolset.py +0 -0
  32. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/syncasync.py +0 -0
  33. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/check_pypi.py +0 -0
  34. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/cli.py +0 -0
  35. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/client.py +0 -0
  36. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/config.py +0 -0
  37. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/branch.py +0 -0
  38. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/build_common.py +0 -0
  39. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/cicd.py +0 -0
  40. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/config.py +0 -0
  41. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/connection.py +0 -0
  42. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/connection_kafka.py +0 -0
  43. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/connection_s3.py +0 -0
  44. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/copy.py +0 -0
  45. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/create.py +0 -0
  46. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/datafile/build.py +0 -0
  47. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/datafile/build_common.py +0 -0
  48. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/datafile/build_datasource.py +0 -0
  49. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/datafile/build_pipe.py +0 -0
  50. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/datafile/diff.py +0 -0
  51. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/datafile/fixture.py +0 -0
  52. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/datafile/format_common.py +0 -0
  53. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/datafile/format_connection.py +0 -0
  54. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/datafile/format_datasource.py +0 -0
  55. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/datafile/format_pipe.py +0 -0
  56. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/datafile/pipe_checker.py +0 -0
  57. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/datafile/playground.py +0 -0
  58. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/datafile/pull.py +0 -0
  59. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/datasource.py +0 -0
  60. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/deployment.py +0 -0
  61. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/deployment_common.py +0 -0
  62. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/deprecations.py +0 -0
  63. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/endpoint.py +0 -0
  64. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/exceptions.py +0 -0
  65. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/feedback_manager.py +0 -0
  66. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/fmt.py +0 -0
  67. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/infra.py +0 -0
  68. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/job.py +0 -0
  69. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/job_common.py +0 -0
  70. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/llm.py +0 -0
  71. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/llm_utils.py +0 -0
  72. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/local.py +0 -0
  73. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/local_logs.py +0 -0
  74. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/login.py +0 -0
  75. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/login_common.py +0 -0
  76. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/logout.py +0 -0
  77. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/logs.py +0 -0
  78. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/materialization.py +0 -0
  79. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/open.py +0 -0
  80. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/pipe.py +0 -0
  81. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/project.py +0 -0
  82. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/project_commands.py +0 -0
  83. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/py_project.py +0 -0
  84. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/query_output.py +0 -0
  85. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/regions.py +0 -0
  86. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/secret.py +0 -0
  87. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/secret_common.py +0 -0
  88. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/sink.py +0 -0
  89. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/table.py +0 -0
  90. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/telemetry.py +0 -0
  91. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/test.py +0 -0
  92. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/test_common.py +0 -0
  93. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/tinyunit/tinyunit.py +0 -0
  94. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/tinyunit/tinyunit_lib.py +0 -0
  95. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/token.py +0 -0
  96. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/ts_project.py +0 -0
  97. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/watch.py +0 -0
  98. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/workspace.py +0 -0
  99. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb/modules/workspace_members.py +0 -0
  100. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb_cli.py +0 -0
  101. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb_cli_modules/auth.py +0 -0
  102. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb_cli_modules/branch.py +0 -0
  103. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb_cli_modules/cicd.py +0 -0
  104. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb_cli_modules/cli.py +0 -0
  105. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb_cli_modules/common.py +0 -0
  106. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb_cli_modules/config.py +0 -0
  107. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb_cli_modules/connection.py +0 -0
  108. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb_cli_modules/datasource.py +0 -0
  109. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb_cli_modules/exceptions.py +0 -0
  110. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb_cli_modules/fmt.py +0 -0
  111. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb_cli_modules/job.py +0 -0
  112. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb_cli_modules/pipe.py +0 -0
  113. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb_cli_modules/regions.py +0 -0
  114. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb_cli_modules/tag.py +0 -0
  115. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb_cli_modules/telemetry.py +0 -0
  116. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb_cli_modules/test.py +0 -0
  117. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
  118. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
  119. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb_cli_modules/workspace.py +0 -0
  120. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tb_cli_modules/workspace_members.py +0 -0
  121. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird/tornado_template.py +0 -0
  122. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird.egg-info/SOURCES.txt +0 -0
  123. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird.egg-info/dependency_links.txt +0 -0
  124. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird.egg-info/entry_points.txt +0 -0
  125. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird.egg-info/requires.txt +0 -0
  126. {tinybird-4.4.2.dev0 → tinybird-4.4.3.dev0}/tinybird.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 4.4.2.dev0
3
+ Version: 4.4.3.dev0
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/forward/commands
6
6
  Author: Tinybird
@@ -52,6 +52,11 @@ The Tinybird command-line tool allows you to use all the Tinybird functionality
52
52
  Changelog
53
53
  ----------
54
54
 
55
+ 4.4.2
56
+ *******
57
+
58
+ - `Added` `tb build` and `tb dev` now display git branch, Tinybird branch name, and dashboard URL before building. In local mode, a separate workspace is created per git branch.
59
+
55
60
  4.4.1
56
61
  *******
57
62
 
@@ -71,7 +71,7 @@ VERSION=0.0.0
71
71
  # TB_SKIP_REGRESSION=0
72
72
 
73
73
  # Use `OBFUSCATE_REGEX_PATTERN` and `OBFUSCATE_PATTERN_SEPARATOR` environment variables to define a regex pattern and a separator (in case of a single string with multiple regex) to obfuscate secrets in the CLI output.
74
- # OBFUSCATE_REGEX_PATTERN="https://(www\.)?[^/]+||^Follow these instructions =>"
74
+ # OBFUSCATE_REGEX_PATTERN="https://(www\\.)?[^/]+||^Follow these instructions =>"
75
75
  # OBFUSCATE_PATTERN_SEPARATOR=||
76
76
  ##########
77
77
  """
@@ -20,6 +20,8 @@ from tinybird.context import (
20
20
  from .datatypes import testers
21
21
  from .tornado_template import VALID_CUSTOM_FUNCTION_NAMES, SecurityException, Template
22
22
 
23
+ VALID_ACTIVATE_FEATURES = frozenset(["analyzer", "parallel_replicas", "optimize_aggregation_in_order"])
24
+
23
25
  TB_SECRET_IN_TEST_MODE = "tb_secret_dont_raise"
24
26
  TB_SECRET_PREFIX = "tb_secret_"
25
27
  CH_PARAM_PREFIX = "param_"
@@ -1463,10 +1465,9 @@ def generate(self, **kwargs) -> Tuple[str, TemplateExecutionResults]:
1463
1465
  return Expression(f"-- cache_ttl {ttl_expression}\n")
1464
1466
 
1465
1467
  def set_activate(feature):
1466
- valid_features = ("analyzer", "parallel_replicas")
1467
- if feature not in valid_features:
1468
+ if feature not in VALID_ACTIVATE_FEATURES:
1468
1469
  raise SQLTemplateException(f"'{feature}' is not a valid 'activate' argument")
1469
- template_execution_results["activate"] = feature
1470
+ template_execution_results.setdefault("activate", set()).add(feature)
1470
1471
  return Expression(f"-- activate {feature}\n")
1471
1472
 
1472
1473
  def set_disable_feature(feature):
@@ -4,5 +4,5 @@ __description__ = 'Tinybird Command Line Tool'
4
4
  __url__ = 'https://www.tinybird.co/docs/forward/commands'
5
5
  __author__ = 'Tinybird'
6
6
  __author_email__ = 'support@tinybird.co'
7
- __version__ = '4.4.2.dev0'
8
- __revision__ = '5658fd7'
7
+ __version__ = '4.4.3.dev0'
8
+ __revision__ = '026901c'
@@ -12,8 +12,9 @@ from tinybird.datafile.exceptions import ParseException
12
12
  from tinybird.datafile.parse_datasource import parse_datasource
13
13
  from tinybird.datafile.parse_pipe import parse_pipe
14
14
  from tinybird.tb.client import TinyB
15
+ from tinybird.tb.config import CLOUD_HOSTS
15
16
  from tinybird.tb.modules.build_common import process
16
- from tinybird.tb.modules.cli import cli
17
+ from tinybird.tb.modules.cli import cli, get_current_git_branch
17
18
  from tinybird.tb.modules.config import CLIConfig
18
19
  from tinybird.tb.modules.datafile.playground import folder_playground
19
20
  from tinybird.tb.modules.feedback_manager import FeedbackManager
@@ -22,6 +23,40 @@ from tinybird.tb.modules.query_output import print_table_formatted
22
23
  from tinybird.tb.modules.watch import watch_files, watch_project
23
24
 
24
25
 
26
+ def _get_dashboard_url(config: Dict[str, Any], branch_name: str, is_local: bool) -> Optional[str]:
27
+ host = config.get("host", "")
28
+ cloud_base = CLOUD_HOSTS.get(host)
29
+ workspace_name = config.get("name", "")
30
+ if not cloud_base or not workspace_name:
31
+ return None
32
+ if is_local:
33
+ return f"{cloud_base}/{workspace_name}~local~{branch_name}"
34
+ return f"{cloud_base}/{workspace_name}~{branch_name}"
35
+
36
+
37
+ def echo_branch_info(obj: Dict[str, Any]) -> None:
38
+ local_branch = obj.get("local_branch")
39
+ cloud_branch = obj.get("branch")
40
+ if not local_branch and not cloud_branch:
41
+ return
42
+ git_branch = obj.get("git_branch") or get_current_git_branch()
43
+ branch_created = obj.get("branch_created", False)
44
+ status = "✓ created" if branch_created else "✓ exists"
45
+ config = obj.get("config", {})
46
+ if git_branch:
47
+ click.echo(FeedbackManager.highlight(message=f"» Git branch: {git_branch}"))
48
+ if local_branch:
49
+ click.echo(FeedbackManager.highlight(message=f"» Tinybird Local branch: {local_branch} {status}"))
50
+ dashboard_url = _get_dashboard_url(config, local_branch, is_local=True)
51
+ elif cloud_branch:
52
+ click.echo(FeedbackManager.highlight(message=f"» Tinybird Cloud branch: {cloud_branch} {status}"))
53
+ dashboard_url = _get_dashboard_url(config, cloud_branch, is_local=False)
54
+ else:
55
+ dashboard_url = None
56
+ if dashboard_url:
57
+ click.echo(FeedbackManager.gray(message=f" ↳ {dashboard_url}"))
58
+
59
+
25
60
  @cli.command()
26
61
  @click.option("--watch", is_flag=True, default=False, help="Watch for changes and rebuild automatically")
27
62
  @click.option(
@@ -56,6 +91,7 @@ def build(ctx: click.Context, watch: bool, with_connections: bool) -> None:
56
91
  )
57
92
  )
58
93
 
94
+ echo_branch_info(obj)
59
95
  click.echo(FeedbackManager.highlight_building_project())
60
96
  process(
61
97
  project=project,
@@ -104,6 +140,7 @@ def dev(ctx: click.Context, with_connections: Optional[bool]) -> None:
104
140
  tb_client: TinyB = ctx.ensure_object(dict)["client"]
105
141
  config: Dict[str, Any] = ctx.ensure_object(dict)["config"]
106
142
 
143
+ echo_branch_info(obj)
107
144
  click.echo(FeedbackManager.highlight_building_project())
108
145
  process(
109
146
  project=project,
@@ -417,7 +417,7 @@ def get_project_type_from_tinybird_config(start_dir: str) -> Optional[str]:
417
417
 
418
418
 
419
419
  def _set_config_to_main_workspace(config: Dict[str, Any], staging: bool) -> None:
420
- client = _get_tb_client(config.get("token", ""), config["host"], staging=staging)
420
+ client, _ = _get_tb_client(config.get("token", ""), config["host"], staging=staging)
421
421
  response = client.user_workspaces_and_branches(version="v1")
422
422
  workspaces = response.get("workspaces", [])
423
423
  if not workspaces:
@@ -618,7 +618,7 @@ def cli(
618
618
  config = get_config(host, token, user_token=user_token, config_file=config_temp._path)
619
619
  project_type = get_project_type_from_tinybird_config(os.getcwd()) or PROJECT_TYPE_CLI
620
620
  ctx.ensure_object(dict)["project_type"] = project_type
621
- client = _get_tb_client(config.get("token", ""), config["host"], request_from=project_type)
621
+ client, _ = _get_tb_client(config.get("token", ""), config["host"], request_from=project_type)
622
622
 
623
623
  tinybird_dev_mode = get_dev_mode_from_tinybird_config(os.getcwd())
624
624
  if tinybird_dev_mode:
@@ -1067,7 +1067,7 @@ def create_ctx_client(
1067
1067
  if method and show_warnings:
1068
1068
  click.echo(FeedbackManager.gray(message=f"Authentication method: {method}"))
1069
1069
 
1070
- return _get_tb_client(
1070
+ client, branch_created = _get_tb_client(
1071
1071
  config.get("token", ""),
1072
1072
  config["host"],
1073
1073
  staging=staging,
@@ -1075,10 +1075,22 @@ def create_ctx_client(
1075
1075
  create_branch_if_missing=create_branch_if_missing,
1076
1076
  request_from=project_type,
1077
1077
  )
1078
+ ctx.ensure_object(dict)["branch_created"] = branch_created
1079
+ return client
1078
1080
  test = command in command_always_test
1079
1081
  if show_warnings and command:
1080
1082
  click.echo(FeedbackManager.gray(message="Running against Tinybird Local"))
1081
- return get_tinybird_local_client(config, test=test, staging=staging)
1083
+ local_branch = None
1084
+ if command in ("build", "dev") and not test:
1085
+ git_branch = get_current_git_branch()
1086
+ if git_branch and not is_main_git_branch(git_branch):
1087
+ local_branch = get_tinybird_branch_name_from_git_branch(git_branch)
1088
+ ctx.ensure_object(dict)["git_branch"] = git_branch
1089
+ client, workspace_created = get_tinybird_local_client(config, test=test, staging=staging, branch=local_branch)
1090
+ if local_branch:
1091
+ ctx.ensure_object(dict)["local_branch"] = local_branch
1092
+ ctx.ensure_object(dict)["branch_created"] = workspace_created
1093
+ return client
1082
1094
 
1083
1095
 
1084
1096
  def get_target_env(cloud: bool, branch: Optional[str]) -> str:
@@ -363,7 +363,8 @@ def _get_tb_client(
363
363
  branch: Optional[str] = None,
364
364
  create_branch_if_missing: bool = False,
365
365
  request_from: Optional[str] = None,
366
- ) -> TinyB:
366
+ ) -> Tuple[TinyB, bool]:
367
+ """Returns a tuple of (client, branch_created)."""
367
368
  resolved_request_from = request_from
368
369
  disable_ssl: bool = getenv_bool("TB_DISABLE_SSL_CHECKS", False)
369
370
  cloud_client = TinyB(
@@ -377,8 +378,9 @@ def _get_tb_client(
377
378
  )
378
379
 
379
380
  if not branch:
380
- return cloud_client
381
+ return cloud_client, False
381
382
 
383
+ branch_created = False
382
384
  workspaces = cloud_client.user_workspaces_and_branches(version="v1")
383
385
  workspace = next((w for w in workspaces.get("workspaces", []) if w.get("name") == branch), None)
384
386
  if not workspace and create_branch_if_missing:
@@ -396,6 +398,7 @@ def _get_tb_client(
396
398
 
397
399
  workspaces = cloud_client.user_workspaces_and_branches(version="v1")
398
400
  workspace = next((w for w in workspaces.get("workspaces", []) if w.get("name") == branch), None)
401
+ branch_created = True
399
402
 
400
403
  if not workspace:
401
404
  raise CLIException(FeedbackManager.error_exception(error=f"Branch {branch} not found"))
@@ -408,7 +411,7 @@ def _get_tb_client(
408
411
  send_telemetry=True,
409
412
  staging=staging,
410
413
  request_from=resolved_request_from,
411
- )
414
+ ), branch_created
412
415
 
413
416
 
414
417
  def create_tb_client(ctx: Context) -> TinyB:
@@ -416,7 +419,8 @@ def create_tb_client(ctx: Context) -> TinyB:
416
419
  token = obj["config"].get("token", "")
417
420
  host = obj["config"].get("host", DEFAULT_API_HOST)
418
421
  request_from = obj.get("project_type")
419
- return _get_tb_client(token, host, request_from=request_from)
422
+ client, _ = _get_tb_client(token, host, request_from=request_from)
423
+ return client
420
424
 
421
425
 
422
426
  def _analyze(filename: str, client: TinyB, format: str):
@@ -1679,7 +1683,7 @@ def run_aws_iamrole_connection_flow(
1679
1683
 
1680
1684
  if use_local:
1681
1685
  try:
1682
- local_client = get_tinybird_local_client(config)
1686
+ local_client, _ = get_tinybird_local_client(config)
1683
1687
  except Exception as e:
1684
1688
  click.echo(FeedbackManager.warning(message=f"Failed to initialize local client: {e}"))
1685
1689
  click.echo(FeedbackManager.warning(message="Continuing without local environment."))
@@ -2404,7 +2408,7 @@ def create_workspace_branch(
2404
2408
  if not branch_name:
2405
2409
  click.echo(FeedbackManager.info_workspace_branch_create_greeting())
2406
2410
  default_name = f"{workspace['name']}_{uuid.uuid4().hex[0:4]}"
2407
- branch_name = click.prompt("\Branch name", default=default_name, err=True, type=str)
2411
+ branch_name = click.prompt("\nBranch name", default=default_name, err=True, type=str)
2408
2412
  assert isinstance(branch_name, str)
2409
2413
 
2410
2414
  response = config.get_client().create_workspace_branch(
@@ -114,7 +114,7 @@ def _clean_error_message(error: str) -> str:
114
114
 
115
115
  def get_local_info(config: Dict[str, Any], silent: bool = False) -> Tuple[Iterable[Any], List[str]]:
116
116
  try:
117
- local_config = get_tinybird_local_config(config, test=False, silent=silent)
117
+ local_config, _ = get_tinybird_local_config(config, test=False, silent=silent)
118
118
  local_client = local_config.get_client(host=TB_LOCAL_ADDRESS, staging=False)
119
119
  user_email = local_config.get_user_email() or "No user email found"
120
120
  token = local_config.get_token() or "No token found"
@@ -47,14 +47,21 @@ TB_LOCAL_DEFAULT_WORKSPACE_NAME = "Tinybird_Local_Testing"
47
47
 
48
48
 
49
49
  def get_tinybird_local_client(
50
- config_obj: Dict[str, Any], test: bool = False, staging: bool = False, silent: bool = False
51
- ) -> TinyB:
52
- """Get a Tinybird client connected to the local environment."""
50
+ config_obj: Dict[str, Any],
51
+ test: bool = False,
52
+ staging: bool = False,
53
+ silent: bool = False,
54
+ branch: Optional[str] = None,
55
+ ) -> tuple[TinyB, bool]:
56
+ """Get a Tinybird client connected to the local environment.
57
+
58
+ Returns a tuple of (client, workspace_created).
59
+ """
53
60
  try:
54
- config = get_tinybird_local_config(config_obj, test=test, silent=silent)
61
+ config, workspace_created = get_tinybird_local_config(config_obj, test=test, silent=silent, branch=branch)
55
62
  client = config.get_client(host=TB_LOCAL_ADDRESS, staging=staging)
56
63
  load_secrets(config_obj.get("path", ""), client)
57
- return client
64
+ return client, workspace_created
58
65
  # if some of the API calls to tinybird local fail due to a JSONDecodeError, it means that container is running but it's unhealthy
59
66
  except json.JSONDecodeError:
60
67
  raise CLILocalException(
@@ -64,10 +71,14 @@ def get_tinybird_local_client(
64
71
  )
65
72
 
66
73
 
67
- def get_tinybird_local_config(config_obj: Dict[str, Any], test: bool = False, silent: bool = False) -> CLIConfig:
68
- """Craft a client config with a workspace name based on the path of the project files
74
+ def get_tinybird_local_config(
75
+ config_obj: Dict[str, Any], test: bool = False, silent: bool = False, branch: Optional[str] = None
76
+ ) -> tuple[CLIConfig, bool]:
77
+ """Craft a client config with a workspace name based on the path of the project files.
78
+
79
+ It uses the tokens from tinybird local.
69
80
 
70
- It uses the tokens from tinybird local
81
+ Returns a tuple of (config, workspace_created).
71
82
  """
72
83
  path = config_obj.get("path")
73
84
  config = CLIConfig.get_project_config()
@@ -75,6 +86,7 @@ def get_tinybird_local_config(config_obj: Dict[str, Any], test: bool = False, si
75
86
  user_token = tokens["user_token"]
76
87
  admin_token = tokens["admin_token"]
77
88
  default_token = tokens["workspace_admin_token"]
89
+ workspace_created = False
78
90
  # Create a new workspace if path is provided. This is used to isolate the build in a different workspace.
79
91
  if path:
80
92
  user_client = config.get_client(host=TB_LOCAL_ADDRESS, token=user_token)
@@ -92,6 +104,8 @@ def get_tinybird_local_config(config_obj: Dict[str, Any], test: bool = False, si
92
104
  )
93
105
 
94
106
  ws_name = get_test_workspace_name(path)
107
+ elif branch:
108
+ ws_name = branch
95
109
  else:
96
110
  ws_name = config.get("name") or config_obj.get("name") or get_build_workspace_name(path)
97
111
  if not ws_name:
@@ -120,6 +134,7 @@ def get_tinybird_local_config(config_obj: Dict[str, Any], test: bool = False, si
120
134
  ws = next((ws for ws in user_workspaces["workspaces"] if ws["name"] == ws_name), None)
121
135
  if not ws:
122
136
  raise AuthNoTokenException()
137
+ workspace_created = True
123
138
 
124
139
  ws_token = ws["token"]
125
140
  config.set_token(ws_token)
@@ -130,7 +145,7 @@ def get_tinybird_local_config(config_obj: Dict[str, Any], test: bool = False, si
130
145
  config.set_token_for_host(TB_LOCAL_ADDRESS, default_token)
131
146
 
132
147
  config.set_user_token(user_token)
133
- return config
148
+ return config, workspace_created
134
149
 
135
150
 
136
151
  def get_build_workspace_name(path: str) -> str:
@@ -62,11 +62,11 @@ def run_preview_cloud(
62
62
  check: bool,
63
63
  output: str,
64
64
  ) -> None:
65
- cloud_client = _get_tb_client(config.get("token", ""), config["host"])
65
+ cloud_client, _ = _get_tb_client(config.get("token", ""), config["host"])
66
66
  _delete_preview_branch_if_exists(cloud_client, preview_branch_name)
67
67
  _create_preview_branch(cloud_client, preview_branch_name)
68
68
 
69
- branch_client = _get_tb_client(
69
+ branch_client, _ = _get_tb_client(
70
70
  config.get("token", ""),
71
71
  config["host"],
72
72
  branch=preview_branch_name,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 4.4.2.dev0
3
+ Version: 4.4.3.dev0
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/forward/commands
6
6
  Author: Tinybird
@@ -52,6 +52,11 @@ The Tinybird command-line tool allows you to use all the Tinybird functionality
52
52
  Changelog
53
53
  ----------
54
54
 
55
+ 4.4.2
56
+ *******
57
+
58
+ - `Added` `tb build` and `tb dev` now display git branch, Tinybird branch name, and dashboard URL before building. In local mode, a separate workspace is created per git branch.
59
+
55
60
  4.4.1
56
61
  *******
57
62
 
File without changes