Skip to content

Build a lens: look at something, learn something (pick a domain you love) #404

Description

@LetsGetToWorkBro

We just merged an Open Library book lens (#199#399): look at a bookshelf, get ratings/edition info on the glass. The pattern is now proven and repeatable — so pick a domain you care about and build the lens for it.

What: a shop-provider plugin that answers a lookup from a free API and surfaces it through TasteLens, mirroring the Open Food Facts / Open Library connectors.

Pick a no-key API so anyone can run it:

  • 🎬 TVmaze (shows) · 🎨 Art Institute of Chicago (artworks) · 🎲 BoardGameGeek (games) · 🌍 REST Countries (flags/facts) · 🐦 iNaturalist (species) · 🎮 PokeAPI · 🍿 Open Trivia — all keyless. (Anything OpenAI-style needing a key works too, but keyless is friendlier to try live.)

Start here:

  • host-python/src/dreamlayer/plugins/openlibrary.py — the connector to mirror (freshly merged, so it reflects current API v2). Note the injected fetch_fn seam — that's what makes it testable offline.
  • host-python/src/dreamlayer/plugins/openfoodfacts.py — the original, same shape.
  • examples/hello-lens/ — the ten-minute plugin tutorial.
  • Register through ctx.add_shop_provider(fn); declare requires = ("network",); return {} when offline or on a miss (never throw into rank()).

Done means: a connector module + a test with a faked HTTP response (no network in CI — pass a lambda returning canned JSON, exactly like openlibrary's tests), an offline-returns-{} path, and a passing validation gate. Gate a rating on the source actually having one, so an unrated item never fakes a score. Sign your commits (git commit -s) — CI checks DCO.

No hardware needed — everything runs in the test suite.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions