GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — MNT: Should we re-organize shared agg files in /src ? · Issue #32589 · matplotlib/matplotlib

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

New issue
Copy link
New issue
Copy link
Open
Open
MNT: Should we re-organize shared agg files in /src ?#32589
Copy link
Labels
Maintenance

Description

@iccir
iccir
opened on Nov 11, 2026
Issue body actions

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 _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?

Activity

  1. iccir
    added
    Maintenance
    on Nov 11, 2026
  2. iccir
    added this to nanobindon Nov 11, 2026
  3. github-project-automation
    moved this to Todo in nanobindon Nov 11, 2026
  4. iccir
    moved this from Todo to Needs Discussion in nanobindon Nov 11, 2026
  5. iccir commented on Nov 11, 2026

    @iccir
    iccir
    on Nov 11, 2026
    ContributorAuthor
    More actions

    Currently, my branch uses the following file names:

    Old (pybind11) New (nanobind) Notes
    _backend_agg_basic_types.h agg_basics_types.h I dropped "backend" since it is used by _path as well.
    path_converters.h agg_path_converters.h
    py_adapters.h agg_path_adapters.h
    py_converters.h agg_convert_overloads.h Contains overloads of mpl::convert()
    py_converters.cpp (Removed) Now a mpl::convert() overload and lives in a header.

    I'm not a huge fan of using the "agg_" prefix in both /src and our vendored copy of agg. However, it does have precedence with "agg_workaround.h".

    I could also use "shared_" for the prefix rather than "agg_".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Maintenance

    Type

    No type

    Projects

    • nanobind
      Status
      Needs Discussion
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.