tinybird-cli 6.5.5.dev0__py3-none-any.whl → 6.5.6.dev0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
tinybird/__cli__.py CHANGED
@@ -4,5 +4,5 @@ __description__ = 'Tinybird Command Line Tool'
4
4
  __url__ = 'https://www.tinybird.co/docs/cli'
5
5
  __author__ = 'Tinybird'
6
6
  __author_email__ = 'support@tinybird.co'
7
- __version__ = '6.5.5.dev0'
8
- __revision__ = '5d2bbc5'
7
+ __version__ = '6.5.6.dev0'
8
+ __revision__ = '5a6cd1d'
@@ -242,10 +242,11 @@ class FeedbackManager:
242
242
  error_organization_index = error_message(
243
243
  "Error selecting organization '{organization_index}'. Select a valid index or 0 to cancel"
244
244
  )
245
- warning_none_organization = warning_message(
246
- "Tinybird is now based on organizations. Please, go to the UI ({ui_host}) to follow the migration process. \nYour workspace will be created any way."
247
- )
248
245
  error_while_fetching_orgs = error_message("Error while fetching organizations: {error}")
246
+ error_classic_workspace_creation_deprecated = error_message(
247
+ "The Classic experience is deprecated. New workspaces should be created in Forward. "
248
+ "Migration guide: https://www.tinybird.co/docs/forward/guides/migrate-from-classic"
249
+ )
249
250
  error_deleted_include = error_message(
250
251
  "Related include file {include_file} was deleted and it's used in {filename}. Delete or remove dependency from {filename}."
251
252
  )
