René's URL Explorer Experiment


Title: Use mpl::format for error messages instead of pybind11 by iccir · Pull Request #32484 · matplotlib/matplotlib · GitHub

Open Graph Title: Use mpl::format for error messages instead of pybind11 by iccir · Pull Request #32484 · matplotlib/matplotlib

X Title: Use mpl::format for error messages instead of pybind11 by iccir · Pull Request #32484 · matplotlib/matplotlib

Description: PR summary From yesterday's meeting, it sounds like nanobind is a direction that we want to take. I think it might be easier to create smaller PRs for "preparing the repository for nanobind" rather than one huge PR. I can still do the huge PR if people prefer. This PR adds mpl::format() to mplutils.h and uses it to format error messages rather than directly using pybind11::str. Why? nanobind's str class is simpler than pybind11's. There is no _s UDL nor implicit conversion to std::string. Hence, when porting to nanobind, the following code: throw std::runtime_error( "Inverse transformed mesh array should be 2D not {}D"_s.format( output_mesh_array.ndim())); becomes: throw std::runtime_error(nb::str( "Inverse transformed mesh array should be 2D not {}D").format( output_mesh_array.ndim()).c_str()); With this PR, both the pybind11 and nanobind versions are the same: throw std::runtime_error(mpl::format( "Inverse transformed mesh array should be 2D not {}D", output_mesh_array.ndim())); This PR also makes the following changes: mpl_round goes into the mpl namespace and is renamed to round. As far as I can tell, the mpl_ prefix was due to including this file from pure C in the 2010's. mpl_round_to_int goes into the mpl namespace and is renamed to round_to_int. Removed #ifdef __cplusplus // not for macosx.m. The old macOS backend doesn't include this file. The new macOS backend may include this file, but will do so from Objective-C++. I moved the #includes higher in the file. I wish they were at the top, but I wasn't sure if they needed to be placed after the #define shenanigans. Note: more code will be added to the mpl namespace in the future. AI Disclosure The robot taught me how to use std::forward several months ago. 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

Open Graph Description: PR summary From yesterday's meeting, it sounds like nanobind is a direction that we want to take. I think it might be easier to create smaller PRs for "preparing the repository for nanobin...

X Description: PR summary From yesterday's meeting, it sounds like nanobind is a direction that we want to take. I think it might be easier to create smaller PRs for "preparing the repository for...

