feat: analytics-agent quickstart — no-clone install via pip/uvx#27
Merged
Conversation
Users can now go from zero to a running agent with a single command: pip install datahub-analytics-agent && analytics-agent quickstart # or: uvx datahub-analytics-agent quickstart The interactive wizard prompts for LLM provider + API key, an optional data source connection, then bootstraps the DB, starts the server, and opens the browser. Config lives in ~/.datahub/analytics-agent/ alongside the DataHub CLI's own config. New CLI commands: quickstart Interactive setup wizard (idempotent — detects existing config) demo Full demo: DataHub quickstart + Olist MySQL + metadata ingestion start Start server from existing config (no wizard) stop Stop running server status Show PID and URL of running server logs Tail ~/.datahub/analytics-agent/logs/agent.log config Open config directory in \$EDITOR or print its path Server lifecycle managed via PID file at ~/.datahub/analytics-agent/agent.pid. DATABASE_URL and ENGINES_CONFIG now default to the config dir so a pip-installed package works out of the box without any local repo or .env file. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Two bugs prevented migrations from running during `analytics-agent quickstart`:
1. `python -m analytics_agent.cli bootstrap` was a no-op because cli.py had
no `if __name__ == "__main__"` block — Click never got invoked, subprocess
exited 0, and no tables were created.
2. `run_migrations()` called `Config("alembic.ini")` with a relative path that
only resolves from the repo root. For pip-installed users (no checked-out
repo) this silently produces an empty Alembic config and skips all migrations.
Fixed by deriving script_location from the installed package path, with
alembic.ini-in-CWD as a fallback for the dev/Docker workflow.
Also moved the "✓ Database initialised" echo to after bootstrap succeeds so
failures are no longer masked.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add two tests that would have caught the bugs fixed in the previous commit: - test_run_migrations_works_without_alembic_ini_in_cwd: verifies migrations run from a CWD with no alembic.ini (simulates pip-install environment). - test_cli_module_invocable_via_dash_m: verifies `python -m analytics_agent.cli bootstrap` actually runs migrations, catching the missing __main__ entry point. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Dockerfile was missing hatch_build.py in the COPY layer, causing `uv sync --no-dev` to fail with "Build script does not exist: hatch_build.py" - Remove unused `analytics_agent.config` import from test_cli.py (ruff F401) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- ingest_metadata.py: annotate payload as dict[str, object] so mypy accepts assigning a dict value alongside a str value (mypy was inferring dict[str, str] from the initial literal). - token-counting.spec.ts: the "Working" AgentWorkBlock state is only visible for ~320ms (4 mock events × 80ms). On slow CI the Playwright poller may miss this transient. Accept either "Working" or "Worked for" as the presence check; the final assertions (token badge, expand) still fully verify the feature. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
Users can now go from zero to a running analytics agent with a single copy-paste command — no git clone, no repo, no Docker required.
What the wizard does
~/.datahub/analytics-agent/alongside the DataHub CLI's own configIdempotent — re-running detects existing config and offers
start / reconfigure / cancel.New CLI commands
quickstartdemostartstopstatuslogs~/.datahub/analytics-agent/logs/agent.logconfig$EDITORConfig location
All user state lives under
~/.datahub/analytics-agent/:DATABASE_URLandENGINES_CONFIGnow default to the config dir so a pip-installed package works without any local.envfile.Demo mode
analytics-agent demoruns the full DataHub quickstart + loads the Olist e-commerce MySQL sample dataset + ingests metadata into DataHub — same experience as the existingquickstart.shbut triggered from the installed CLI.Test plan
pip install datahub-analytics-agent && analytics-agent quickstart— complete wizard, verify server starts and browser opensanalytics-agent quickstart— detects existing config, offers start/reconfigure/cancelanalytics-agent stop→analytics-agent statusshows not runninganalytics-agent start→ server restartsanalytics-agent logstails the log fileuv run pytest tests/unit/ -v— 170 tests passing🤖 Generated with Claude Code