[BUG]: Duplicate `FigureWidget` import code in `graph_objects` and `graph_objs`

オープン 初心者向け
#5,849 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

@DawnofGenX がすでに取り組んでいます。

2026年10月27日 から。

  • #5850 @DawnofGenX による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
76/100
issue の種類
リファクタリング
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
backend

調査の方向性

codegen/__init__.py の optional_figure_widget_import から始め、write_init_py と build_from_imports_py が2つのパッケージ初期化ファイルをどのように生成するかを読んでください。plotly/graph_objs/__init__.py と plotly/graph_objects/__init__.py の FigureWidget ブロックを比較します。生成コードが既存の ipywidgets のオプショナルなインポートと、依存関係がない場合のフォールバックを維持し、ブロックを一度だけ出力すれば完了です。issue #5238 で参照されているフォールバックのテストを確認してください。

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

説明

bug P3 size: 1
Description

The FigureWidget import code is duplicated in graph_objects and graph_objs.

Steps to reproduce
  • Open codegen/__init__.py and find optional_figure_widget_import.
  • Note that the codegen passes the string to write_init_py for graph_objs and to build_from_imports_py for graph_objects.
  • Open plotly/graph_objs/__init__.py and plotly/graph_objects/__init__.py.
  • Note the identical FigureWidget blocks at the end of each file.
Notes
  • The codegen writes the same optional FigureWidget import block into two generated files: plotly/graph_objs/__init__.py and plotly/graph_objects/__init__.py
  • graph_objects already re-exports every other class from graph_objs, including Figure. FigureWidget can follow the same path, because graph_objs handles the optional ipywidgets import and the missing_* fallback.
  • Any fix should not change behavior. This is just about removing duplicate code.
  • Related:
    • #3779 (closed, edited the generated file by hand)
    • #5238 (test for the missing FigureWidget fallback)
主要言語
Python
スター
18.9k
フォーク
2.9k
平均マージ
1日 22時間
マージ済み PR(30日)
12

環境構築

はじめの一歩

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

plotly/plotly.py のほかの issue

plotly/plotly.py の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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