Opengraph URL: https://github.com/matplotlib/matplotlib/pull/32484

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.112.3

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:3ddd38a8-cb22-7dd7-06bd-1feff4ece157
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idC2D6:26D2E5:6277B2:87F9C0:6B068F67
html-safe-nonce87160bab842e95212eae6badf16b0eb6a12a6bb6452c9fe735074c967241e8a8
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMkQ2OjI2RDJFNTo2Mjc3QjI6ODdGOUMwOjZCMDY4RjY3IiwidmlzaXRvcl9pZCI6IjY0NDgxNDAxODQwMjk5MjUyMjMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac5f03f2f7946fb3e9b7c353c9955a8f5c65f2f927f86d5920cbed14ac5d8a5d09
hovercard-subject-tagpull_request:4891341058
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/matplotlib/matplotlib/pull/32484/files
twitter:imagehttps://avatars.githubusercontent.com/u/1097294?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/1097294?s=400&v=4
og:image:altPR summary From yesterday's meeting, it sounds like nanobind is a direction that we want to take. I think it might be easier to create smaller PRs for "preparing the repository for nanobin...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None4462ff7ebfd3d551f202659f2423dae617b6849d23b1df6465dc504ef497d14a
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git
octolytics-dimension-user_id215947
octolytics-dimension-user_loginmatplotlib
octolytics-dimension-repository_id1385122
octolytics-dimension-repository_nwomatplotlib/matplotlib
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1385122
octolytics-dimension-repository_network_root_nwomatplotlib/matplotlib
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release6d3909414814ff86ce7da4c51a0f4918a13fb41b
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/matplotlib/matplotlib/pull/32484/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fmatplotlib%2Fpull%2F32484%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fmatplotlib%2Fpull%2F32484%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=matplotlib%2Fmatplotlib
Reloadhttps://github.com/matplotlib/matplotlib/pull/32484/files
Reloadhttps://github.com/matplotlib/matplotlib/pull/32484/files
Reloadhttps://github.com/matplotlib/matplotlib/pull/32484/files
matplotlibhttps://github.com/matplotlib
matplotlibhttps://github.com/matplotlib/matplotlib
Codehttps://github.com/matplotlib/matplotlib
Issues1k (1k)https://github.com/matplotlib/matplotlib/issues
Pull requests429 (429)https://github.com/matplotlib/matplotlib/pulls
Actionshttps://github.com/matplotlib/matplotlib/actions
Projectshttps://github.com/matplotlib/matplotlib/projects
Wikihttps://github.com/matplotlib/matplotlib/wiki
Security and qualityhttps://github.com/matplotlib/matplotlib/security
Insightshttps://github.com/matplotlib/matplotlib/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fmatplotlib%2Fmatplotlib%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fmatplotlib%2Fmatplotlib%2Fissues%2Fnew%2Fchoose
QuLogichttps://github.com/QuLogic
matplotlib:mainhttps://github.com/matplotlib/matplotlib/tree/main
iccir:mplutilshttps://github.com/iccir/matplotlib/tree/mplutils
Conversation 16 https://github.com/matplotlib/matplotlib/pull/32484
Commits 2 https://github.com/matplotlib/matplotlib/pull/32484/commits
Checks 50 https://github.com/matplotlib/matplotlib/pull/32484/checks
Files changed 9 https://github.com/matplotlib/matplotlib/pull/32484/files
Use mpl::format for error messages instead of pybind11 https://github.com/matplotlib/matplotlib/pull/32484/files#top
Show all changes 2 commits https://github.com/matplotlib/matplotlib/pull/32484/files
27a1c1e Add mpl::format and cleanup mplutils iccir Oct 16, 2026 https://github.com/matplotlib/matplotlib/pull/32484/commits/27a1c1e8cb159872a1ef6e0ddecf6220c4a1f037
dc9df6a Fix indentation based on review iccir Oct 16, 2026 https://github.com/matplotlib/matplotlib/pull/32484/commits/dc9df6a7d17d94cebac7e0e6c857728e6d4db86a
Clear filters https://github.com/matplotlib/matplotlib/pull/32484/files
Please reload this pagehttps://github.com/matplotlib/matplotlib/pull/32484/files
Please reload this pagehttps://github.com/matplotlib/matplotlib/pull/32484/files
_backend_agg.h https://github.com/matplotlib/matplotlib/pull/32484/files#diff-34559c7ee959645e82cd258d9684eab40456cbfa5b417fed59780e07ea670df7
_backend_agg_wrapper.cpp https://github.com/matplotlib/matplotlib/pull/32484/files#diff-f3dd8a3c75d95382019d5d8bb7deb2251a857f12e36470d1de3df3a2899b0ab2
_image_wrapper.cpp https://github.com/matplotlib/matplotlib/pull/32484/files#diff-1a948cbfec984b9095236a7c84a63ddb3df05fb8cd962ebd19845632ee31dfe2
_qhull_wrapper.cpp https://github.com/matplotlib/matplotlib/pull/32484/files#diff-a08848a09f2447ce3dfd733c7b56f3ff545113faa64ffbb519acbd27a3d0e04b
_tkagg.cpp https://github.com/matplotlib/matplotlib/pull/32484/files#diff-3738bd01dcd1fd4455918f1845644a116249a0c94b2f8663e905a7ea909460d3
ft2font.cpp https://github.com/matplotlib/matplotlib/pull/32484/files#diff-f93030a94ba0b041408f7cc149797d83d6aa24a539a8e8c067e3b8a40a220600
ft2font_wrapper.cpp https://github.com/matplotlib/matplotlib/pull/32484/files#diff-5a4638a8d55cba783f8c2dfea1847d86fb17267bc9cf044afc66a51270dd9879
mplutils.h https://github.com/matplotlib/matplotlib/pull/32484/files#diff-839b0246ca116758131d03e277b1aa66db2285f5c8b16aa7a2541d1d0c73f604
path_converters.h https://github.com/matplotlib/matplotlib/pull/32484/files#diff-36d69dfa667beb67da44e7bc61c9e0ca35deea173c1cb43e77637c7cbcb4a939
src/_backend_agg.hhttps://github.com/matplotlib/matplotlib/pull/32484/files#diff-34559c7ee959645e82cd258d9684eab40456cbfa5b417fed59780e07ea670df7
View file https://github.com/iccir/matplotlib/blob/dc9df6a7d17d94cebac7e0e6c857728e6d4db86a/src/_backend_agg.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/matplotlib/matplotlib/pull/32484/{{ revealButtonHref }}
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-34559c7ee959645e82cd258d9684eab40456cbfa5b417fed59780e07ea670df7
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-34559c7ee959645e82cd258d9684eab40456cbfa5b417fed59780e07ea670df7
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-34559c7ee959645e82cd258d9684eab40456cbfa5b417fed59780e07ea670df7
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-34559c7ee959645e82cd258d9684eab40456cbfa5b417fed59780e07ea670df7
src/_backend_agg_wrapper.cpphttps://github.com/matplotlib/matplotlib/pull/32484/files#diff-f3dd8a3c75d95382019d5d8bb7deb2251a857f12e36470d1de3df3a2899b0ab2
View file https://github.com/iccir/matplotlib/blob/dc9df6a7d17d94cebac7e0e6c857728e6d4db86a/src/_backend_agg_wrapper.cpp
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/matplotlib/matplotlib/pull/32484/{{ revealButtonHref }}
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-f3dd8a3c75d95382019d5d8bb7deb2251a857f12e36470d1de3df3a2899b0ab2
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-f3dd8a3c75d95382019d5d8bb7deb2251a857f12e36470d1de3df3a2899b0ab2
src/_image_wrapper.cpphttps://github.com/matplotlib/matplotlib/pull/32484/files#diff-1a948cbfec984b9095236a7c84a63ddb3df05fb8cd962ebd19845632ee31dfe2
View file https://github.com/iccir/matplotlib/blob/dc9df6a7d17d94cebac7e0e6c857728e6d4db86a/src/_image_wrapper.cpp
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/matplotlib/matplotlib/pull/32484/{{ revealButtonHref }}
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-1a948cbfec984b9095236a7c84a63ddb3df05fb8cd962ebd19845632ee31dfe2
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-1a948cbfec984b9095236a7c84a63ddb3df05fb8cd962ebd19845632ee31dfe2
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-1a948cbfec984b9095236a7c84a63ddb3df05fb8cd962ebd19845632ee31dfe2
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-1a948cbfec984b9095236a7c84a63ddb3df05fb8cd962ebd19845632ee31dfe2
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-1a948cbfec984b9095236a7c84a63ddb3df05fb8cd962ebd19845632ee31dfe2
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-1a948cbfec984b9095236a7c84a63ddb3df05fb8cd962ebd19845632ee31dfe2
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-1a948cbfec984b9095236a7c84a63ddb3df05fb8cd962ebd19845632ee31dfe2
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-1a948cbfec984b9095236a7c84a63ddb3df05fb8cd962ebd19845632ee31dfe2
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-1a948cbfec984b9095236a7c84a63ddb3df05fb8cd962ebd19845632ee31dfe2
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-1a948cbfec984b9095236a7c84a63ddb3df05fb8cd962ebd19845632ee31dfe2
src/_qhull_wrapper.cpphttps://github.com/matplotlib/matplotlib/pull/32484/files#diff-a08848a09f2447ce3dfd733c7b56f3ff545113faa64ffbb519acbd27a3d0e04b
View file https://github.com/iccir/matplotlib/blob/dc9df6a7d17d94cebac7e0e6c857728e6d4db86a/src/_qhull_wrapper.cpp
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/matplotlib/matplotlib/pull/32484/{{ revealButtonHref }}
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-a08848a09f2447ce3dfd733c7b56f3ff545113faa64ffbb519acbd27a3d0e04b
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-a08848a09f2447ce3dfd733c7b56f3ff545113faa64ffbb519acbd27a3d0e04b
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-a08848a09f2447ce3dfd733c7b56f3ff545113faa64ffbb519acbd27a3d0e04b
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-a08848a09f2447ce3dfd733c7b56f3ff545113faa64ffbb519acbd27a3d0e04b
src/_tkagg.cpphttps://github.com/matplotlib/matplotlib/pull/32484/files#diff-3738bd01dcd1fd4455918f1845644a116249a0c94b2f8663e905a7ea909460d3
View file https://github.com/iccir/matplotlib/blob/dc9df6a7d17d94cebac7e0e6c857728e6d4db86a/src/_tkagg.cpp
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/matplotlib/matplotlib/pull/32484/{{ revealButtonHref }}
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-3738bd01dcd1fd4455918f1845644a116249a0c94b2f8663e905a7ea909460d3
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-3738bd01dcd1fd4455918f1845644a116249a0c94b2f8663e905a7ea909460d3
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-3738bd01dcd1fd4455918f1845644a116249a0c94b2f8663e905a7ea909460d3
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-3738bd01dcd1fd4455918f1845644a116249a0c94b2f8663e905a7ea909460d3
src/ft2font.cpphttps://github.com/matplotlib/matplotlib/pull/32484/files#diff-f93030a94ba0b041408f7cc149797d83d6aa24a539a8e8c067e3b8a40a220600
View file https://github.com/iccir/matplotlib/blob/dc9df6a7d17d94cebac7e0e6c857728e6d4db86a/src/ft2font.cpp
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/matplotlib/matplotlib/pull/32484/{{ revealButtonHref }}
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-f93030a94ba0b041408f7cc149797d83d6aa24a539a8e8c067e3b8a40a220600
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-f93030a94ba0b041408f7cc149797d83d6aa24a539a8e8c067e3b8a40a220600
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-f93030a94ba0b041408f7cc149797d83d6aa24a539a8e8c067e3b8a40a220600
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-f93030a94ba0b041408f7cc149797d83d6aa24a539a8e8c067e3b8a40a220600
src/ft2font_wrapper.cpphttps://github.com/matplotlib/matplotlib/pull/32484/files#diff-5a4638a8d55cba783f8c2dfea1847d86fb17267bc9cf044afc66a51270dd9879
View file https://github.com/iccir/matplotlib/blob/dc9df6a7d17d94cebac7e0e6c857728e6d4db86a/src/ft2font_wrapper.cpp
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/matplotlib/matplotlib/pull/32484/{{ revealButtonHref }}
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-5a4638a8d55cba783f8c2dfea1847d86fb17267bc9cf044afc66a51270dd9879
https://github.com/matplotlib/matplotlib/pull/32484/files#diff-5a4638a8d55cba783f8c2dfea1847d86fb17267bc9cf044afc66a51270dd9879
Please reload this pagehttps://github.com/matplotlib/matplotlib/pull/32484/files
Please reload this pagehttps://github.com/matplotlib/matplotlib/pull/32484/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlno-cache

Viewport: width=device-width


URLs of crawlers that visited me.