fix(packaging): add keyring to [api] extra so gaia api + email wheel starts#1620
Conversation
Adds a packaging regression test that fails when setup.py[api] is missing keyring — the module reached via openai_server -> email_router -> gaia.connectors.api -> gaia.connectors.store at load time and via connected_mailbox_providers() at request time. Mirrors the structure of test_ui_extras.py (#845) exactly: parses setup.py line-by-line to avoid bracket-in-comment false matches.
…nt-email starts (#1617) gaia api auto-mounts the gaia-agent-email REST router when that wheel is importable; its import chain (openai_server -> email_router -> gaia.connectors.api -> gaia.connectors.store) does `import keyring` at module load AND inside connected_mailbox_providers() at request time. keyring was only in [ui]/[dev], so `pip install 'amd-gaia[api]' gaia-agent-email` crashed on startup. Adds the same pin as [ui]/[dev] (>=24.0.0,<26.0.0).
Review: fix(packaging): add keyring to
|
…o-get keyring (#1617) gaia-agent-email declared a bare `amd-gaia>=0.20.0` dependency, so a consuming app's `pip install gaia-agent-email` could resolve core without the [api] extra — leaving the REST-server deps (fastapi/uvicorn) and keyring absent and `gaia api` crashing. Depend on `amd-gaia[api]` so those come along automatically; closes the "consumer forgot [api]" half of #1617. Guard test added. Floor stays >=0.20.0 (core is 0.20.1); raise to >=0.21.0 once that release ships keyring-in-[api].
… guard (#1617) test_every_wheel_declares_amd_gaia_dependency did a naive `'amd-gaia>=' in text` check; the email wheel now declares `amd-gaia[api]>=0.20.0` (so consumers auto-get the REST-server deps + keyring), which the literal substring missed. Match `amd-gaia(\[extras\])?>=` instead — the invariant (every wheel pins amd-gaia with a >= floor) still holds.
|
CI fix pushed (478d482). The unit-test failures (py3.10/3.11/3.12 + macOS smoke) were all the same test — The Lemonade Embeddings API and CLI Full Integration failures are external infra, not this change — PyTorch mirror Re: the 🟢 follow-up — agreed. |
amd#1622) A bare `pip install amd-gaia` (no extras) ships `gaia connectors` as a base command, but `keyring` lives only in the `[ui]`/`[api]`/`[dev]` extras — so `gaia connectors list`/`status` and the provider-credential paths crashed with a raw `ModuleNotFoundError: No module named 'keyring'` that named neither the cause nor the fix. Now those subcommands fail loudly with an actionable `ConnectorsError` — `gaia connectors needs the 'keyring' package … pip install keyring (or pip install "amd-gaia[ui]")` — which the CLI prints to stderr instead of a traceback. This is the base-CLI half of the gap amd#1617/amd#1620 fixed for the `[api]` partner recipe. It implements the issue's Option 3 (guarded import) — the part the issue itself calls "worth doing regardless." The larger base-dep-vs-`[connectors]`-extra packaging decision (Options 1/2) is **left to a maintainer** (flagged for @kovtcharov-amd in the issue); this guard holds regardless of where `keyring` ultimately lands, and on its own satisfies the issue's acceptance branch "*fails with an actionable error naming the exact install command.*" Refs amd#1621 ## Test plan - [ ] `python -m pytest tests/unit/connectors/test_keyring_guard.py -x` passes (new regression guard: import without `keyring` → `ConnectorsError` naming `pip install`; with `keyring` → real module re-exported) - [ ] `python -m pytest tests/unit/connectors/ -x` passes (no regression in store/mcp_server keyring usage) - [ ] `python util/lint.py --all` passes - [ ] Manual: in a venv with **no** `keyring` installed, `gaia connectors list` prints `Connectors error: gaia connectors needs the 'keyring' package … pip install keyring …` and exits non-zero (instead of a `ModuleNotFoundError` traceback) Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Tomasz Iniewicz <itomek@users.noreply.github.com>
Why this matters
The documented Milestone-40 partner recipe —
pip install 'amd-gaia[api]' gaia-agent-email, thengaia api— crashed at server startup withModuleNotFoundError: No module named 'keyring', before serving a single request.gaia apiauto-mounts the email wheel's REST router, and that import chain reaches a module-levelimport keyringingaia.connectors.store(also hit at request time viaconnected_mailbox_providers()) — butkeyringwas declared only in the[ui]/[dev]extras, never[api]. So the one install combo the partner path depends on couldn't even boot; 0.20.1 only masks it because its server doesn't mount the email router yet.After this change
[api]carrieskeyring(same pin as[ui]/[dev]), so the documented install starts and serves local LLM triage with zero manual installs. Needs to land before the v0.21.0 tag. A packaging guard (tests/unit/test_api_extras.py, mirroringtest_ui_extras.py) fails if[api]ever drops keyring again.Test plan
main(keyring absent from[api]), green with the fix.pytest tests/unit/test_api_extras.py tests/unit/test_packaging.py tests/unit/test_ui_extras.py→ 13 passed;python util/lint.py --all→ clean.git+recipe:main):from gaia.api.openai_server import app→ModuleNotFoundError: No module named 'keyring'atstore.py:38(keyring not installed).[api]→ import clean → uvicorn boots →POST /v1/email/triage→ 200 with LLM triage (categoryactionable, summary echoing the planted$4,820 / INV-90871 / Thursday 3pmfacts, action item + draft reply).Out of scope: AC3 (partner guide stating the exact install line) is tracked by #1597, and depends on #1601 publishing the
gaia-agent-emailwheel.Closes #1617.
Related: #1602, #1590, #1597, #915, #1179.