@@ -624,7 +624,14 @@ async def create_workspace_non_interactive(
624
624
  await fork_workspace(client, user_client, created_workspace)
625
625
 
626
626
  except Exception as e:
627
- raise CLIWorkspaceException(FeedbackManager.error_exception(error=str(e)))
627
+ message = str(e)
628
+ # The server (POST /v0/workspaces) rejects Classic workspace creation for
629
+ # non-enterprise organizations with this deprecation error. The API is the
630
+ # source of truth; we only reformat its message so it isn't buried behind a
631
+ # generic "Forbidden:" prefix. Matched on the stable migration-guide URL.
632
+ if "migrate-from-classic" in message:
633
+ raise CLIWorkspaceException(FeedbackManager.error_classic_workspace_creation_deprecated())
634
+ raise CLIWorkspaceException(FeedbackManager.error_exception(error=message))
628
635
 
629
636
 
630
637
  async def create_workspace_interactive(
@@ -2014,6 +2021,35 @@ async def get_organizations_by_user(ctx: Context, user_token: str) -> List[Dict[
2014
2021
  return organizations
2015
2022
 
2016
2023
 
2024
+ CLASSIC_WORKSPACE_CREATION_ALLOWED_ORGANIZATION_BILLING_PLANS = {
2025
+ "infrastructure_usage",
2026
+ "shared_infrastructure_usage_commitment",
2027
+ "mixed_infrastructure_usage",
2028
+ }
2029
+
2030
+
2031
+ def get_organization_billing_plan(organization: Dict[str, Any]) -> Optional[str]:
2032
+ plan = organization.get("plan")
2033
+ if isinstance(plan, dict):
2034
+ billing = plan.get("billing")
2035
+ return billing if isinstance(billing, str) else None
2036
+
2037
+ for field in ("billing", "commitment_billing"):
2038
+ billing = organization.get(field)
2039
+ if isinstance(billing, str):
2040
+ return billing
2041
+
2042
+ return None
2043
+
2044
+
2045
+ def get_classic_workspace_creation_organizations(organizations: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
2046
+ return [
2047
+ organization
2048
+ for organization in organizations
2049
+ if get_organization_billing_plan(organization) in CLASSIC_WORKSPACE_CREATION_ALLOWED_ORGANIZATION_BILLING_PLANS
2050
+ ]
2051
+
2052
+
2017
2053
  OrgType = Literal["tinybird", "domain", "admin", "member"]
2018
2054
 
2019
2055
 
@@ -22,6 +22,7 @@ from tinybird.tb_cli_modules.common import (
22
22
  create_workspace_interactive,
23
23
  create_workspace_non_interactive,
24
24
  echo_safe_humanfriendly_tables_format_smart_table,
25
+ get_classic_workspace_creation_organizations,
25
26
  get_current_main_workspace,
26
27
  get_organizations_by_user,
27
28
  is_valid_starterkit,
@@ -226,19 +227,22 @@ async def create_workspace(
226
227
 
227
228
  organization_name = None
228
229
  organizations = await get_organizations_by_user(ctx, user_token)
230
+ selectable_organizations = get_classic_workspace_creation_organizations(organizations)
229
231
 
230
232
  if organization_id:
231
233
  organization = next((org for org in organizations if org.get("id") == organization_id), None)
232
234
  if not organization:
233
235
  raise CLIWorkspaceException(FeedbackManager.error_organization_not_found(organization_id=organization_id))
234
236
  organization_name = organization.get("name")
235
- elif len(organizations) == 0:
236
- click.echo(FeedbackManager.warning_none_organization(ui_host=ui_host))
237
- elif len(organizations) == 1:
238
- organization_id = organizations[0].get("id")
239
- organization_name = organizations[0].get("name")
237
+ elif len(selectable_organizations) == 0:
238
+ # Let the API return the Classic deprecation error without printing the
239
+ # old organizations-migration warning that claimed creation would proceed.
240
+ organization_id = None
241
+ elif len(selectable_organizations) == 1:
242
+ organization_id = selectable_organizations[0].get("id")
243
+ organization_name = selectable_organizations[0].get("name")
240
244
  else:
241
- sorted_organizations = sort_organizations_by_user(organizations, user_email=config.get_user_email())
245
+ sorted_organizations = sort_organizations_by_user(selectable_organizations, user_email=config.get_user_email())
242
246
  current_organization = await ask_for_organization_interactively(sorted_organizations)
243
247
  if current_organization:
244
248
  organization_id = current_organization.get("id")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird_cli
3
- Version: 6.5.5.dev0
3
+ Version: 6.5.6.dev0
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/cli
6
6
  Author: Tinybird
@@ -43,6 +43,11 @@ The Tinybird command-line tool allows you to use all the Tinybird functionality
43
43
  Changelog
44
44
  ----------
45
45
 
46
+ 6.5.5
47
+ ***********
48
+
49
+ - `Changed` `tb workspace create` is now limited to organization in Enterprise plans
50
+
46
51
  6.5.4
47
52
  ***********
48
53
 
@@ -1,11 +1,11 @@
1
- tinybird/__cli__.py,sha256=t0TBFIN-TpEtJYQeeRTnQNGNWW_YRGoPNoiQHhSGUyk,236
1
+ tinybird/__cli__.py,sha256=PMxuorKe_Xy2j3umVAJ4ex9QkXGD2NqfgIn8SvmCbq8,236
2
2
  tinybird/check_pypi.py,sha256=_4NkharLyR_ELrAdit-ftqIWvOf7jZNPt3i76frlo9g,975
3
3
  tinybird/client.py,sha256=28AUgzb9zD7PqqMD8lrgXUEWIvZ0nZYuBO3stcG1iqw,53236
4
4
  tinybird/config.py,sha256=ltL9qIfY-tnFXeivrLLi7apS_OkzEJT_jRXAJu0SRQg,7164
5
5
  tinybird/context.py,sha256=o4yvlXPkMLmdh-XJl3wpmqPAMeRRz5ScKzKlHHKn_I8,1201
6
6
  tinybird/datafile_common.py,sha256=ntQ4tJWCIzqbIWctagi7B172KrA-JH8gAE7_kP2-AXo,237356
7
7
  tinybird/datatypes.py,sha256=DRScTI1-lgYjbC7u_4qxOLFleWL-vief_eBg_9WU37U,11304
8
- tinybird/feedback_manager.py,sha256=hbO4o16rleDxzfkv04fTeJIjAxlpn477qTK0QCuleTA,68274
8
+ tinybird/feedback_manager.py,sha256=2n0s6AMbjtFsELJN9pJnG5JjhM3lUueXBgF4mZ0WiCw,68318
9
9
  tinybird/git_settings.py,sha256=mqWgeboOlOFsSo97qyv595UCR2R1QCAqT4GTawBNPBg,3935
10
10
  tinybird/sql.py,sha256=L3tTmm62iTrf6WQdcV8mmwrCMitLFUvJ3OfDzyRTMGw,47385
11
11
  tinybird/sql_template.py,sha256=rgZxmP8lhfUmHjL1Z5JT0NTDEtVxK_5xRRzKiu5A868,131917
@@ -20,7 +20,7 @@ tinybird/tb_cli_modules/auth.py,sha256=3xu8STgouOgLkqlBf9LWFg9Oto_NyuDKsUWF95-zG
20
20
  tinybird/tb_cli_modules/branch.py,sha256=vbjLxIHz5XOqfMGwjyEZ7gji8Jw3PWPKKrPXViWdiIc,39348
21
21
  tinybird/tb_cli_modules/cicd.py,sha256=i2Mw8AbmEVNBcEPYdio7liy3PGqh1ezVFZ0OmJ9ww5o,13809
22
22
  tinybird/tb_cli_modules/cli.py,sha256=KvgZfdYRvgKG5QAiFmlfLbVGI-xmuxbs-EdkAslqrEQ,60242
23
- tinybird/tb_cli_modules/common.py,sha256=OzXkQGTnlUtOfx3EOdSLreewFRu_zaTXLSYDG-MT1_I,77236
23
+ tinybird/tb_cli_modules/common.py,sha256=uHlORodJBevn9fvIV02rUsB2P0nMOLjHG7OYDyPrKjw,78661
24
24
  tinybird/tb_cli_modules/config.py,sha256=lukiJeihI09blGeeS0FWeqVbKWhqzZmyoaJDIL0NkyQ,11182
25
25
  tinybird/tb_cli_modules/connection.py,sha256=JO2v2xTGoiMeThzCncvxMFUHLghyyGXNF0FcAvi5ZOk,24543
26
26
  tinybird/tb_cli_modules/datasource.py,sha256=dZShJUrNXEfj4160ix7G2KsIBim3n1fAxk5ryvmdmuA,38285
@@ -33,11 +33,11 @@ tinybird/tb_cli_modules/tag.py,sha256=S5x8uDW0rsJEI5lKH2mefro7tEzcHyDNWrV_ZWNyS1
33
33
  tinybird/tb_cli_modules/telemetry.py,sha256=W098H6jmS4kpE7hN3tadaREBTf7oMocel-lkKWN0pU8,10466
34
34
  tinybird/tb_cli_modules/test.py,sha256=Vf8oK96V81HdKGsT79y6MUz6oz_VrYIwTbRnzzJs4rQ,4350
35
35
  tinybird/tb_cli_modules/token.py,sha256=JXATKTlbXohP9ZDZjlz8E4VYG6zrknKZhuz_wh1zBBc,13793
36
- tinybird/tb_cli_modules/workspace.py,sha256=u8x-caZdRLYXIMdrFK9rtXZutMtd4T3exMRKg-pYBWw,12398
36
+ tinybird/tb_cli_modules/workspace.py,sha256=-GW_XZHPc5atVFUkYpXsl1G8t36jZyZ1B0UWAZYwSaA,12709
37
37
  tinybird/tb_cli_modules/workspace_members.py,sha256=ksXsjd233y9-sNlz4Qb-meZbX4zn1B84e_bSm2i8rhg,8731
38
38
  tinybird/tb_cli_modules/tinyunit/tinyunit.py,sha256=JrZQTb9NA-1kcL2Vm0JuDRNFdH8jcYYOM3ovJDVs28E,11063
39
- tinybird_cli-6.5.5.dev0.dist-info/METADATA,sha256=Wlt3ts99ZTUQsNOqUlvy3biBooW6UySQuoBKbco0dv4,83548
40
- tinybird_cli-6.5.5.dev0.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
41
- tinybird_cli-6.5.5.dev0.dist-info/entry_points.txt,sha256=PKPKuPmA4IfJYnCFHHUiw-aAWZuBomFvwCklv1OyCjE,43
42
- tinybird_cli-6.5.5.dev0.dist-info/top_level.txt,sha256=ZIQJTPCzMqnfDzM_hEGZrJqDSEcKnIK_49T86DGWpyQ,78
43
- tinybird_cli-6.5.5.dev0.dist-info/RECORD,,
39
+ tinybird_cli-6.5.6.dev0.dist-info/METADATA,sha256=Eb-1cwhtDSZVzIsf_DMwqy2NQ2_b_8Hht2vB7GnDlTo,83653
40
+ tinybird_cli-6.5.6.dev0.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
41
+ tinybird_cli-6.5.6.dev0.dist-info/entry_points.txt,sha256=PKPKuPmA4IfJYnCFHHUiw-aAWZuBomFvwCklv1OyCjE,43
42
+ tinybird_cli-6.5.6.dev0.dist-info/top_level.txt,sha256=ZIQJTPCzMqnfDzM_hEGZrJqDSEcKnIK_49T86DGWpyQ,78
43
+ tinybird_cli-6.5.6.dev0.dist-info/RECORD,,