lookbook.io.ingest
Turn a source spec into a stream of `ImageRef`s.
Phase 0 supports: a single directory path (recursive), a single file, or an already-iterable of refs. URL lists, zip archives, and cloud buckets are deferred to Phase 1+.
ingest_to_store (Phase 4) additionally records image_id -> {“path”: …} into stores.images so the HTTP layer can serve image bytes by id.
- lookbook.io.ingest.ingest(source: str | PathLike | Iterable[ImageRef]) list[ImageRef][source]
Materialize a source into a list of ImageRefs.
>>> import tempfile, os >>> with tempfile.TemporaryDirectory() as d: ... for name in ['a.jpg', 'b.png', 'note.txt']: ... open(os.path.join(d, name), 'wb').close() ... refs = ingest(d) >>> sorted(os.path.basename(r.path) for r in refs) ['a.jpg', 'b.png']
- lookbook.io.ingest.ingest_to_store(source: str | PathLike | Iterable[ImageRef], stores) list[ImageRef][source]
Ingest plus a side-effect: record image_id -> {“path”: …} for every PathImageRef into stores.images.
The HTTP layer relies on this mapping to serve image bytes by id. Returns the same list of refs ingest() would return.