Skip to content

feat(collection): optional progress bar for Collection.upsert (#10) - #118

Open
srijanarya wants to merge 2 commits into
supabase:mainfrom
srijanarya:feat/upsert-progress
Open

feat(collection): optional progress bar for Collection.upsert (#10)#118
srijanarya wants to merge 2 commits into
supabase:mainfrom
srijanarya:feat/upsert-progress

Conversation

@srijanarya

Copy link
Copy Markdown

Closes #10, scoped to upsert; create_index progress is left for a follow-up as discussed in the issue.

Adds an opt-in show_progress: bool = False parameter to Collection.upsert. When enabled:

  • Uses tqdm.auto, so it picks a notebook widget or a terminal bar automatically (the notebook-vs-shell problem raised in the issue).
  • Reports a known total when records is Sized (list, tuple, ...), and falls back to an indeterminate bar for generators and other unsized iterables.
  • tqdm is an optional extra (pip install vecs[progress]), not a new hard dependency, so pip install vecs is unchanged. Calling with show_progress=True without tqdm installed raises an ImportError with the install hint.
  • Default behaviour (show_progress=False) is unchanged.

Tests added in src/tests/test_upsert_progress.py for: default creates no progress object, sized input reports the total and updates per 500-record chunk, generator input is indeterminate and still updates per chunk, and the ImportError path when tqdm is absent. Full suite run locally against supabase/postgres:15.1.1.78: 44 passed; the 3 test_adapters.py text-embedding tests fail identically on main without the sentence-transformers extra installed.

…se#10)

Adds opt-in show_progress to Collection.upsert. Uses tqdm.auto so it
picks a notebook widget or terminal bar; reports a known total when
records is Sized, otherwise an indeterminate bar. tqdm is an optional
extra (vecs[progress]); default behaviour is unchanged.

Scoped to upsert; create_index progress is left for a follow-up.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Progress Bars

1 participant