feat(collection): optional progress bar for Collection.upsert (#10) - #118
Open
srijanarya wants to merge 2 commits into
Open
feat(collection): optional progress bar for Collection.upsert (#10)#118srijanarya wants to merge 2 commits into
srijanarya wants to merge 2 commits into
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #10, scoped to
upsert;create_indexprogress is left for a follow-up as discussed in the issue.Adds an opt-in
show_progress: bool = Falseparameter toCollection.upsert. When enabled:tqdm.auto, so it picks a notebook widget or a terminal bar automatically (the notebook-vs-shell problem raised in the issue).recordsisSized(list, tuple, ...), and falls back to an indeterminate bar for generators and other unsized iterables.tqdmis an optional extra (pip install vecs[progress]), not a new hard dependency, sopip install vecsis unchanged. Calling withshow_progress=Truewithout tqdm installed raises anImportErrorwith the install hint.show_progress=False) is unchanged.Tests added in
src/tests/test_upsert_progress.pyfor: 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 theImportErrorpath when tqdm is absent. Full suite run locally againstsupabase/postgres:15.1.1.78: 44 passed; the 3test_adapters.pytext-embedding tests fail identically onmainwithout thesentence-transformersextra installed.