Skip to content

Rework testing.compare converters to allow for variants - #32637

Closed
iccir wants to merge 2 commits into
matplotlib:mainfrom
iccir:converters
Closed

iccir wants to merge 2 commits into
matplotlib:mainfrom
iccir:converters

Conversation

@iccir

@iccir iccir commented Nov 21, 2026

Copy link
Copy Markdown
Member

PR summary

This PR reworks how converters are stored and used in the matplotlib.testing.compare module.

Technically, the converters dictionary was public API since it lacked an underscore. I changed it to _converters and also changed the key format. If this is a problem, I can redo this PR in some other way.

Ultimately, the goal is to allow a platform-native macOS SVG converter in addition to the Inkscape converter. A future version of _update_converter() should look like the following:

if sys.platform == "darwin":
    _converter[('svg', '')] = _MacSVGConverter()
    _converter[('svg', 'fonts')] = _MacSVGWithMatplotlibFontsConverter()
else:
    try:
        mpl._get_executable_info("inkscape")
    except mpl.ExecutableNotFoundError:
        pass
    else:
        _converter[('svg', '')] = _InkscapeSVGConverter()
        _converter[('svg', 'fonts')] = _InkscapeSVGWithMatplotlibFontsConverter()

AI Disclosure

No AI.

PR quality check

  • Use an expressive title, e.g. "Fix title font property precedence"
  • New and changed code is tested
  • [/] Plotting related features are demonstrated in an example
  • [/] New features and API changes have release notes
  • [/] Documentation complies with general and docstring guidelines

@iccir

iccir commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Note: converters is in the .pyi file, but it's not listed in __all__. I'm not sure if the intention is for it to be public or not.

Comment thread lib/matplotlib/testing/compare.py Resolved
@iccir

iccir commented Nov 28, 2026

Copy link
Copy Markdown
Member Author

Closing in favor of #32666

@iccir iccir closed this Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants