Skip to content

update to PyO3 0.22, add 3.13 support #1340

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
Jun 24, 2024
Merged

update to PyO3 0.22, add 3.13 support #1340

merged 8 commits into from
Jun 24, 2024

Conversation

davidhewitt
Copy link
Contributor

@davidhewitt davidhewitt commented Jun 24, 2024

Change Summary

Updates to PyO3 0.22

Related issue number

Closes #1175
Closes #1292

Checklist

  • Unit tests for the changes exist
  • Documentation reflects the changes where applicable
  • Pydantic tests pass with this pydantic-core (except for expected changes)
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

Copy link

codspeed-hq bot commented Jun 24, 2024

CodSpeed Performance Report

Merging #1340 will not alter performance

Comparing dh/pyo3-0.22 (77387e4) with dh/pyo3-0.22 (ae0bdd0)

Summary

✅ 155 untouched benchmarks

Comment on lines -477 to -481
let fields = schema
.get_as_req::<&PyList>(intern!(py, "fields"))?
.iter()
.map(|s| Ok(s.downcast::<PyString>()?.into_py(py)))
.collect::<PyResult<Vec<_>>>()?;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't we need this anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Type inference is able to work out that we want fields to be Vec<Py<PyString>>, so best to let PyO3 decide the most efficient way to achieve that.

This code was flagged to me because &PyList is now removed as a type (we always wrap it as Py<PyList> or Bound<'_, PyList> now), so I simplified :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Great!

Copy link
Contributor

@sydney-runkle sydney-runkle left a comment

Choose a reason for hiding this comment

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

Awesome, thanks for helping me to understand some of these changes.

I think we'll also want to add support for 3.13 to CI?

@davidhewitt davidhewitt added the Full Build cause CI to do a full build label Jun 24, 2024
Copy link
Contributor

@sydney-runkle sydney-runkle left a comment

Choose a reason for hiding this comment

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

Looks great, pending CI :).

@sydney-runkle
Copy link
Contributor

Ah also we can update pyproject.toml to reflect 3.13 support

@davidhewitt davidhewitt changed the title update to PyO3 0.22 update to PyO3 0.22, add 3.13 support Jun 24, 2024
@davidhewitt davidhewitt marked this pull request as ready for review June 24, 2024 22:21
@davidhewitt davidhewitt enabled auto-merge (squash) June 24, 2024 22:22
@davidhewitt davidhewitt merged commit ef7f81c into main Jun 24, 2024
48 checks passed
@davidhewitt davidhewitt deleted the dh/pyo3-0.22 branch June 24, 2024 22:31
@@ -436,27 +438,33 @@ jobs:
# macos;
# all versions x86_64
# arm pypy and older pythons which can't be run on the arm hardware for PGO
#
# FIXME https://github.com/PyO3/maturin-action/issues/275
# cffi prevents `maturin-action` working on macOS 3.13 for now for the optimized build
Copy link
Contributor

Choose a reason for hiding this comment

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

cffi is close, they have a pre release out with support :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Full Build cause CI to do a full build
Projects
None yet
Development

Successfully merging this pull request may close these issues.

generate_self_schema.py incompatible with Python 3.13.0b1 [Heads up] test_invalid_regex fails with Python 3.13.0a3 (re.Error renamed to PatternError)
2 participants