tinybird-cli 2.1.1.dev2__tar.gz → 2.1.1.dev4__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.dev2 → tinybird-cli-2.1.1.dev4}/PKG-INFO +11 -1
  2. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/__cli__.py +2 -2
  3. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/datafile.py +24 -5
  4. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/tb_cli_modules/cicd.py +61 -7
  5. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/tb_cli_modules/cli.py +6 -5
  6. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird_cli.egg-info/PKG-INFO +11 -1
  7. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/setup.cfg +0 -0
  8. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/ch_utils/constants.py +0 -0
  9. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/ch_utils/engine.py +0 -0
  10. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/check_pypi.py +0 -0
  11. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/client.py +0 -0
  12. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/config.py +0 -0
  13. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/connector_settings.py +0 -0
  14. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/connectors.py +0 -0
  15. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/context.py +0 -0
  16. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/datatypes.py +0 -0
  17. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/feedback_manager.py +0 -0
  18. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/sql.py +0 -0
  19. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/sql_template.py +0 -0
  20. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/sql_template_fmt.py +0 -0
  21. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/sql_toolset.py +0 -0
  22. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/syncasync.py +0 -0
  23. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/tb_cli.py +0 -0
  24. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/tb_cli_modules/auth.py +0 -0
  25. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/tb_cli_modules/branch.py +0 -0
  26. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/tb_cli_modules/common.py +0 -0
  27. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/tb_cli_modules/config.py +0 -0
  28. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/tb_cli_modules/connection.py +0 -0
  29. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/tb_cli_modules/datasource.py +0 -0
  30. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/tb_cli_modules/exceptions.py +0 -0
  31. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/tb_cli_modules/job.py +0 -0
  32. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/tb_cli_modules/pipe.py +0 -0
  33. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/tb_cli_modules/regions.py +0 -0
  34. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/tb_cli_modules/telemetry.py +0 -0
  35. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/tb_cli_modules/test.py +0 -0
  36. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
  37. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
  38. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/tb_cli_modules/token.py +0 -0
  39. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/tb_cli_modules/workspace.py +0 -0
  40. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/tb_cli_modules/workspace_members.py +0 -0
  41. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird/tornado_template.py +0 -0
  42. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird_cli.egg-info/SOURCES.txt +0 -0
  43. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird_cli.egg-info/dependency_links.txt +0 -0
  44. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird_cli.egg-info/entry_points.txt +0 -0
  45. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/tinybird_cli.egg-info/requires.txt +0 -0
  46. {tinybird-cli-2.1.1.dev2 → tinybird-cli-2.1.1.dev4}/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.dev2
3
+ Version: 2.1.1.dev4
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://docs.tinybird.co/cli.html
6
6
  Author: Tinybird
@@ -19,6 +19,16 @@ Changelog
19
19
 
20
20
  ---------
21
21
 
22
+ 2.1.1.dev4
23
+ ************
24
+
25
+ - `Fixed` `tb deploy` fixes to work with `--dry-run` and push changes of new and modified files
26
+
27
+ 2.1.1.dev3
28
+ ************
29
+
30
+ - `Changed` `tb init --git` update to get ready to use cicd with releases
31
+
22
32
  2.1.1.dev2
23
33
  ************
24
34
 
