tinybird-cli 2.1.1.dev7__tar.gz → 2.1.1.dev8__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 (46) hide show
  1. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/PKG-INFO +6 -1
  2. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/__cli__.py +2 -2
  3. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/datafile.py +8 -8
  4. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/feedback_manager.py +22 -22
  5. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/tb_cli_modules/branch.py +44 -44
  6. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/tb_cli_modules/cicd.py +2 -2
  7. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/tb_cli_modules/cli.py +4 -4
  8. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/tb_cli_modules/common.py +25 -4
  9. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/tb_cli_modules/datasource.py +1 -1
  10. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird_cli.egg-info/PKG-INFO +6 -1
  11. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/setup.cfg +0 -0
  12. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/ch_utils/constants.py +0 -0
  13. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/ch_utils/engine.py +0 -0
  14. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/check_pypi.py +0 -0
  15. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/client.py +0 -0
  16. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/config.py +0 -0
  17. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/connector_settings.py +0 -0
  18. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/connectors.py +0 -0
  19. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/context.py +0 -0
  20. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/datatypes.py +0 -0
  21. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/sql.py +0 -0
  22. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/sql_template.py +0 -0
  23. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/sql_template_fmt.py +0 -0
  24. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/sql_toolset.py +0 -0
  25. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/syncasync.py +0 -0
  26. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/tb_cli.py +0 -0
  27. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/tb_cli_modules/auth.py +0 -0
  28. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/tb_cli_modules/config.py +0 -0
  29. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/tb_cli_modules/connection.py +0 -0
  30. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/tb_cli_modules/exceptions.py +0 -0
  31. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/tb_cli_modules/job.py +0 -0
  32. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/tb_cli_modules/pipe.py +0 -0
  33. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/tb_cli_modules/regions.py +0 -0
  34. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/tb_cli_modules/telemetry.py +0 -0
  35. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/tb_cli_modules/test.py +0 -0
  36. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
  37. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
  38. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/tb_cli_modules/token.py +0 -0
  39. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/tb_cli_modules/workspace.py +0 -0
  40. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/tb_cli_modules/workspace_members.py +0 -0
  41. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird/tornado_template.py +0 -0
  42. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird_cli.egg-info/SOURCES.txt +0 -0
  43. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird_cli.egg-info/dependency_links.txt +0 -0
  44. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird_cli.egg-info/entry_points.txt +0 -0
  45. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird_cli.egg-info/requires.txt +0 -0
  46. {tinybird-cli-2.1.1.dev7 → tinybird-cli-2.1.1.dev8}/tinybird_cli.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tinybird-cli
3
- Version: 2.1.1.dev7
3
+ Version: 2.1.1.dev8
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://docs.tinybird.co/cli.html
6
6
  Author: Tinybird
@@ -19,6 +19,11 @@ Changelog
19
19
 
20
20
  ---------
21
21
 
22
+ 2.1.1.dev8
23
+ ************
24
+
25
+ - `Changed` Use `tb branch` instead of `tb env`. `tb env` is still usable but deprecated and will be removed in the next version.
26
+
22
27
  2.1.1.dev7
23
28
  ************
24
29
 
@@ -4,5 +4,5 @@ __description__ = 'Tinybird Command Line Tool'
4
4
  __url__ = 'https://docs.tinybird.co/cli.html'
5
5
  __author__ = 'Tinybird'
6
6
  __author_email__ = 'support@tinybird.co'
