feat: export FilterReturn from weaviate.classes.query#1993
Merged
tsmith023 merged 2 commits intoweaviate:mainfrom Mar 24, 2026
Merged
feat: export FilterReturn from weaviate.classes.query#1993tsmith023 merged 2 commits intoweaviate:mainfrom
tsmith023 merged 2 commits intoweaviate:mainfrom
Conversation
Replace private _Filters usage with the existing public FilterReturn type alias across all executors, stubs, and internal modules. This allows users to type-annotate filter parameters without importing private types, resolving pyright reportPrivateUsage errors in strict mode.
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Infrastructure as Code | View in Orca | ||
| SAST | View in Orca | ||
| Secrets | View in Orca | ||
| Vulnerabilities | View in Orca |
Collaborator
|
Looks like you need to call |
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.
Context
Apologies for not opening an issue first, this felt like a small enough change to propose directly and discuss on the code itself !
Problem
Filter.by_property().equal()and similar builder methods return_Filters/_FilterValue, which are private types fromweaviate.collections.classes.filtersHowever, collection methods like
fetch_objects(filters=...),query.hybrid(...), etc. acceptOptional[_Filters]as the type for thefiltersparameter.This makes it impossible to correctly type-annotate user code without importing a private type:
In pyright strict mode (reportPrivateUsage: error), this is flagged as an error.
Solution
A FilterReturn: TypeAlias = _Filters already existed in weaviate.collections.classes.filters but was never re-exported publicly.
This PR:
Users can now write:
Verification
pyright strict (reportPrivateUsage: error):
Unit tests: 324 passed
Scope
There are other private types in public signatures (
_GenerativeConfigRuntime,_RerankerProvider,_ShardingConfigCreate, etc.) that have the same issue. This PR intentionally focuses onFilterReturnonly to keep the diff reviewable. Happy to open a follow-up issue or PR for the others if this approach looks good.