Title: MNT: Should we re-organize shared agg files in /src ? · Issue #32589 · matplotlib/matplotlib · GitHub
Open Graph Title: MNT: Should we re-organize shared agg files in /src ? · Issue #32589 · matplotlib/matplotlib
X Title: MNT: Should we re-organize shared agg files in /src ? · Issue #32589 · matplotlib/matplotlib
Description: We currently have 4 files in /src which are used by the _backend_agg, _image, and _path modules: _backend_agg_basic_types.h path_converters.h py_adaptors.h py_converters.h Additionally, we have py_converters.cpp which is only used by _im...
Open Graph Description: We currently have 4 files in /src which are used by the _backend_agg, _image, and _path modules: _backend_agg_basic_types.h path_converters.h py_adaptors.h py_converters.h Additionally, we have py_...
X Description: We currently have 4 files in /src which are used by the _backend_agg, _image, and _path modules: _backend_agg_basic_types.h path_converters.h py_adaptors.h py_converters.h Additionally, we have py_...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/32589
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"MNT: Should we re-organize shared agg files in /src ?","articleBody":"We currently have 4 files in /src which are used by the `_backend_agg`, `_image`, and `_path` modules:\n\n- [_backend_agg_basic_types.h](https://github.com/matplotlib/matplotlib/blob/main/src/_backend_agg_basic_types.h)\n- [path_converters.h](https://github.com/matplotlib/matplotlib/blob/main/src/path_converters.h)\n- [py_adaptors.h](https://github.com/matplotlib/matplotlib/blob/main/src/py_adaptors.h)\n- [py_converters.h](https://github.com/matplotlib/matplotlib/blob/main/src/py_converters.h)\n\nAdditionally, we have [py_converters.cpp](https://github.com/matplotlib/matplotlib/blob/main/src/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.\n\nThe dependency tree looks like this:\n\n\u003cimg width=\"640\" alt=\"Dependency tree\" src=\"https://github.com/user-attachments/assets/16c0984b-4360-4dac-b4a4-ec54deb7c205\" />\n\nDuring my nanobind work, I struggled to understand the grouping of these files and had several questions:\n\n- Why is \"_backend_agg_basic_types.h\" named with the \"backend\" prefix when it is used by `_path`?\n- Why do \"path_converters\" and \"py_converters\" end with a \"converters\" suffix when they implement two very different ideas?\n- What is the difference between a \"py_adapter\" and the classes found in \"_backend_agg_basic_types\"?\n- 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.\n\nI 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.\"\n\n---\n\nWith the nanobind transition, I need to have nanobind variants of these files. I have the following options:\n\n1. Introduce nanobind variants of the files with different names. This allows me to transition `_backend_agg`, `_image`, and `_path` separately.\n2. Keep the files the same name and have giant `#ifdef USE_NANOBIND_IMPL` / `#ifdef USE_PYBIND11_IMPL` blocks.\n3. Keep the files the same name and move everything over in one PR.\n\nI used the first option in my [nanobind-experiment branch](https://github.com/iccir/matplotlib/tree/nanobind-experiment/src). However, I'm not sure if the original grouping of these files still makes sense.\n\nAre there any strong opinions? Should we re-organize these in a different way?","author":{"url":"https://github.com/iccir","@type":"Person","name":"iccir"},"datePublished":"2026-11-11T18:17:54Z","url":"https://github.com/matplotlib/matplotlib/issues/32589"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2f00347d-ec8e-fbe4-7978-73fdfd72eafd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D5B6:1FDCFC:1039C67:157BA22:6B064EDC |
| html-safe-nonce | a69faee8bb14c58b10339376f5d19e771f1e09c571e229de6714f06de0badd6d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENUI2OjFGRENGQzoxMDM5QzY3OjE1N0JBMjI6NkIwNjRFREMiLCJ2aXNpdG9yX2lkIjoiOTIxMzM4OTcyMjkwNTYyODM4MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 51b4016fab6e101c4564b45570ea7748faede930976dcdab36aa63e9fcd5f0d4 |
| hovercard-subject-tag | issue:6334602767 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/32589/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c37c3e9959d89c545519ad82486575d24145f574d56b47e14d2318b8dede1073/matplotlib/matplotlib/issues/32589 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c37c3e9959d89c545519ad82486575d24145f574d56b47e14d2318b8dede1073/matplotlib/matplotlib/issues/32589 |
| og:image:alt | We currently have 4 files in /src which are used by the _backend_agg, _image, and _path modules: _backend_agg_basic_types.h path_converters.h py_adaptors.h py_converters.h Additionally, we have py_... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | iccir |
| hostname | github.com |
| expected-hostname | github.com |
| None | 772b6997ca4daa0428dd49a25d76052e765555ae560fe9c88517eb828bbd861e |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f1f9a08f7c769a37f1dfc18ad43d463c222a7eea |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width