@@ -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.dev2'
8
- __revision__ = '0a4a8e6'
7
+ __version__ = '2.1.1.dev4'
8
+ __revision__ = 'b6aab87'
@@ -3254,7 +3254,7 @@ async def build_graph(
3254
3254
  dir_path = os.getcwd()
3255
3255
 
3256
3256
  if process_dependencies and only_changes:
3257
- all_resources, all_dep_map = await build_graph(
3257
+ all_resources, all_dep_map, _, _ = await build_graph(
3258
3258
  get_project_filenames(dir_path),
3259
3259
  tb_client,
3260
3260
  dir_path=dir_path,
@@ -3452,13 +3452,15 @@ async def build_graph(
3452
3452
  dep_map, downstream_dep_map, all_resources, to_run, dep_map_keys, key=None, visited=visited
3453
3453
  )
3454
3454
 
3455
+ old_dep_map = deepcopy(dep_map)
3456
+ old_to_run = deepcopy(to_run)
3455
3457
  new_dep_map = dep_map
3456
3458
  if all_dep_map and fork_downstream:
3457
3459
  downstream_dep_map = create_downstream_dependency_graph(all_dep_map, all_resources)
3458
3460
  new_dep_map = {}
3459
3461
  update_dep_map_recursively(new_dep_map, downstream_dep_map, all_resources, to_run, list(set(dep_map.keys())))
3460
3462
 
3461
- return to_run, new_dep_map
3463
+ return to_run, new_dep_map, old_to_run, old_dep_map
3462
3464
 
3463
3465
 
3464
3466
  async def get_changes_from_main(
@@ -3598,7 +3600,7 @@ async def folder_push(
3598
3600
 
3599
3601
  # build graph to get new versions for all the files involved in the query
3600
3602
  # dependencies need to be processed always to get the versions
3601
- resources, dep_map = await build_graph(
3603
+ resources, dep_map, _, back_dep_map = await build_graph(
3602
3604
  filenames,
3603
3605
  tb_client,
3604
3606
  dir_path=folder,
@@ -3625,7 +3627,7 @@ async def folder_push(
3625
3627
  latest_datasource_versions = {}
3626
3628
 
3627
3629
  # build the graph again with the right version
3628
- to_run, dep_map = await build_graph(
3630
+ to_run, dep_map, back_to_run, back_dep_map = await build_graph(
3629
3631
  filenames,
3630
3632
  tb_client,
3631
3633
  dir_path=folder,
@@ -3774,15 +3776,32 @@ async def folder_push(
3774
3776
  else:
3775
3777
  click.echo(FeedbackManager.warning_dry_name_already_exists(name=name))
3776
3778
 
3779
+ def is_new(name, changed):
3780
+ if changed and changed.get(name) == "A":
3781
+ return True
3782
+ return False
3783
+
3777
3784
  async def push_files(dry_run: bool = False):
3778
3785
  endpoints_dep_map = dict()
3779
3786
  pipes_dep_map = dict()
3780
3787
  mat_dep_map = dict()
3781
3788
  processed = set()
3782
3789
 
3790
+ groups = [group for group in toposort(back_dep_map)]
3791
+ for group in groups:
3792
+ for name in group:
3793
+ if not is_new(name, changed) or not fork_downstream:
3794
+ continue
3795
+ await push(
3796
+ name, back_to_run, resource_versions, latest_datasource_versions, dry_run, fork_downstream, fork
3797
+ )
3798
+ processed.add(name)
3799
+
3783
3800
  groups = [group for group in toposort(dep_map)]
3784
3801
  for group in groups:
3785
3802
  for name in group:
3803
+ if name in processed:
3804
+ continue
3786
3805
  # https://gitlab.com/tinybird/analytics/-/merge_requests/6737
3787
3806
  if is_endpoint_with_no_dependencies(to_run.get(name, {}), dep_map, to_run):
3788
3807
  endpoints_dep_map[name] = dep_map[name]
@@ -3847,7 +3866,7 @@ async def folder_push(
3847
3866
  # We need to upload the fixtures even if there is no change
3848
3867
  if is_environment:
3849
3868
  filenames = get_project_filenames(folder, with_vendor=True)
3850
- to_run, dep_map = await build_graph(
3869
+ to_run, dep_map, back_to_run, back_dep_map = await build_graph(
3851
3870
  filenames,
3852
3871
  tb_client,
3853
3872
  dir_path=folder,
@@ -38,8 +38,9 @@ GITHUB_CI_YML = """
38
38
 
39
39
  jobs:
40
40
  ci: # ci using environments from workspace '{{ workspace_name }}'
41
- uses: tinybirdco/ci/.github/workflows/ci.yml@v2.4.0
41
+ uses: tinybirdco/ci/.github/workflows/ci.yml@v2.5.1
42
42
  with:
43
+ tb_deploy: false
43
44
  data_project_dir: {{ data_project_dir }}
44
45
  secrets:
45
46
  tb_admin_token: ${{! secrets.TB_ADMIN_TOKEN }} # set the Workspace admin token in GitHub secrets
@@ -64,7 +65,7 @@ GITHUB_CD_YML = """
64
65
  - '{{ data_project_dir }}/**'{% end %}
65
66
  jobs:
66
67
  cd: # deploy changes to workspace '{{ workspace_name }}'
67
- uses: tinybirdco/ci/.github/workflows/cd.yml@v2.4.0
68
+ uses: tinybirdco/ci/.github/workflows/cd.yml@v2.5.1
68
69
  with:
69
70
  tb_deploy: false
70
71
  data_project_dir: {{ data_project_dir }}
@@ -73,6 +74,34 @@ GITHUB_CD_YML = """
73
74
  tb_host: {{ tb_host }}
74
75
  """
75
76
 
77
+ GITHUB_RELEASES_YML = """
78
+ ##################################################
79
+ ### Visit https://github.com/tinybirdco/ci ###
80
+ ### for more details or custom CI/CD ###
81
+ ##################################################
82
+
83
+ name: Tinybird - Releases Workflow
84
+
85
+ on:
86
+ workflow_dispatch:
87
+ inputs:
88
+ job_to_run:
89
+ description: 'Select the job to run manually'
90
+ required: true
91
+ default: 'promote'
92
+
93
+ jobs:
94
+ cd: # manage releases for workspace '{{ workspace_name }}'
95
+ uses: tinybirdco/ci/.github/workflows/release.yml@v2.5.0
96
+ with:
97
+ job_to_run: ${{! inputs.job_to_run }}
98
+ data_project_dir: {{ data_project_dir }}
99
+ tb_deploy: false
100
+ secrets:
101
+ tb_admin_token: ${{! secrets.TB_ADMIN_TOKEN }} # set the Workspace admin token in GitHub secrets
102
+ tb_host: {{ tb_host }}
103
+ """
104
+
76
105
 
77
106
  GITLAB_YML = """
78
107
  ##################################################
@@ -80,7 +109,7 @@ GITLAB_YML = """
80
109
  ### for more details or custom CI/CD ###
81
110
  ##################################################
82
111
 
83
- include: "https://raw.githubusercontent.com/tinybirdco/ci/v2.4.0/.gitlab/ci_cd.yaml"
112
+ include: "https://raw.githubusercontent.com/tinybirdco/ci/v2.5.1/.gitlab/ci_cd.yaml"
84
113
 
85
114
  .ci_config_rules:
86
115
  - &ci_config_rule
@@ -131,14 +160,34 @@ GITLAB_YML = """
131
160
  variables:
132
161
  <<: *cicd_variables
133
162
 
134
- cleanup_cd_env:
135
- extends: .cleanup_cd_branch
136
- needs: ["run_cd"]
137
- when: always
163
+ run_promote:
164
+ extends: .release_promote
165
+ dependencies: []
166
+ when: manual
138
167
  rules:
139
168
  - *cd_config_rule
140
169
  variables:
141
170
  <<: *cicd_variables
171
+
172
+ run_rollback:
173
+ extends: .release_rollback
174
+ dependencies: []
175
+ when: manual
176
+ rules:
177
+ - *cd_config_rule
178
+ variables:
179
+ <<: *cicd_variables
180
+
181
+ run_rm:
182
+ extends: .release_rm
183
+ dependencies: []
184
+ when: manual
185
+ rules:
186
+ - *cd_config_rule
187
+ variables:
188
+ <<: *cicd_variables
189
+
190
+
142
191
  """
143
192
 
144
193
 
@@ -192,6 +241,11 @@ class GitHubCICDGenerator(CICDGeneratorBase):
192
241
  template=GITHUB_CD_YML,
193
242
  file_name="tinybird_cd.yml",
194
243
  dir_path=".github/workflows",
244
+ ),
245
+ CICDFile(
246
+ template=GITHUB_RELEASES_YML,
247
+ file_name="tinybird_release.yml",
248
+ dir_path=".github/workflows",
195
249
  warning_message="Set TB_ADMIN_TOKEN in GitHub secrets. Use the Workspace admin token. Hint: use `tb token copy {token_id}` to copy clipboard",
196
250
  ),
197
251
  ]
@@ -913,7 +913,7 @@ async def sql(
913
913
 
914
914
  # build graph to get new versions for all the files involved in the query
915
915
  # dependencies need to be processed always to get the versions
916
- resources, dep_map = await build_graph(
916
+ resources, _, _, _ = await build_graph(
917
917
  filenames,
918
918
  client,
919
919
  dir_path=".",
@@ -930,7 +930,7 @@ async def sql(
930
930
  latest_datasource_versions[ds] = dep["version"]
931
931
 
932
932
  # build the graph again with the rigth version
933
- to_run, _ = await build_graph(
933
+ to_run, _, _, _ = await build_graph(
934
934
  filenames,
935
935
  client,
936
936
  dir_path=".",
@@ -1493,7 +1493,8 @@ async def deploy(
1493
1493
  click.echo(FeedbackManager.info_releases_detected(current_semver=current_semver, semver=semver))
1494
1494
  if version.parse(semver.split("-snapshot")[0]) > version.parse(current_semver.split("-snapshot")[0]):
1495
1495
  click.echo(FeedbackManager.info_create_release())
1496
- await create_release(client, config, semver)
1496
+ if not dry_run:
1497
+ await create_release(client, config, semver)
1497
1498
  release_created = True
1498
1499
  fork_downstream = True
1499
1500
  else:
@@ -1533,11 +1534,11 @@ async def deploy(
1533
1534
  release_created=release_created,
1534
1535
  )
1535
1536
  except Exception as e:
1536
- if release_created:
1537
+ if release_created and not dry_run:
1537
1538
  await client.release_failed(config["id"], semver)
1538
1539
  raise e
1539
1540
 
1540
- if release_created:
1541
+ if release_created and not dry_run:
1541
1542
  try:
1542
1543
  await client.release_preview(config["id"], semver)
1543
1544
  click.echo(FeedbackManager.success_release_preview(semver=semver))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tinybird-cli
3
- Version: 2.1.1.dev2
3
+ Version: 2.1.1.dev4
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://docs.tinybird.co/cli.html
6
6
  Author: Tinybird
@@ -19,6 +19,16 @@ Changelog
19
19
 
20
20
  ---------
21
21
 
22
+ 2.1.1.dev4
23
+ ************
24
+
25
+ - `Fixed` `tb deploy` fixes to work with `--dry-run` and push changes of new and modified files
26
+
27
+ 2.1.1.dev3
28
+ ************
29
+
30
+ - `Changed` `tb init --git` update to get ready to use cicd with releases
31
+
22
32
  2.1.1.dev2
23
33
  ************
24
34