MNT: Should we re-organize shared agg files in /src ?

オープン
#32,589 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

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

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
リファクタリング
明瞭さ
説明が足りない
活発さ
活発
技術スタック
cpp, python

調査の方向性

Read the listed shared headers in src/ and src/py_converters.cpp, then compare their dependency tree with the nanobind experiment branch linked in the issue. The issue asks for opinions on how to group and transition these files, but does not settle on a design; done means agreeing on a structure and migration approach for _backend_agg, _image, and _path.

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

説明

Maintenance

We currently have 4 files in /src which are used by the _backend_agg, _image, and _path modules:

Additionally, we have py_converters.cpp which is only used by _image. If _path or _backend_end tries to use convert_trans_affine(), they will get a missing symbol at compile time.

The dependency tree looks like this:

Dependency tree

During my nanobind work, I struggled to understand the grouping of these files and had several questions:

  • Why is "_backend_agg_basic_types.h" named with the "backend" prefix when it is used by _path?
  • Why do "path_converters" and "py_converters" end with a "converters" suffix when they implement two very different ideas?
  • What is the difference between a "py_adapter" and the classes found in "_backend_agg_basic_types"?
  • Why do we split _backend_agg, _image, and _path into three modules when they all use agg? There's approximately 15% duplicated agg code and 10% duplicated pybind11 code present in the three modules. Most of the duplication is between _path and _backend_agg. I understand why _image makes sense on its own.

I believe that the answer to all of these is "it's how the files have evolved over time and there hasn't been a need to change anything."


With the nanobind transition, I need to have nanobind variants of these files. I have the following options:

  1. Introduce nanobind variants of the files with different names. This allows me to transition _backend_agg, _image, and _path separately.
  2. Keep the files the same name and have giant #ifdef USE_NANOBIND_IMPL / #ifdef USE_PYBIND11_IMPL blocks.
  3. Keep the files the same name and move everything over in one PR.

I used the first option in my nanobind-experiment branch. However, I'm not sure if the original grouping of these files still makes sense.

Are there any strong opinions? Should we re-organize these in a different way?

主要言語
Python
スター
23.5k
フォーク
8.6k
平均マージ
1日 19時間
マージ済み PR(30日)
64

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

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

matplotlib/matplotlib のほかの issue

matplotlib/matplotlib の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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