Wire up SDK-owned init command with --folder support#12
Merged
Conversation
Instead of delegating 'tinybird init' to the tinybird CLI (which only creates config/CI files), the SDK now handles it directly and scaffolds Python template files (datasources.py, pipes.py, client.py). - Add 'init' to SDK-owned commands in CLI dispatcher - Support --folder to customize where templates are created - Support --force, --skip-login, --dev-mode flags - Bump version to 0.1.5 Amp-Thread-ID: https://ampcode.com/threads/T-019d1a2d-e5a7-77fb-b97e-e855f84a34a4 Co-authored-by: Amp <amp@ampcode.com>
- Run tinybird CLI init for the full interactive flow (dev mode, CI/CD templates, skills install, login) - Then create a single tinybird_resources.py template with datasources, endpoints, and client all in one file - Update tinybird.config.json include list with the resources file - Update workflow test to mock the CLI delegation Amp-Thread-ID: https://ampcode.com/threads/T-019d1a2d-e5a7-77fb-b97e-e855f84a34a4 Co-authored-by: Amp <amp@ampcode.com>
- Split tinybird_resources.py (definitions only) from client.py (Tinybird client) - Generate main.py with dotenv loading, ingest, and query examples - Import paths computed dynamically from --folder argument - Existing files are not overwritten unless --force is used Amp-Thread-ID: https://ampcode.com/threads/T-019d1a2d-e5a7-77fb-b97e-e855f84a34a4 Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019d1a2d-e5a7-77fb-b97e-e855f84a34a4 Co-authored-by: Amp <amp@ampcode.com>
When the user doesn't pass --folder but types a folder name in the tinybird CLI interactive prompt, read the include path from the generated tinybird.config.json to place SDK files in the right folder. Amp-Thread-ID: https://ampcode.com/threads/T-019d1a2d-e5a7-77fb-b97e-e855f84a34a4 Co-authored-by: Amp <amp@ampcode.com>
Member
Author
|
how to test: mkdir pyinit && cd pyinit && git init && git checkout -b tinybird_intro && uv init --name tinybird-sdk-python-samplee --python 3.13 && uv add git+https://github.com/tinybirdco/tinybird-sdk-python.git@wire-sdk-init-command && uv run tinybird init && uv run tinybird build && uv run tinybird --cloud open |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tinybird initwas delegating to thetinybirdCLI package, which only creates config/CI files but no Python SDK template files. Thesrc/tinybird/folder was left empty.This PR wires up the SDK's own
run_init(which already had templates) in the CLI dispatcher, sotinybird initnow scaffolds a working Python project.Usage
Files created
tinybird.config.json<folder>/datasources.pypage_viewsdatasource<folder>/pipes.pytop_pagesendpoint<folder>/client.pyChanges
initto SDK-owned commands (no longer delegated to tinybird CLI)--folderflag to customize template output directory--force,--skip-login,--dev-modeflagsTesting
All 100 existing tests pass. Manually verified:
tinybird init --folder src/tinybird --skip-logincreates all 4 filestinybird init --skip-login(no folder) uses defaultlib/pathtinybird init --helpshows correct usage