Skip to content

Commit 475fd8b

Browse files
gnzjgoampcode-com
andcommitted
Always overwrite main.py and show all created files in output
Amp-Thread-ID: https://ampcode.com/threads/T-019d1a2d-e5a7-77fb-b97e-e855f84a34a4 Co-authored-by: Amp <amp@ampcode.com>
1 parent 45cfb6e commit 475fd8b

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

src/tinybird_sdk/cli/commands/init.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ class InitOptions:
128128
class InitResult:
129129
success: bool
130130
resources_path: str | None = None
131+
client_path: str | None = None
132+
main_path: str | None = None
131133
error: str | None = None
132134

133135

@@ -193,7 +195,8 @@ def run_init(options: InitOptions | dict[str, Any] | None = None) -> InitResult:
193195

194196
_write_file(resources_path, RESOURCES_TEMPLATE, normalized.force)
195197
_write_file(client_path, _client_template(resources_import), normalized.force)
196-
_write_file(main_path, _main_template(client_import), normalized.force)
198+
# Always overwrite main.py — the default from `uv init` is a placeholder
199+
_write_file(main_path, _main_template(client_import), force=True)
197200

198201
# 3. Add the resources file to tinybird.config.json include list
199202
config_path = find_existing_config_path(str(cwd))
@@ -212,6 +215,8 @@ def run_init(options: InitOptions | dict[str, Any] | None = None) -> InitResult:
212215
return InitResult(
213216
success=True,
214217
resources_path=str(resources_path.relative_to(cwd)),
218+
client_path=str(client_path.relative_to(cwd)),
219+
main_path=str(main_path.relative_to(cwd)),
215220
)
216221
except Exception as error:
217222
return InitResult(success=False, error=str(error))

src/tinybird_sdk/cli/index.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,13 @@ def main(argv: list[str] | None = None) -> int:
8989
output.error(result.error or "Init failed")
9090
return 1
9191

92+
output.success("\n✓ Python SDK files created:")
9293
if result.resources_path:
93-
output.success(f"\n✓ Python SDK resources created: {result.resources_path}")
94+
output.info(f" {result.resources_path}")
95+
if result.client_path:
96+
output.info(f" {result.client_path}")
97+
if result.main_path:
98+
output.info(f" {result.main_path}")
9499
return 0
95100

96101
if args.command == "generate":

0 commit comments

Comments
 (0)