Skip to content
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

"full" implementation of new Py2 API #3606

Closed
wants to merge 8 commits into from

Conversation

davidhewitt
Copy link
Member

Closes #3382

This branch has been used to implement pydantic/pydantic-core#1085

It's based on top of #3572, and also includes #3600 as well as updated forms of most of the other PRs introducing Py2 types.

I feel like this strikes a good balance of introducing the new Py2 API without breaking much of the existing gil refs API. The only thing which really needed to change was the FromPyObject trait, to take &Py2<'py, PyAny> instead of &'py PyAny. I don't think I'd want to land this amongst other breaking changes. I do think this might be releasable as an 0.22 release with both APIs still present (maybe gate the GIL refs API with a backcompat feature), with a view to dropping the gil refs API in 0.24 maybe.

Next steps:

  • We want to release pydantic-core against a form of this branch in the near future. Any opinions if I should release this as a fork of PyO3, or we release this as an 0.22 alpha?

  • I plan to start splitting this out into reviewable PRs and keep this one rebased as we move forwards.

  • This also needs further cleanup / documentation etc.

@davidhewitt davidhewitt added the CI-skip-changelog Skip checking changelog entry label Nov 29, 2023
@davidhewitt davidhewitt force-pushed the complete-py2 branch 3 times, most recently from 3235ef6 to d4baf2a Compare December 5, 2023 07:03
Copy link

codspeed-hq bot commented Dec 5, 2023

CodSpeed Performance Report

Merging #3606 will degrade performances by 34.69%

Comparing davidhewitt:complete-py2 (c3d9e69) with main (94b7d7e)

Summary

⚡ 4 improvements
❌ 5 regressions
✅ 70 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main davidhewitt:complete-py2 Change
ordered_dunder_methods 4 µs 6 µs -33.48%
ordered_richcmp 3.9 µs 6 µs -34.69%
list_via_downcast 157.2 ns 185 ns -15.02%
list_via_extract 308.9 ns 364.4 ns -15.24%
sequence_from_tuple 232.8 ns 260.6 ns -10.66%
test_simple_args_kwargs_rs 45.9 µs 38.1 µs +20.71%
test_simple_args_rs 39.4 µs 34.9 µs +12.94%
test_simple_kwargs_rs 45.6 µs 37.2 µs +22.55%
test_simple_rs 35.2 µs 32 µs +10.02%

@davidhewitt
Copy link
Member Author

This branch has now outlived its usefulness. We've split out basically everything into other PRs, and I see no further need to keep trying to rebase this here for the few remaining odds and ends, so I'll close this. Great work everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI-skip-changelog Skip checking changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upcoming changes to PyO3's API in 0.21
1 participant