7
- __version__ = '2.1.1.dev7'
8
- __revision__ = 'db1f43d'
7
+ __version__ = '2.1.1.dev8'
8
+ __revision__ = '96a93ca'
@@ -2682,7 +2682,7 @@ async def share_and_unshare_datasource(
2682
2682
  datasource_id = datasource.get("id", "")
2683
2683
  workspaces: List[Dict[str, Any]]
2684
2684
 
2685
- # In case we are pushing to an enviroment, we don't share the datasource
2685
+ # In case we are pushing to a branch, we don't share the datasource
2686
2686
  # FIXME: Have only once way to get the current workspace
2687
2687
  if current_ws:
2688
2688
  # Force to get all the workspaces the user can access
@@ -2693,7 +2693,7 @@ async def share_and_unshare_datasource(
2693
2693
  workspaces = workspace.get("workspaces", [])
2694
2694
 
2695
2695
  if workspace.get("is_branch", False):
2696
- click.echo(FeedbackManager.info_skipping_sharing_datasources_environment(datasource=datasource["name"]))
2696
+ click.echo(FeedbackManager.info_skipping_sharing_datasources_branch(datasource=datasource["name"]))
2697
2697
  return
2698
2698
 
2699
2699
  # We duplicate the client to use the user_token
@@ -3550,7 +3550,7 @@ async def folder_push(
3550
3550
  current_ws: Dict[str, Any] = next(
3551
3551
  (workspace for workspace in workspaces if config and workspace.get("id", ".") == config.get("id", "..")), {}
3552
3552
  )
3553
- is_environment = current_ws.get("is_branch", False)
3553
+ is_branch = current_ws.get("is_branch", False)
3554
3554
  has_semver = False
3555
3555
  if config and config.get("semver"):
3556
3556
  has_semver = True
@@ -3639,7 +3639,7 @@ async def folder_push(
3639
3639
  current_ws=current_ws,
3640
3640
  changed=changed,
3641
3641
  only_changes=only_changes or (deployment.is_git_release and has_semver),
3642
- skip_connectors=is_environment,
3642
+ skip_connectors=is_branch,
3643
3643
  fork_downstream=fork_downstream,
3644
3644
  is_internal=is_internal,
3645
3645
  )
@@ -3864,7 +3864,7 @@ async def folder_push(
3864
3864
  click.echo(FeedbackManager.info_pushing_fixtures())
3865
3865
 
3866
3866
  # We need to upload the fixtures even if there is no change
3867
- if is_environment:
3867
+ if is_branch:
3868
3868
  filenames = get_project_filenames(folder, with_vendor=True)
3869
3869
  to_run, dep_map, back_to_run, back_dep_map = await build_graph(
3870
3870
  filenames,
@@ -3876,7 +3876,7 @@ async def folder_push(
3876
3876
  verbose=verbose,
3877
3877
  workspace_lib_paths=workspace_lib_paths,
3878
3878
  current_ws=current_ws,
3879
- skip_connectors=is_environment,
3879
+ skip_connectors=is_branch,
3880
3880
  )
3881
3881
 
3882
3882
  processed = set()
@@ -3891,13 +3891,13 @@ async def folder_push(
3891
3891
  debug,
3892
3892
  folder,
3893
3893
  force,
3894
- mode="append" if is_environment else "replace",
3894
+ mode="append" if is_branch else "replace",
3895
3895
  )
3896
3896
  processed.add(name)
3897
3897
  for f in to_run:
3898
3898
  if f not in processed:
3899
3899
  await check_fixtures_data(
3900
- tb_client, to_run[f], debug, folder, force, mode="append" if is_environment else "replace"
3900
+ tb_client, to_run[f], debug, folder, force, mode="append" if is_branch else "replace"
3901
3901
  )
3902
3902
  else:
3903
3903
  if verbose:
@@ -194,15 +194,15 @@ class FeedbackManager:
194
194
  error_connection_create = error_message("Connection {connection_name} could not be created: {error}")
195
195
  error_workspace = error_message("Workspace {workspace} not found. use 'tb workspace ls' to list your workspaces")
196
196
  error_branch = error_message(
197
- "Environment {branch} not found. use 'tb env ls' to list your Environments, make sure you are authenticated using the right workspace token"
197
+ "Branch {branch} not found. use 'tb branch ls' to list your Branches, make sure you are authenticated using the right workspace token"
198
198
  )
199
199
  error_not_a_branch = error_message(
200
- "To use this command you need to be authenticated on an Environment. Use 'tb env ls' and 'tb env use' and retry the command."
200
+ "To use this command you need to be authenticated on a Branch. Use 'tb branch ls' and 'tb branch use' and retry the command."
201
201
  )
202
202
  error_not_allowed_in_branch = error_message(
203
- "You need to be in Main to run this command. Hint: run tb env use main to switch to Main"
203
+ "You need to be in Main to run this command. Hint: run `tb branch use main` to switch to Main"
204
204
  )
205
- error_not_allowed_in_main_branch = error_message("Command disabled for 'main' Environment")
205
+ error_not_allowed_in_main_branch = error_message("Command disabled for 'main' Branch")
206
206
  error_getting_region_by_index = error_message(
207
207
  "Unable to get region by index, list available regions using 'tb auth ls'"
208
208
  )
@@ -281,8 +281,8 @@ class FeedbackManager:
281
281
  error_init_release = error_message(
282
282
  "No release on workspace '{workspace}'. Hint: use 'tb init --git' to start working with git releases"
283
283
  )
284
- error_env_init_release = error_message(
285
- "Environment '{workspace}' not ready for deploy. Hint: use 'tb init --git' to start working with git releases and assure Environment is completely created using '--wait' on 'tb env create'"
284
+ error_branch_init_release = error_message(
285
+ "Branch '{workspace}' not ready for deploy. Hint: use 'tb init --git' to start working with git releases and assure Branch is completely created using '--wait' on 'tb branch create'"
286
286
  )
287
287
  error_commit_changes_to_init_release = error_message(
288
288
  "Data project has changes: 'git status -s {path}'\n\n{git_output} \n\n You need to commit your changes in the data project, then re-run 'tb init --git' to finish git initialization."
@@ -357,8 +357,8 @@ Ready? """
357
357
  )
358
358
 
359
359
  warning_no_test_results = warning_message("Warning: No test results to show")
360
- warning_using_environment_token = warning_message("** You're using the token defined in $TB_TOKEN.")
361
- warning_using_environment_host = warning_message("** You're using the token defined in $TB_HOST.")
360
+ warning_using_branch_token = warning_message("** You're using the token defined in $TB_TOKEN.")
361
+ warning_using_branch_host = warning_message("** You're using the token defined in $TB_HOST.")
362
362
 
363
363
  error_bigquery_improper_permissions = info_message(
364
364
  "** Error: no access detected. It might take a minute to detect the new permissions.\n"
@@ -420,7 +420,7 @@ Ready? """
420
420
  "Do you want to remove all pipes and Data Sources from this workspace?"
421
421
  )
422
422
  warning_confirm_delete_workspace = prompt_message("Do you want to remove {workspace_name} workspace?")
423
- warning_confirm_delete_branch = prompt_message("Do you want to remove '{branch}' Environment?")
423
+ warning_confirm_delete_branch = prompt_message("Do you want to remove '{branch}' Branch?")
424
424
  warning_confirm_delete_release = prompt_message("Do you want to remove Release {semver}?")
425
425
  warning_confirm_rollback_release = prompt_message("Do you want to rollback current Release {semver} to {rollback}?")
426
426
 
@@ -476,9 +476,9 @@ Ready? """
476
476
  )
477
477
  info_populate_job_result = info_message("** Populating job result\n {result}")
478
478
  info_populate_job_url = info_message("** Populating job url {url}")
479
- info_data_branch_job_url = info_message("** Environment job url {url}")
480
- info_regression_tests_branch_job_url = info_message("** Environment regression tests job url {url}")
481
- info_merge_branch_job_url = info_message("** Merge Environment deployment job url {url}")
479
+ info_data_branch_job_url = info_message("** Branch job url {url}")
480
+ info_regression_tests_branch_job_url = info_message("** Branch regression tests job url {url}")
481
+ info_merge_branch_job_url = info_message("** Merge Branch deployment job url {url}")
482
482
  info_copy_from_main_job_url = info_message("** Copy from 'main' Workspace to '{datasource_name}' job url {url}")
483
483
  info_copy_with_sql_job_url = info_message("** Copy with --sql `{sql}` to '{datasource_name}' job url {url}")
484
484
  info_populate_subset_job_url = info_message("** Populating (subset {subset}) job url {url}")
@@ -542,14 +542,14 @@ Ready? """
542
542
  info_progress_blocks = info_message("\N{egg} blocks")
543
543
  info_progress_current_blocks = info_message("\N{hatching chick} blocks")
544
544
  info_release_generated = info_message(
545
- "** Custom deployment files for Release {semver} generated. Edit the `ci-deploy.sh` file with the instructions to deploy the branch to a CI Environment and the `cd-deploy.sh` file with the instructions to deploy to the Main Environment after merge."
545
+ "** Custom deployment files for Release {semver} generated. Edit the `ci-deploy.sh` file with the instructions to deploy the branch to a CI Branch and the `cd-deploy.sh` file with the instructions to deploy to the Main Branch after merge."
546
546
  )
547
547
  info_jobs = info_message("** Jobs:")
548
548
  info_workspaces = info_message("** Workspaces:")
549
- info_branches = info_message("** Environments:")
549
+ info_branches = info_message("** Branches:")
550
550
  info_releases = info_message("** Releases:")
551
551
  info_current_workspace = info_message("** Current workspace:")
552
- info_current_branch = info_message("** Current Environment:")
552
+ info_current_branch = info_message("** Current Branch:")
553
553
  info_job = info_message(" ** Job: {job}")
554
554
  info_data_pushed = info_message("** Data pushed to {datasource}")
555
555
  info_materialized_datasource_created = info_message(
@@ -587,7 +587,7 @@ Ready? """
587
587
  "Now let's pick a starter template! 🐣\nStarter template are pre-built data projects for different use cases, that you can use as a starting point and then build on top of that.\nYou can bypass this step by supplying a value for the --starter-kit option."
588
588
  )
589
589
  info_workspace_branch_create_greeting = info_message(
590
- "Please enter the name for your new Environment. Remember the name you choose must be unique, you can add a suffix in case of collision.\nYou can bypass this step by supplying a value for the --name option."
590
+ "Please enter the name for your new Branch. Remember the name you choose must be unique, you can add a suffix in case of collision.\nYou can bypass this step by supplying a value for the --name option."
591
591
  )
592
592
  info_no_git_release_yet = info_message("\n** Initializing releases based on git for Workspace '{workspace}'")
593
593
  info_diff_resources_for_git_init = info_message(
@@ -612,8 +612,8 @@ Ready? """
612
612
  info_deleting_resource = info_message("** {dry_run}Deleting '{resource_name}'")
613
613
 
614
614
  info_cicd_generation_cancelled_by_user = info_message("** CI/CD files generation cancelled by user.")
615
- info_skipping_sharing_datasources_environment = info_message(
616
- "** Skipping sharing the datasoure {datasource} in an environment"
615
+ info_skipping_sharing_datasources_branch = info_message(
616
+ "** Skipping sharing the datasoure {datasource} in a Branch"
617
617
  )
618
618
  info_skipping_shared_with_entry = info_message(
619
619
  "** Skipping `SHARED_WITH` entry as the flag --user-token was not used"
@@ -755,20 +755,20 @@ Ready? """
755
755
  success_using_host = success_message("** Using host: {host} ({name})")
756
756
  success_workspace_created = success_message("** Workspace '{workspace_name}' has been created")
757
757
  success_workspace_branch_created = success_message(
758
- "** Environment '{branch_name}' from '{workspace_name}' has been created"
758
+ "** Branch '{branch_name}' from '{workspace_name}' has been created"
759
759
  )
760
760
  success_workspace_data_branch = success_message(
761
- "** Partitions from 'main' Workspace have been attached to the Environment"
761
+ "** Partitions from 'main' Workspace have been attached to the Branch"
762
762
  )
763
763
  success_workspace_data_branch_in_progress = success_message(
764
- "** Partitions from 'main' Workspace are being attached to the Environment in job {job_url}"
764
+ "** Partitions from 'main' Workspace are being attached to the Branch in job {job_url}"
765
765
  )
766
766
 
767
767
  success_workspace_deploying_template = success_message(
768
768
  "Deploying your new '{workspace_name}' workspace, using the '{template}' template:"
769
769
  )
770
770
  success_workspace_deleted = success_message("** Workspace '{workspace_name}' deleted")
771
- success_branch_deleted = success_message("** Environment '{branch_name}' deleted")
771
+ success_branch_deleted = success_message("** Branch '{branch_name}' deleted")
772
772
  success_workspace_user_added = success_message("** User {user} added to workspace '{workspace_name}'")
773
773
  success_workspace_users_added = success_message("** Users added to workspace '{workspace_name}'")
774
774
  success_workspace_user_removed = success_message("** User {user} removed from workspace '{workspace_name}'")
@@ -266,15 +266,15 @@ async def release_rm(semver: str, force: bool, yes: bool, dry_run: bool) -> None
266
266
 
267
267
 
268
268
  @cli.group()
269
- def env() -> None:
270
- """Environment commands. Environments is an experimental feature only available in beta. Running env commands without activation will return an error"""
269
+ def branch() -> None:
270
+ """Branch commands. Branches are an experimental feature only available in beta. Running branch commands without activation will return an error"""
271
271
  pass
272
272
 
273
273
 
274
- @env.command(name="ls")
274
+ @branch.command(name="ls")
275
275
  @coro
276
276
  async def branch_ls() -> None:
277
- """List all the environments available using the workspace token"""
277
+ """List all the branches available using the workspace token"""
278
278
 
279
279
  config = CLIConfig.get_project_config()
280
280
  _ = await try_update_config_with_remote(config, only_if_needed=True)
@@ -303,43 +303,43 @@ async def branch_ls() -> None:
303
303
  echo_safe_humanfriendly_tables_format_smart_table(table, column_names=columns)
304
304
 
305
305
 
306
- @env.command(name="use")
307
- @click.argument("env_name_or_id")
306
+ @branch.command(name="use")
307
+ @click.argument("branch_name_or_id")
308
308
  @coro
309
- async def branch_use(env_name_or_id: str) -> None:
310
- """Switch to another Environment (requires an admin token associated with a user). Use 'tb env ls' to list the Environments you can access"""
309
+ async def branch_use(branch_name_or_id: str) -> None:
310
+ """Switch to another Branch (requires an admin token associated with a user). Use 'tb branch ls' to list the Branches you can access"""
311
311
 
312
312
  config = CLIConfig.get_project_config()
313
313
 
314
- if env_name_or_id == MAIN_BRANCH:
314
+ if branch_name_or_id == MAIN_BRANCH:
315
315
  current_main_workspace = await get_current_main_workspace_temp(config)
316
316
  assert isinstance(current_main_workspace, dict)
317
317
  await switch_to_workspace_by_user_workspace_data(config, current_main_workspace)
318
318
  else:
319
- await switch_workspace(config, env_name_or_id, only_environments=True)
319
+ await switch_workspace(config, branch_name_or_id, only_environments=True)
320
320
 
321
321
 
322
- @env.command(name="current")
322
+ @branch.command(name="current")
323
323
  @coro
324
324
  async def branch_current() -> None:
325
- """Show the Environment you're currently authenticated to"""
325
+ """Show the Branch you're currently authenticated to"""
326
326
  config = CLIConfig.get_project_config()
327
327
  await print_current_branch(config)
328
328
 
329
329
 
330
- @env.command(name="create", short_help="Create a new Environment in the current 'main' Workspace")
331
- @click.argument("env_name", required=False)
330
+ @branch.command(name="create", short_help="Create a new Branch in the current 'main' Workspace")
331
+ @click.argument("branch_name", required=False)
332
332
  @click.option(
333
333
  "--last-partition",
334
334
  is_flag=True,
335
335
  default=False,
336
- help="Attach the last modified partition from 'main' to the new Environment",
336
+ help="Attach the last modified partition from 'main' to the new Branch",
337
337
  )
338
338
  @click.option(
339
339
  "--all",
340
340
  is_flag=True,
341
341
  default=False,
342
- help="Attach all data from 'main' to the new Environment. Use only if you actually need all the data in the Branch",
342
+ help="Attach all data from 'main' to the new Branch. Use only if you actually need all the data in the Branch",
343
343
  )
344
344
  @click.option(
345
345
  "-i",
@@ -357,26 +357,26 @@ async def branch_current() -> None:
357
357
  )
358
358
  @coro
359
359
  async def create_branch(
360
- env_name: Optional[str], last_partition: bool, all: bool, ignore_datasources: List[str], wait: bool
360
+ branch_name: Optional[str], last_partition: bool, all: bool, ignore_datasources: List[str], wait: bool
361
361
  ) -> None:
362
362
  if last_partition and all:
363
363
  raise CLIException(FeedbackManager.error_exception(error="Use --last-partition or --all but not both"))
364
- await create_workspace_branch(env_name, last_partition, all, list(ignore_datasources), wait)
364
+ await create_workspace_branch(branch_name, last_partition, all, list(ignore_datasources), wait)
365
365
 
366
366
 
367
- @env.command(name="rm", short_help="Removes an Environment from the Workspace. It can't be recovered.")
368
- @click.argument("env_name_or_id")
367
+ @branch.command(name="rm", short_help="Removes a Branch from the Workspace. It can't be recovered.")
368
+ @click.argument("branch_name_or_id")
369
369
  @click.option("--yes", is_flag=True, default=False, help="Do not ask for confirmation")
370
370
  @coro
371
- async def delete_branch(env_name_or_id: str, yes: bool) -> None:
372
- """Remove an Environment (not Main)"""
371
+ async def delete_branch(branch_name_or_id: str, yes: bool) -> None:
372
+ """Remove an Branch (not Main)"""
373
373
 
374
374
  config = CLIConfig.get_project_config()
375
375
  _ = await try_update_config_with_remote(config)
376
376
 
377
377
  client = config.get_client()
378
378
 
379
- if env_name_or_id == MAIN_BRANCH:
379
+ if branch_name_or_id == MAIN_BRANCH:
380
380
  raise CLIException(FeedbackManager.error_not_allowed_in_main_branch())
381
381
 
382
382
  try:
@@ -385,7 +385,7 @@ async def delete_branch(env_name_or_id: str, yes: bool) -> None:
385
385
  (
386
386
  workspace
387
387
  for workspace in workspace_branches
388
- if workspace["name"] == env_name_or_id or workspace["id"] == env_name_or_id
388
+ if workspace["name"] == branch_name_or_id or workspace["id"] == branch_name_or_id
389
389
  ),
390
390
  None,
391
391
  )
@@ -393,7 +393,7 @@ async def delete_branch(env_name_or_id: str, yes: bool) -> None:
393
393
  raise CLIBranchException(FeedbackManager.error_exception(error=str(e)))
394
394
 
395
395
  if not workspace_to_delete:
396
- raise CLIBranchException(FeedbackManager.error_branch(branch=env_name_or_id))
396
+ raise CLIBranchException(FeedbackManager.error_branch(branch=branch_name_or_id))
397
397
 
398
398
  if yes or click.confirm(FeedbackManager.warning_confirm_delete_branch(branch=workspace_to_delete["name"])):
399
399
  need_to_switch_to_main = workspace_to_delete.get("main") and config["id"] == workspace_to_delete["id"]
@@ -419,21 +419,21 @@ async def delete_branch(env_name_or_id: str, yes: bool) -> None:
419
419
  raise CLIException(FeedbackManager.error_switching_to_main())
420
420
 
421
421
 
422
- @env.command(
422
+ @branch.command(
423
423
  name="data",
424
- short_help="Perform a data branch operation to bring data into the current Environment. Check flags for details",
424
+ short_help="Perform a data branch operation to bring data into the current Branch. Check flags for details",
425
425
  )
426
426
  @click.option(
427
427
  "--last-partition",
428
428
  is_flag=True,
429
429
  default=False,
430
- help="Attach the last modified partition from 'main' to the new Environment",
430
+ help="Attach the last modified partition from 'main' to the new Branch",
431
431
  )
432
432
  @click.option(
433
433
  "--all",
434
434
  is_flag=True,
435
435
  default=False,
436
- help="Attach all data from 'main' to the new Environment. Use only if you actually need all the data in the Environment",
436
+ help="Attach all data from 'main' to the new Branch. Use only if you actually need all the data in the Branch",
437
437
  )
438
438
  @click.option(
439
439
  "-i",
@@ -482,7 +482,7 @@ async def data_branch(last_partition: bool, all: bool, ignore_datasources: List[
482
482
  job_id = response["job"]["job_id"]
483
483
  job_url = response["job"]["job_url"]
484
484
  click.echo(FeedbackManager.info_data_branch_job_url(url=job_url))
485
- job_response = await wait_job(client, job_id, job_url, "Environment creation")
485
+ job_response = await wait_job(client, job_id, job_url, "Branch creation")
486
486
  response = job_response["result"]
487
487
  is_job = False
488
488
  is_summary = "partitions" in response
@@ -500,7 +500,7 @@ async def data_branch(last_partition: bool, all: bool, ignore_datasources: List[
500
500
  raise CLIBranchException(FeedbackManager.error_exception(error=str(e)))
501
501
 
502
502
 
503
- @env.group("regression-tests", invoke_without_command=True)
503
+ @branch.group("regression-tests", invoke_without_command=True)
504
504
  @click.option(
505
505
  "-f",
506
506
  "--filename",
@@ -518,20 +518,20 @@ async def data_branch(last_partition: bool, all: bool, ignore_datasources: List[
518
518
  "--skip-regression-tests/--no-skip-regression-tests",
519
519
  envvar="TB_SKIP_REGRESSION",
520
520
  default=False,
521
- help="Flag to skip execution of regression tests. This is handy for CI environments where regression might be flaky",
521
+ help="Flag to skip execution of regression tests. This is handy for CI branches where regression might be flaky",
522
522
  )
523
523
  @click.option(
524
524
  "--main",
525
525
  is_flag=True,
526
526
  default=False,
527
- help="Run regression tests in the main Environment. For this flag to work all the resources in the Environment pipe endpoints need to exist in the main Environment.",
527
+ help="Run regression tests in the main Branch. For this flag to work all the resources in the Branch pipe endpoints need to exist in the main Branch.",
528
528
  )
529
529
  @click.pass_context
530
530
  @coro
531
531
  async def regression_tests(
532
532
  ctx, filename: str, wait: bool, skip_regression_tests: Optional[bool] = False, main: Optional[bool] = False
533
533
  ):
534
- """Regression test commands for Environments"""
534
+ """Regression test commands for Branches"""
535
535
  if skip_regression_tests:
536
536
  click.echo(FeedbackManager.warning_regression_skipped())
537
537
  return
@@ -633,7 +633,7 @@ async def _run_regression(
633
633
 
634
634
  @regression_tests.command(
635
635
  name="coverage",
636
- short_help="Run regression tests using coverage requests for Environment vs Main Workspace. It creates a regression-tests job. The argument pipe_name supports regular expressions. Using '.*' if no pipe_name is provided",
636
+ short_help="Run regression tests using coverage requests for Branch vs Main Workspace. It creates a regression-tests job. The argument pipe_name supports regular expressions. Using '.*' if no pipe_name is provided",
637
637
  )
638
638
  @click.argument("pipe_name", required=False)
639
639
  @click.option(
@@ -694,13 +694,13 @@ async def _run_regression(
694
694
  "--skip-regression-tests/--no-skip-regression-tests",
695
695
  envvar="TB_SKIP_REGRESSION",
696
696
  default=False,
697
- help="Flag to skip execution of regression tests. This is handy for CI environments where regression might be flaky",
697
+ help="Flag to skip execution of regression tests. This is handy for CI branches where regression might be flaky",
698
698
  )
699
699
  @click.option(
700
700
  "--main",
701
701
  is_flag=True,
702
702
  default=False,
703
- help="Run regression tests in the main Environment. For this flag to work all the resources in the Environment pipe endpoints need to exist in the main Environment.",
703
+ help="Run regression tests in the main Branch. For this flag to work all the resources in the Branch pipe endpoints need to exist in the main Branch.",
704
704
  )
705
705
  @coro
706
706
  async def coverage(
@@ -736,7 +736,7 @@ async def coverage(
736
736
 
737
737
  @regression_tests.command(
738
738
  name="last",
739
- short_help="Run regression tests using last requests for Environment vs Main Workspace. It creates a regression-tests job. The argument pipe_name supports regular expressions. Using '.*' if no pipe_name is provided",
739
+ short_help="Run regression tests using last requests for Branch vs Main Workspace. It creates a regression-tests job. The argument pipe_name supports regular expressions. Using '.*' if no pipe_name is provided",
740
740
  )
741
741
  @click.argument("pipe_name", required=False)
742
742
  @click.option(
@@ -805,7 +805,7 @@ async def coverage(
805
805
  "--skip-regression-tests/--no-skip-regression-tests",
806
806
  envvar="TB_SKIP_REGRESSION",
807
807
  default=False,
808
- help="Flag to skip execution of regression tests. This is handy for CI environments where regression might be flaky",
808
+ help="Flag to skip execution of regression tests. This is handy for CI branches where regression might be flaky",
809
809
  )
810
810
  @coro
811
811
  async def last(
@@ -841,7 +841,7 @@ async def last(
841
841
 
842
842
  @regression_tests.command(
843
843
  name="manual",
844
- short_help="Run regression tests using manual requests for Environment vs Main Workspace. It creates a regression-tests job. The argument pipe_name supports regular expressions. Using '.*' if no pipe_name is provided",
844
+ short_help="Run regression tests using manual requests for Branch vs Main Workspace. It creates a regression-tests job. The argument pipe_name supports regular expressions. Using '.*' if no pipe_name is provided",
845
845
  context_settings=dict(allow_extra_args=True, ignore_unknown_options=True),
846
846
  )
847
847
  @click.argument("pipe_name", required=False)
@@ -903,7 +903,7 @@ async def last(
903
903
  "--skip-regression-tests/--no-skip-regression-tests",
904
904
  envvar="TB_SKIP_REGRESSION",
905
905
  default=False,
906
- help="Flag to skip execution of regression tests. This is handy for CI environments where regression might be flaky",
906
+ help="Flag to skip execution of regression tests. This is handy for CI branches where regression might be flaky",
907
907
  )
908
908
  @click.pass_context
909
909
  @coro
@@ -939,9 +939,9 @@ async def manual(
939
939
  )
940
940
 
941
941
 
942
- @env.group()
942
+ @branch.group()
943
943
  def datasource() -> None:
944
- """Environment data source commands."""
944
+ """Branch data source commands."""
945
945
 
946
946
 
947
947
  @datasource.command(name="copy")
@@ -949,7 +949,7 @@ def datasource() -> None:
949
949
  @click.option(
950
950
  "--sql",
951
951
  default=None,
952
- help="Freeform SQL query to select what is copied from Main into the Environment Data Source",
952
+ help="Freeform SQL query to select what is copied from Main into the Branch Data Source",
953
953
  required=False,
954
954
  )
955
955
  @click.option(
@@ -41,7 +41,7 @@ GITHUB_CI_YML = """
41
41
  concurrency: ${{! github.workflow }}-${{! github.event.pull_request.number }}
42
42
 
43
43
  jobs:
44
- ci: # ci using environments from workspace '{{ workspace_name }}'
44
+ ci: # ci using branches from workspace '{{ workspace_name }}'
45
45
  uses: tinybirdco/ci/.github/workflows/ci.yml@{{ workflow_version }}
46
46
  with:
47
47
  tb_deploy: {{ tb_deploy }}
@@ -142,7 +142,7 @@ GITLAB_YML = """
142
142
  DATA_PROJECT_DIR: "{{ data_project_dir }}"
143
143
  TB_DEPLOY: "{{ tb_deploy }}"
144
144
 
145
- run_ci: # ci using environments from workspace '{{ workspace_name }}'
145
+ run_ci: # ci using branches from workspace '{{ workspace_name }}'
146
146
  extends: .run_ci
147
147
  rules:
148
148
  - *ci_config_rule
@@ -820,7 +820,7 @@ async def fmt(
820
820
  "--main",
821
821
  is_flag=True,
822
822
  default=False,
823
- help="Diffs local datafiles to the corresponding remote files in the main workspace. Only works when authenticated on an Environment.",
823
+ help="Diffs local datafiles to the corresponding remote files in the main workspace. Only works when authenticated on a Branch.",
824
824
  hidden=True,
825
825
  )
826
826
  @click.pass_context
@@ -1483,15 +1483,15 @@ async def deploy(
1483
1483
  )
1484
1484
 
1485
1485
  semver = config.get("semver")
1486
- is_environment = current_ws.get("is_branch")
1486
+ is_branch = current_ws.get("is_branch")
1487
1487
  # FIXME: we need a better way
1488
- auto_promote = (is_environment and current_ws.get("name", "").startswith("tmp_ci")) or auto_promote
1488
+ auto_promote = (is_branch and current_ws.get("name", "").startswith("tmp_ci")) or auto_promote
1489
1489
  release = current_ws.get("release", {})
1490
1490
  current_semver: Optional[str] = "no release in remote Workspace"
1491
1491
  if release and isinstance(release, dict):
1492
1492
  current_semver = release.get("semver")
1493
1493
 
1494
- if not is_environment:
1494
+ if not is_branch:
1495
1495
  # TODO upload fixtures on tb test
1496
1496
  fixtures = False
1497
1497
  click.echo(FeedbackManager.info_fixtures_branch())
@@ -226,7 +226,28 @@ async def get_current_workspace_branches(config: CLIConfig) -> List[Dict[str, An
226
226
  return [branch for branch in branches if branch.get("main") == current_main_workspace["id"]]
227
227
 
228
228
 
229
- class CatchAuthExceptions(click.Group):
229
+ class AliasedGroup(click.Group):
230
+ def get_command(self, ctx, cmd_name):
231
+ # Step one: built-in commands as normal
232
+ cm = click.Group.get_command(self, ctx, cmd_name)
233
+ if cm is not None:
234
+ return cm
235
+
236
+ if cmd_name == "env":
237
+ deprecation_notice = FeedbackManager.warning_deprecated(
238
+ warning="'tb env' is deprecated, use 'tb branch' instead. 'tb env' will be removed in the next 3.0.0 release, please update your scripts."
239
+ )
240
+ click.echo(deprecation_notice)
241
+
242
+ return click.Group.get_command(self, ctx, "branch")
243
+
244
+ def resolve_command(self, ctx, args):
245
+ # always return the command's name, not the alias
246
+ _, cmd, args = super().resolve_command(ctx, args)
247
+ return cmd.name, cmd, args
248
+
249
+
250
+ class CatchAuthExceptions(AliasedGroup):
230
251
  """utility class to get all the auth exceptions"""
231
252
 
232
253
  def __init__(self, *args: Any, **kwargs: Any) -> None:
@@ -953,7 +974,7 @@ async def create_workspace_branch(
953
974
  if not branch_name:
954
975
  click.echo(FeedbackManager.info_workspace_branch_create_greeting())
955
976
  default_name = f"{workspace['name']}_{uuid.uuid4().hex[0:4]}"
956
- branch_name = click.prompt("\Environment name", default=default_name, err=True, type=str)
977
+ branch_name = click.prompt("\Branch name", default=default_name, err=True, type=str)
957
978
  assert isinstance(branch_name, str)
958
979
 
959
980
  response = await config.get_client().create_workspace_branch(
@@ -988,7 +1009,7 @@ async def create_workspace_branch(
988
1009
  assert isinstance(job_id, str)
989
1010
 
990
1011
  # Await the job to finish and get the result dict
991
- job_response = await wait_job(config.get_client(), job_id, job_url, "Environment creation")
1012
+ job_response = await wait_job(config.get_client(), job_id, job_url, "Branch creation")
992
1013
  if job_response is None:
993
1014
  raise CLIException(f"Empty job API response (job_id: {job_id}, job_url: {job_url})")
994
1015
  else:
@@ -1056,7 +1077,7 @@ async def print_branch_regression_tests_summary(client, job_id, host, response=N
1056
1077
  for step in response["progress"]:
1057
1078
  run = step["run"]
1058
1079
  if run.get("metrics_summary") and run.get("metrics_timing"):
1059
- column_names = [f"{run['pipe_name']}({run['test_type']})", "Origin", "Environment", "Delta"]
1080
+ column_names = [f"{run['pipe_name']}({run['test_type']})", "Origin", "Branch", "Delta"]
1060
1081
 
1061
1082
  click.echo(
1062
1083
  format_pretty_table(
@@ -741,7 +741,7 @@ async def datasource_exchange(ctx, datasource_a, datasource_b):
741
741
  @click.option(
742
742
  "--sql",
743
743
  default=None,
744
- help="Freeform SQL query to select what is copied from Main into the Environment Data Source",
744
+ help="Freeform SQL query to select what is copied from Main into the Branch Data Source",
745
745
  required=False,
746
746
  )
747
747
  @click.option(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tinybird-cli
3
- Version: 2.1.1.dev7
3
+ Version: 2.1.1.dev8
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://docs.tinybird.co/cli.html
6
6
  Author: Tinybird
@@ -19,6 +19,11 @@ Changelog
19
19
 
20
20
  ---------
21
21
 
22
+ 2.1.1.dev8
23
+ ************
24
+
25
+ - `Changed` Use `tb branch` instead of `tb env`. `tb env` is still usable but deprecated and will be removed in the next version.
26
+
22
27
  2.1.1.dev7
23
28
  ************
24
29