Skip to content

Wire native pull/login commands to CLI entry point - #26

Open
sandshoes wants to merge 2 commits into
mainfrom
tommy/protm-2257-wire-native-pull-login
Open

sandshoes wants to merge 2 commits into
mainfrom
tommy/protm-2257-wire-native-pull-login

Conversation

@sandshoes

Copy link
Copy Markdown
Contributor

Summary

  • tinybird pull and tinybird login now dispatch to the SDK's native run_pull/run_login implementations instead of shelling out to the upstream Forward tb package, matching the pattern used for build/deploy/dev in Wire native build/deploy/dev commands to CLI entry point #25.
  • pull gains -o/--output-dir (default .) and --force flags, documented in README.md's tinybird pull examples.
  • login wires straight to the existing browser OAuth flow with no new flags (README documents none).

Closes PROTM-2257: https://linear.app/tinybird/issue/PROTM-2257/python-sdk-wire-native-pulllogin-commands-to-cli-entry-point

Notes on standalone behavior (per the ticket's verification ask)

  • Both run_pull and run_login (and their dependencies auth.py, env.py, config.py) have zero imports from the upstream tinybird.tb package — confirmed by inspection. Login already worked standalone; this PR just stops routing it through the shell-out path.
  • This SDK does not use a .tinyb file (that's the Forward CLI's own config file). The native login flow persists to .env.local (TINYBIRD_TOKEN, TINYBIRD_URL) via env.py, and additionally updates an existing tinybird.config.json/tinybird.json if one is present, via config.py. Added tests/test_login_persistence.py to directly exercise this persistence (mocking only the network/browser side of browser_login), since the only prior coverage was of run_pull's workflow (tests/test_cli_workflows.py).

Testing

  • make lint, make typecheck, make test all green (160 tests passing, incl. 9 new).
  • make check's secrets/gitleaks target fails in this sandbox on an unrelated SSL/network error fetching its pre-commit environment — not caused by this change.

Checklist

  • CI is green (lint, typecheck, test, secrets)
  • pre-commit run --all-files passes locally
  • Tests were added or updated when behavior changed
  • Public API / typing changes were reviewed
  • Documentation was updated (README.md / CONTRIBUTING.md) if needed
  • Breaking changes are clearly documented
  • CHANGELOG.md was updated when user-facing behavior changed

`pull` and `login` now dispatch to the SDK's native run_pull/run_login
implementations instead of shelling out to the upstream Forward `tb`
package. Both already persist standalone (datafiles written directly
to disk; login writes TINYBIRD_TOKEN/TINYBIRD_URL to .env.local and
updates tinybird.config.json/tinybird.json when present), with no
dependency on tb being installed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ybird CLI

pull and login already work correctly via the real tb CLI delegation
path (main's SDK_OWNED_COMMANDS policy). Reimplementing them against
the raw API duplicates logic the installed CLI already owns and can
drift from its actual behavior (the installed CLI's login flow, token
storage, etc).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant