`get_field_type` and `get_attribute_access_type` read `__fields__` and emit `PydanticDeprecatedSince20` on each field access
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
非推奨の読み取りは reflex_base/utils/types.py にあります。get_field_type の589-594行目と get_attribute_access_type の710行目にある __fields__ へのアクセスです。まず issue の再現スクリプトを実行し、警告の件数を確認してください。スクリプトが PydanticDeprecatedSince20 の警告を0件と報告し、フィールド型が以前と同じように解決されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
Reflex reads cls.__fields__ when it resolves the type of a field on a Pydantic v2 model. Pydantic v2 deprecates __fields__, so each read emits PydanticDeprecatedSince20. One field access on a Var emits 7 warnings.
The reads are in reflex_base/utils/types.py (reflex-base 0.9.12):
get_attribute_access_type, line 710: 2 reads.get_field_type, lines 589 to 594: 5 reads.
The same code is in 0.9.13 and 0.10.0. In 0.10.0, the lines are 580 to 585 and 701.
To Reproduce
import warnings
import pydantic
import reflex as rx
class Item(pydantic.BaseModel):
name: str
size: int
class ItemState(rx.State):
items: list[Item] = []
with warnings.catch_warnings(record=True) as caught:
warnings.simplefilter("always")
rx.foreach(ItemState.items, lambda item: rx.text(item.name, " ", item.size))
deprecations = [record for record in caught if issubclass(record.category, pydantic.warnings.PydanticDeprecatedSince20)]
print(f"{len(deprecations)} PydanticDeprecatedSince20 warnings")
for warning in deprecations:
print(f" {warning.filename.split('site-packages/')[-1]}:{warning.lineno}")
Output with Python 3.14.6, reflex 0.9.12, reflex-base 0.9.12 and pydantic 2.14.0:
14 PydanticDeprecatedSince20 warnings
reflex_base/utils/types.py:710
reflex_base/utils/types.py:710
reflex_base/utils/types.py:589
reflex_base/utils/types.py:590
reflex_base/utils/types.py:591
reflex_base/utils/types.py:592
reflex_base/utils/types.py:594
(the same 7 lines again for the second field)
The script accesses 2 fields, and each access emits 7 warnings. In our app, one page compile does 176 field accesses and emits 1,232 warnings.
Expected behavior
Reflex resolves field types on Pydantic v2 models without deprecation warnings.
Specifics (please complete the following information):
- Python Version: 3.14.6
- Reflex Version: 0.9.12
- OS: macOS 26.6.2 (build 25G83), on Apple Silicon (arm64)
Additional context
Related: #6241, #6135.
- 主要言語
- Python
- スター
- 28.9k
- フォーク
- 1.8k
- 平均マージ
- 2日 14時間
- マージ済み PR(30日)
- 211
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
reflex-dev/reflex のほかの issue
-
`reflex run --json` ignores SIGINT sent to its pid; under supervisord stopsignal=INT the app is orphaned and blocks the restart対応中かも @harsh21234i が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
reflex-dev/reflex#7509 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
npm: source-only hot reloads still reinstall packages because the rendered package.json has `devDependencies: {}` while the on-disk one has no key (residual of #7235)対応中かも @harsh21234i が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
reflex-dev/reflex#7480 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
reflex-dev/reflex#7260 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
reflex-dev/reflex#7148 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
ClientStateVar: a component that mounts while the value is non-default never re-renders on the push back to the default再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
reflex-dev/reflex#6823 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
reflex-dev/reflex の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
WingedGuardian/GENesis-AGI#3375 ·
メンテナーはふだん 1 日以内に返信
-
curriculum documentation quality
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
githubnext/gh-aw-workshop#4601 ·
メンテナーはふだん 1 日以内に返信
-
approved Good First Issue scope: docs
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
hiero-ledger/hiero-sdk-python#2730 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信