Skip to content

[data] Fix type hint for config parameter in build_processor#64098

Open
ArchishmanSengupta wants to merge 1 commit into
ray-project:masterfrom
ArchishmanSengupta:fix/processor-config-typing
Open

[data] Fix type hint for config parameter in build_processor#64098
ArchishmanSengupta wants to merge 1 commit into
ray-project:masterfrom
ArchishmanSengupta:fix/processor-config-typing

Conversation

@ArchishmanSengupta

@ArchishmanSengupta ArchishmanSengupta commented Jun 15, 2026

Copy link
Copy Markdown

Description

The public engine config classes (vLLMEngineProcessorConfig, SGLangEngineProcessorConfig,
HttpRequestProcessorConfig, ServeDeploymentProcessorConfig) only inherited from their
internal base classes, not from the public ProcessorConfig wrapper. This made them sibling
types of ProcessorConfig in the static type system, so type checkers (pyright, mypy, IDE
linters) flagged valid calls like build_processor(config=vLLMEngineProcessorConfig(...)) as
type errors, even though they work correctly at runtime.

This adds ProcessorConfig as a secondary base class to each public config class. Since they
already inherit from internal classes that derive from the same _ProcessorConfig base, this
forms a valid diamond and correctly establishes them as subclasses of the public
ProcessorConfig. build_processor keeps its clean public config: ProcessorConfig type hint.
No internal types are leaked into the public API and no runtime behavior changes.

Related issues

Fixes #57981

Additional information

Verified with pyright — the repro from the issue and all config types now produce 0 type errors.

@ArchishmanSengupta ArchishmanSengupta requested a review from a team as a code owner June 15, 2026 15:55

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the type hint of the config parameter in the public build_processor function from ProcessorConfig to the internal _ProcessorConfig. The reviewer advises against exposing internal classes in the public API and suggests keeping the public ProcessorConfig type hint by utilizing multiple inheritance on the configuration classes.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread python/ray/data/llm.py Outdated
@PublicAPI(stability="beta")
def build_processor(
config: ProcessorConfig,
config: _ProcessorConfig,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Exposing the internal/private class _ProcessorConfig in the public API signature of build_processor is not ideal, as it leaks internal implementation details to users and static analysis tools.

Instead of changing the type hint of build_processor to _ProcessorConfig, a cleaner and more idiomatic approach is to make the public config classes inherit from the public ProcessorConfig class as well. Since they already inherit from their respective internal classes (which inherit from _ProcessorConfig), adding ProcessorConfig as a secondary base class forms a valid diamond inheritance and correctly establishes them as subclasses of ProcessorConfig in the type system.

For example:

class HttpRequestProcessorConfig(_HttpRequestProcessorConfig, ProcessorConfig):
    pass

class vLLMEngineProcessorConfig(_vLLMEngineProcessorConfig, ProcessorConfig):
    pass

This allows build_processor to keep its clean, public type hint.

Suggested change
config: _ProcessorConfig,
config: ProcessorConfig,

@ArchishmanSengupta ArchishmanSengupta force-pushed the fix/processor-config-typing branch from 1ffe119 to 5054291 Compare June 15, 2026 15:59
@ray-gardener ray-gardener Bot added data Ray Data-related issues community-contribution Contributed by the community labels Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community data Ray Data-related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[data][llm] Typing for config in build_llm_processor seems to fail

1 participant