Pyrefly strict mode rejects Haystack components

オープン
#13,378 コメント 4 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

  • #13401 @Cha-Imaa による — マージされずにクローズ

評価

難易度
4/5
見積もり時間
1〜2日
初心者へのやさしさ
56/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python

調査の方向性

Start by reading Component.run and Pipeline.add_component, then inspect the strict callable subtyping behavior that rejects DocumentWriter in the reproduction. Run pyrefly check --preset strict repro.py with the stated versions and compare it with strict callable subtyping disabled. Done when valid Haystack components pass strict type checking when added to a pipeline.

索引モデルが issue の本文から書いたものです。

説明

P3

Describe the bug
Pyrefly strict mode rejects Haystack components passed to Pipeline.add_component because their run signatures do not match Component.run(*args: Any, **kwargs: Any). This affects components generally, not just the example below.

Error message

Argument `DocumentWriter` is not assignable to parameter `instance` with type `Component` [bad-argument-type]

Expected behavior
Valid Haystack components type-check when added to a pipeline.

Additional context
Pyrefly passes with --strict-callable-subtyping=false; its strict preset enables that setting. The pipeline runs successfully.

To Reproduce

from haystack import Pipeline
from haystack.components.writers import DocumentWriter
from haystack.document_stores.in_memory import InMemoryDocumentStore

pipeline = Pipeline()
pipeline.add_component("writer", DocumentWriter(document_store=InMemoryDocumentStore()))

Run pyrefly check --preset strict repro.py with haystack-ai==3.4.1 and pyrefly==1.4.0.

FAQ Check

System:

  • OS: Arch Linux (kernel 7.2.9-arch1-1, x86_64)
  • Haystack version: 3.4.1
  • Python: 3.14.8; Pyrefly: 1.4.0
主要言語
Python
スター
27.2k
フォーク
3.5k
平均マージ
1日 18時間
マージ済み PR(30日)
254

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

deepset-ai/haystack のほかの issue

deepset-ai/haystack の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。