|
| 1 | +# understand-quickly (Python SDK) |
| 2 | + |
| 3 | +A thin Python client for the [understand-quickly](https://looptech-ai.github.io/understand-quickly/) registry of code-knowledge graphs. |
| 4 | + |
| 5 | +```bash |
| 6 | +pip install understand-quickly |
| 7 | +``` |
| 8 | + |
| 9 | +- **Sync client** (zero runtime deps beyond `httpx`): `Registry` |
| 10 | +- **Async client** (using `httpx.AsyncClient`): `AsyncRegistry` |
| 11 | +- **CLI**: `python -m understand_quickly` or `understand-quickly` |
| 12 | +- 60-second in-memory TTL cache by default. |
| 13 | + |
| 14 | +## Quick examples |
| 15 | + |
| 16 | +```python |
| 17 | +from understand_quickly import Registry |
| 18 | + |
| 19 | +reg = Registry() # default registry: looptech-ai.github.io/understand-quickly |
| 20 | + |
| 21 | +# 1. List all healthy entries. |
| 22 | +entries = reg.list(status="ok") |
| 23 | + |
| 24 | +# 2. Filter by format. |
| 25 | +ua = reg.list(format="understand-anything@1") |
| 26 | + |
| 27 | +# 3. Resolve an entry id to its graph body. |
| 28 | +graph = reg.get_graph("Lum1104/Understand-Anything") |
| 29 | + |
| 30 | +# 4. Map a GitHub URL back to its registry entry. |
| 31 | +hit = reg.find_graph_for_repo("https://github.com/owner/repo") |
| 32 | + |
| 33 | +# 5. Cross-graph concept search (uses stats.json + entry metadata). |
| 34 | +results = reg.search("auth", scope="all") |
| 35 | +``` |
| 36 | + |
| 37 | +## Async equivalent |
| 38 | + |
| 39 | +```python |
| 40 | +import asyncio |
| 41 | +from understand_quickly import AsyncRegistry |
| 42 | + |
| 43 | +async def main() -> None: |
| 44 | + async with AsyncRegistry() as reg: |
| 45 | + entries = await reg.list(status="ok") |
| 46 | + graph = await reg.get_graph(entries[0]["id"]) |
| 47 | + print(len(graph.get("nodes", []))) |
| 48 | + |
| 49 | +asyncio.run(main()) |
| 50 | +``` |
| 51 | + |
| 52 | +## CLI |
| 53 | + |
| 54 | +``` |
| 55 | +understand-quickly list [--status ok] [--format understand-anything@1] [--owner OWNER] [--tag TAG] |
| 56 | +understand-quickly get-graph <entry_id> |
| 57 | +understand-quickly find <github_url_or_owner/repo> |
| 58 | +understand-quickly search <query> [--scope all|entries|concepts] |
| 59 | +understand-quickly stats |
| 60 | +``` |
| 61 | + |
| 62 | +JSON is emitted by default. Add `--pretty` for indented JSON (and a compact table for `list`). Both `python -m understand_quickly ...` and `understand-quickly ...` work after install. |
| 63 | + |
| 64 | +Exit codes: `0` success, `1` not-found (`get-graph`, `find`), `2` HTTP/parse error, `64` usage error. |
| 65 | + |
| 66 | +## Environment variables |
| 67 | + |
| 68 | +| Name | Purpose | Default | |
| 69 | +| --- | --- | --- | |
| 70 | +| `UNDERSTAND_QUICKLY_REGISTRY` | Override the registry base URL. | `https://looptech-ai.github.io/understand-quickly/` | |
| 71 | + |
| 72 | +The base URL can also be passed explicitly: `Registry("https://my-mirror.example/")`. |
| 73 | + |
| 74 | +## Public types |
| 75 | + |
| 76 | +`understand_quickly.types` exports `TypedDict` shapes for the documents this SDK fetches: |
| 77 | + |
| 78 | +- `Entry` — one registry entry (matches `registry.json`). |
| 79 | +- `Stats`, `StatsTotals`, `StatsKind`, `StatsLanguage`, `StatsConcept` — `stats.json` shape. |
| 80 | +- `WellKnown`, `WellKnownRepo` — `.well-known/repos.json` shape. |
| 81 | +- `SearchHit` — single result from `Registry.search()`. |
| 82 | +- `Graph` — opaque dict, shape depends on `entry["format"]`. |
| 83 | + |
| 84 | +Everything is `total=False` so you can rely on `entry.get("status")` returning safely. |
| 85 | + |
| 86 | +## Development |
| 87 | + |
| 88 | +```bash |
| 89 | +cd python-sdk |
| 90 | +python -m pip install -e ".[dev]" |
| 91 | +pytest -q |
| 92 | +python -m build . |
| 93 | +``` |
| 94 | + |
| 95 | +## Release notes |
| 96 | + |
| 97 | +See the project [release notes](https://github.com/looptech-ai/understand-quickly/releases) on GitHub. Python SDK versions are tagged `pysdk-vX.Y.Z`. |
| 98 | + |
| 99 | +## License |
| 100 | + |
| 101 | +[MIT](LICENSE) — Copyright (c) 2026 Alex Macdonald-Smith. |
0 commit comments