Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Convert remaining code to pybind11 #28856

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Oct 8, 2024
Merged

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented Sep 21, 2024

PR summary

Now that we are building with pybind11 in all extensions, we can drop/convert several items that were used across extensions. Namely, everything in py_adaptors (which was shared between _path and _backend_agg) can now get a type caster, all the remaining array_view can be moved to py::array_t, and the ClipPath converter issue from #27011 has been fixed.

Additionally, I moved the pybind11 type casters from py_converters_11.h to the files that define the related types. This keeps things a bit more consolidated, and avoids the weird #ifdef macro magic that was needed before.

PR checklist

@QuLogic QuLogic added this to the v3.10.0 milestone Sep 21, 2024
@QuLogic QuLogic mentioned this pull request Sep 21, 2024
4 tasks
@QuLogic QuLogic added the CI: Run cibuildwheel Run wheel building tests on a PR label Sep 21, 2024
@github-actions github-actions bot removed the CI: Run cibuildwheel Run wheel building tests on a PR label Sep 24, 2024
@QuLogic QuLogic mentioned this pull request Sep 24, 2024
13 tasks
Copy link
Member

@ksunden ksunden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to get this in for 3.10, so if we could get a second review, that would be great

@QuLogic QuLogic mentioned this pull request Oct 1, 2024
4 tasks
QuLogic and others added 8 commits October 1, 2024 22:24
This was previously checked by using an `array_view<type, ndim>`, but
moving to pybind11 we won't have that until cast to `unchecked`.
They need only be the same number of dimensions, as sometimes code does
`np.atleast_3d(array)` on something empty, which inserts the 0-dimension
in a spot that messes with the expected trailing shape.
Now that everything else is using pybind11, this works without issue.
Since we're using pybind11 everywhere, it should be fine now to access
it in any header, and putting the type caster there is clearer. We don't
need the weird macro checks to conditionally define them either.
@tacaswell
Copy link
Member

This looks like some of the grayscale have picked up a off-by-one rounding issue. Seeing this on other PRs as well.

Copy link
Contributor

@greglucas greglucas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not an expert on the pybind11 changes, but I did peruse this and it all looks reasonable to a non-expert. I reran the failing 313t tests and those now pass. I believe the other failures in Azure are unrelated and failing on other tests too.

I believe that it will be easier to review incremental updates after this is in if there is anything else to follow up on.

Great work on this @QuLogic! This was no small feat.

@greglucas greglucas merged commit f8cadb3 into matplotlib:main Oct 8, 2024
40 of 44 checks passed
@QuLogic QuLogic deleted the pybind11-finals branch October 8, 2024 22:22
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.

5 participants