Repository navigation
feat(python): accept the 0.9 names and deprecate the 0.8 spellings - #235
Merged
Merged
Conversation
0.9 gives the three index classes one name for each concept (#232). This release accepts both spellings and raises a DeprecationWarning, at the caller's line, for the 0.8 one: - HnswIndex.capacity and reserve(num_points) for max_elements and resize; max_elements is deprecated on IvfIndex and SymqgIndex. - IvfIndex.reserve_cluster for reserve. - IvfIndex(routing=...) and the routing property for initializer. - search(queries, k, ef_search=...) for ef= on HnswIndex and SymqgIndex. - Search options after the breadth are keyword-only; positions warn. - nprobe=0 and ef_search=0 for the default warn; None selects it. - HnswIndex seeds above 2**32 - 1 warn. The extension keeps the 0.8 names, so the new ones are added in the Python layer, which 0.9 deletes when the extension itself is renamed. No 0.8 call changes its result or its exception type. The HnswIndex default seed and repr() are unchanged here; the 0.9 changes to them are announced in the new 0.8.5 release notes page, which also records #231.
A property assigned to a class after its creation does not get __set_name__, and before Python 3.13 it then reports errors without its name: assigning to the read-only routing property raised "property of 'IvfIndex' object has no setter". CI's wheel tests on CPython 3.11 caught this through test_new_members_are_named_after_their_class; the local environment is 3.13, where the name falls back to the getter's name. Call __set_name__ when adding the properties, so every supported Python names them.
This was referenced Nov 14, 2026
Open
TamimEhsan
pushed a commit
to TamimEhsan/khorgosh
that referenced
this pull request
Nov 20, 2026
Bump the version to 0.8.5 in pyproject.toml and CMakeLists.txt, and update the install pins, clone commands and version text in the README, home page, installation, quick start and C++ integration pages. Turn docs/docs/releases/0.8.5.md into the release page: drop "(unreleased)" from the title and the navigation, add the Upgrading section, and correct three statements (search options become keyword-only in 0.9, not now; set_centroids used every CPU for every routing type before VectorDB-NTU#231; the stubs cannot mark the deprecations that depend on a value or the two old statistics names). The Python samples need 0.8.5 since VectorDB-NTU#235 and VectorDB-NTU#236, so their README asks for it. README news gains v0.8.5 and keeps the three most recent entries.
TamimEhsan
pushed a commit
to TamimEhsan/khorgosh
that referenced
this pull request
Nov 28, 2026
main is at v0.8.5 (cf2764f): the 0.9 names with deprecation warnings for the 0.8 spellings (VectorDB-NTU#235, VectorDB-NTU#236) and the 0.8.5 release preparation (VectorDB-NTU#237). Conflicts, resolved by keeping both sides: - docs/docs/index/{hnsw,ivf,qg}.md: the cosine metric and the -1 missing-result ID from dev/0.9, the new names from main. - python_bindings/__init__.py: the FormatError import from dev/0.9 in main's import layout. - python_bindings/__init__.pyi: cosine in the metric lists, routing for initializer. - tests/python/typing/public_api.py: routing= with the cosine metric type. Changes git could not make, because the two sides did not touch the same lines: - The deprecated search overloads from main return int64 IDs, as every search does on dev/0.9; a typing fixture checks it. - The migration guide said three changes come without a warning in 0.9; with int64 IDs, the -1 marker and format 2 that count was wrong.
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.
Summary
ef_search#232 (its "Transition" step)0.9 gives the three index classes one name for each concept. This PR makes the next 0.8 release accept the 0.9 names next to the 0.8 spellings, and raise a
DeprecationWarningfor each 0.8 spelling at the caller's line, so code can move before 0.9 removes the old forms.IvfIndex.max_elements,SymqgIndex.max_elementsnum_stored_pointsHnswIndex.max_elements,HnswIndex.resize(n)HnswIndex.capacity,HnswIndex.reserve(num_points)(grow-only)IvfIndex.reserve(cluster_id, num_points)IvfIndex.reserve_cluster(cluster_id, num_points)IvfIndex(initializer=...),index.initializerIvfIndex(routing=...),index.routingsearch(queries, k, ef=...)onHnswIndexandSymqgIndexsearch(queries, k, ef_search=...)high_accuracyornum_threadspassed tosearchby positionnprobe=0,ef=0for the defaultNone, or omit the argumentHnswIndex(seed=s)withsabove2**32 - 1[0, 2**32 - 1]Changes
python_bindings/__init__.py, in one marked section next to the 0.8 compatibility layer, by replacing members on the classes. 0.9 deletes that section when the extension itself is renamed. No C++ file changes.TypeError.HnswIndexdefault seed stays 100 andrepr()keeps printingmax_elements=andinitializer=. 0.9 changes both without a warning, which the new release notes page announces.__init__.pyideclares the new members and the newsearchsignatures, and marks each 0.8 form@deprecated. A deprecation that depends on a value (a breadth of 0, a large seed) cannot be declared and is documented in the docstrings.index/usage.mdand the naming contract indocs/development.mduse the new names. The samples andbenchmarks/run.pyuse them too.docs/docs/releases/0.8.5.mdis a new page, marked unreleased, for what is onmainsince 0.8.4. It also records feat(python): let IvfIndex.set_centroids take num_threads #231, which had no notes page.Tests
tests/python/test_compat_09.py(30 tests): each 0.8 form warns once, at the caller, and returns what the new form returns; each new form is silent; conflicting and malformed calls raise.ef_search, droppingnum_threads, passing the wrong breadth insearch_batch, and making the deprecatedreservea no-op each fail at least one test.tests/test_mypy.pychecks that mypy flags all 25 deprecated forms.test_train_api.py,test_symqg_api.pyandtest_examples.pytreat deprecation warnings as errors, so they move to the new names. The checks they lose (a breadth of 0, a seed above 32 bits) are covered in the new file.About 170 uses of the 0.8 spellings remain in other tests. They pass and only warn; moving them is a follow-up, as #214 was for the 0.7 forms.
Checks
On Linux x86-64, Xeon Gold 6418H, GCC 14.3, Release, native optimization off; the package was built from this branch and installed.
test_examples.pyunder-W error::DeprecationWarning: 156 passed.check-python.sh,mkdocs build --strictandgit diff --checkpass. No C++ source changes, so the C++ checks were not run locally.import rabitqlibworks under-O,-OOand-W error. Their findings (tests that could not detect a dropped argument, docs that still taught the old names, warnings raised before argument checks) are fixed here.