Skip to content

feat: export private collection config types as public aliases - #2049

Open
LijuanTang94 wants to merge 1 commit into
weaviate:mainfrom
LijuanTang94:fix/export-private-types-as-public
Open

feat: export private collection config types as public aliases#2049
LijuanTang94 wants to merge 1 commit into
weaviate:mainfrom
LijuanTang94:fix/export-private-types-as-public

Conversation

@LijuanTang94

Copy link
Copy Markdown

Summary

Closes #1994

Users who want to type-annotate parameters like generative_config, reranker_config, vector_index_config, etc. in collection.create() currently have to import private _-prefixed types. In pyright strict mode (reportPrivateUsage: error) this is flagged as an error.

This PR follows the exact same pattern as #1993 (FilterReturn) and adds public TypeAlias entries for the 8 affected types from collections/collections/executor.py:

Public alias Private type
GenerativeConfigCreate _GenerativeProvider
InvertedIndexConfigCreate _InvertedIndexConfigCreate
MultiTenancyConfigCreate _MultiTenancyConfigCreate
ObjectTTLConfigCreate _ObjectTTLConfigCreate
ReplicationConfigCreate _ReplicationConfigCreate
RerankerConfigCreate _RerankerProvider
ShardingConfigCreate _ShardingConfigCreate
VectorIndexConfigCreate _VectorIndexConfigCreate

All 8 aliases are re-exported from weaviate.classes.config.

Before

# pyright error: reportPrivateUsage
from weaviate.collections.classes.config import _GenerativeProvider

def my_helper(gen: Optional[_GenerativeProvider]) -> ...:
    ...

After

from weaviate.classes.config import GenerativeConfigCreate

def my_helper(gen: Optional[GenerativeConfigCreate]) -> ...:
    ...

Changes

  • weaviate/collections/classes/config.py — 6 new TypeAlias entries
  • weaviate/collections/classes/config_object_ttl.py — add TypeAlias import + 1 alias
  • weaviate/collections/classes/config_vector_index.py — add TypeAlias import + 1 alias
  • weaviate/classes/config.py — import and re-export all 8 aliases in __all__

@orca-security-eu orca-security-eu Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

@weaviate-git-bot

Copy link
Copy Markdown

To avoid any confusion in the future about your contribution to Weaviate, we work with a Contributor License Agreement. If you agree, you can simply add a comment to this PR that you agree with the CLA so that we can merge.

beep boop - the Weaviate bot 👋🤖

PS:
Are you already a member of the Weaviate Forum?

@LijuanTang94

Copy link
Copy Markdown
Author

I have read the CLA and agree to the terms.

@LijuanTang94

Copy link
Copy Markdown
Author

Hi team — just checking in on this PR. CLA is now signed and all checks are passing. Happy to make any changes if needed!

Users annotating parameters like `generative_config`, `reranker_config`,
`vector_index_config`, etc. had to import private `_`-prefixed types,
which pyright strict mode (`reportPrivateUsage: error`) flags as an error.

Adds public TypeAlias entries for the 8 affected types, following the
same pattern as `FilterReturn` introduced in weaviate#1993:

- GenerativeConfigCreate   (_GenerativeProvider)
- InvertedIndexConfigCreate (_InvertedIndexConfigCreate)
- MultiTenancyConfigCreate  (_MultiTenancyConfigCreate)
- ObjectTTLConfigCreate     (_ObjectTTLConfigCreate)
- ReplicationConfigCreate   (_ReplicationConfigCreate)
- RerankerConfigCreate      (_RerankerProvider)
- ShardingConfigCreate      (_ShardingConfigCreate)
- VectorIndexConfigCreate   (_VectorIndexConfigCreate)

All 8 aliases are exported from `weaviate.classes.config`.

Closes weaviate#1994
@LijuanTang94
LijuanTang94 force-pushed the fix/export-private-types-as-public branch from 9929051 to 27e29d0 Compare August 14, 2026 18:47
@LijuanTang94

Copy link
Copy Markdown
Author

Rebased onto current main (was 93 commits behind) — no conflicts, diff unchanged from the original.

Same CI situation as #2050: the Main workflow has never run here either — it's stuck at action_required pending first-time-contributor approval, so only the security scans show. Approving the run would make the real checks visible.

Locally against current main: 415 passed on main, 415 on this branch — no regression, as expected for a pure re-export. All 8 private types still exist under those names on main, and all 8 aliases resolve and land in weaviate.classes.config.__all__. ruff format --check is clean.

On the change: #1994 is still open, and this follows the same pattern as #1993 (FilterReturn) — TypeAlias entries so users running pyright in strict mode don't have to import _-prefixed types just to annotate collection.create() arguments.

@dirkkul

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.

Private types exposed in public method signatures

2 participants