Skip to content

feat(python): add Python Tasks TUI quickstart - #311

Open
Chris Draper (draper-ditto) wants to merge 1 commit into
mainfrom
chrisdraper/python-tui-quickstart
Open

feat(python): add Python Tasks TUI quickstart#311
Chris Draper (draper-ditto) wants to merge 1 commit into
mainfrom
chrisdraper/python-tui-quickstart

Conversation

@draper-ditto

Copy link
Copy Markdown

Adds python-tui, the Ditto Python SDK quickstart app: a Tasks console app on
the canonical cross-SDK tasks schema, so it syncs with the Swift, Kotlin, Go,
Rust, and JavaScript quickstarts.

This supersedes the python-tui half of the closed #303. The app was rewritten
against the shipped dittolive-ditto 5.2.0.dev0 preview; the ROS 2 quickstart
from that PR is not included here.

What's here

  • python-tui/main.py — the app, plus a --smoke mode that runs the full
    insert / update / rename / soft-delete path against a temporary local peer
    with no credentials and no network. That mode is what CI can run.
  • python-tui/README.md, .env.sample, pyproject.toml, .gitignore
  • justfile recipes: just python-tui and just python-tui-smoke
  • Root README.md index entry

Testing

Verified against dittolive-ditto 5.2.0.dev0 on macOS arm64 (Python 3.12):

  • uv run --with dittolive-ditto main.py --smoke — all six assertions pass
  • just python-tui-smoke — passes
  • pip path (python3 -m venv .venv + pip install dittolive-ditto, which
    resolves the pre-release) — passes
  • Live run with real Portal credentials: opens in syncing mode, and add /
    toggle / rename / delete all round-trip through the store observer

Note on dependency pinning

pyproject.toml requires dittolive-ditto>=5.2.0.dev0. Only pre-releases are
published on PyPI today, so this is the preview version; it will want a bump
when the Python SDK reaches GA.

Unblocks

mintlify-docs #703 — the Python quickstart page walks users through cloning this
repo and running python-tui, so it can't ship until this directory is on
main.

Revives the python-tui app from the closed PR #303, reconciled against the
shipped dittolive-ditto 5.2.0.dev0 preview API. Refs SDKS-4749.

Changes from #303:
- Use the repo's current .env contract (DITTO_DATABASE_ID /
  DITTO_DEVELOPMENT_TOKEN / DITTO_SERVER_URL) to match .env.sample and
  go-tui, rather than the older APP_ID/PLAYGROUND_TOKEN/AUTH_URL names.
- Drop the python-dotenv dependency; the SDK is now the only dependency.
- Fix DittoLogger.min_level -> DittoLogger.minimum_log_level (the real name
  is a metaclass property and does not appear in dir()).
- Only call sync.start() when configured against a server: starting sync
  requires an activated instance, so a license-free local peer raises
  DittoError <activation>. The store, subscriptions, and observers work
  without activation.
- Do not remove the persistence directory on exit; Ditto keeps writing to
  its rotating log directory under it until the process exits.
- Add a --smoke self-test that runs the full CRUD path with no credentials
  and no network, plus `just python-tui` / `just python-tui-smoke`.

Verified: --smoke passes on Python 3.10.21, 3.13.15, and 3.14.7 (macOS
arm64). Cloud sync against a Portal database is not yet verified.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 3, 2026 14:59
@draper-ditto
Chris Draper (draper-ditto) requested a review from a team as a code owner September 3, 2026 14:59
@draper-ditto
Chris Draper (draper-ditto) requested review from Alyssa Evans (alycda) and removed request for a team September 3, 2026 14:59
@datadog-official

Copy link
Copy Markdown

Pipelines

⚠️ Warnings

Your PR has failed checks. Please review the issues below and take necessary action before merging.

🚦 1 Pipeline job failed

Public mirror source | Publisher authorization

View in Datadog · View in GitHub Actions

Pull request by 'draper-ditto' is not accepted as this repository is read-only and only allows PRs from Ditto's SDK release process.

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: b4d01ce | Docs | View more details | Give us feedback!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The uv/pip run instructions and just recipes don’t consistently enforce the SDK version constraint declared in pyproject.toml, and the smoke-path observer timeout is likely too low for reliable CI execution.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds a new python-tui quickstart to the repo: a Python console “Tasks” app that uses the shared cross-SDK tasks schema and includes a credential-free --smoke mode intended for CI/self-test.

Changes:

  • Introduces the Python Tasks TUI app (python-tui/main.py) with offline/online configuration and a --smoke self-test path.
  • Adds Python TUI documentation and packaging metadata (python-tui/README.md, python-tui/pyproject.toml) plus local env/gitignore scaffolding.
  • Wires the quickstart into repo entry points (justfile recipes, root README.md index link).
File summaries
File Description
README.md Adds an index entry linking to the Python TUI quickstart.
python-tui/README.md Documents setup, running, commands, offline usage, and --smoke self-test.
python-tui/pyproject.toml Declares the quickstart as a minimal Python project with Ditto SDK dependency and script entrypoint.
python-tui/main.py Implements the Tasks app, Ditto configuration/auth flow, observer/subscription wiring, and smoke test.
python-tui/.gitignore Ignores local env/venv and Python build artifacts for the quickstart directory.
python-tui/.env.sample Provides a template for Portal-derived environment configuration.
justfile Adds just python-tui and just python-tui-smoke run recipes.
Review details

Suppressed comments (3)

python-tui/README.md:57

  • Similarly, pip install dittolive-ditto may not select the same minimum SDK version declared in pyproject.toml (and may skip pre-releases depending on index state). Pin the constraint to match the project dependency.
pip install dittolive-ditto

python-tui/README.md:94

  • The --smoke example should also apply the same Ditto SDK version constraint as pyproject.toml, otherwise it can run against an unintended version.
uv run --with dittolive-ditto main.py --smoke

justfile:58

  • Same issue for the smoke recipe: without the version constraint, uv may resolve a different SDK version than the project expects.
        uv run --with dittolive-ditto main.py --smoke
  • Files reviewed: 7/7 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread justfile

cd python-tui
if command -v uv >/dev/null 2>&1; then
uv run --with dittolive-ditto main.py
Comment thread python-tui/main.py
Comment on lines +231 to +236
async def _mutate(self, coro: Any) -> None:
"""Run a write, then wait for the observer to reflect it."""

self._updated.clear()
await coro
await self._wait_for_update(timeout=2.0)
Comment thread python-tui/README.md
Using [uv][1] (recommended — it installs Python and dependencies for you):

```bash
uv run --with dittolive-ditto main.py
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.

2 participants