-
Notifications
You must be signed in to change notification settings - Fork 3
Update PyO3 to 0.25 #82
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
Conversation
Followed steps listed here: https://pyo3.rs/v0.25.0/migration.html#from-020-to-021
Followed the guide here: https://pyo3.rs/v0.25.0/migration.html#from-021-to-022 This allowed upgrading Python from 3.12 to 3.13
changed 0.23 to 0.24 with no issues changed 0.24 to 0.25 with no issues
CarolineMorton
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great and I can see what you mean by it being a bit hairy. I know you have tested this locally with python 3.13 but i think we should add this into our CI matrix:
| python-version: [ "3.9", "3.10", "3.11", "3.12" ] |
so we can be completely sure. Are you happy to add this in?
|
|
||
| /// Add an entry to the codelist | ||
| #[pyo3(text_signature = "($self, code, term=None, comment=None)")] | ||
| #[pyo3(signature = (code, term=None, comment=None))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm doubting myself now. I put these in the first place but i can see i only did it for a couple of the methods but not others. And they still seem to work. which makes me think that maybe we don't them at all. What do you think? Is the signature for overwriting the argument names maybe?
Great job anyway. Nice to see that their macro is actually getting simplier (signature vs text_signature)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am happy to add this in, but I don't seem to be able to. I don't understand what's going on.
For the signature stuff, I think we do need it now. I'm not sure about text_signature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And, yeah, I think we should test for 3.13 and I think it should work (it works on my machine...famous last words). If we're lucky, it will work with 3.14 (when it comes out) with no changes.
| /// Top-level Python module `codelists_rs` | ||
| #[pymodule] | ||
| fn codelists_rs(py: Python, m: &PyModule) -> PyResult<()> { | ||
| fn codelists_rs(py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one !
| let codelist_module = PyModule::new(py, "codelist")?; | ||
| codelist_module.add_class::<PyCodeList>()?; | ||
| m.add_submodule(codelist_module)?; | ||
| m.add_submodule(&codelist_module)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brilliant - so now we do borrows!
CarolineMorton
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one. I have added that 3.13 to testing. Not sure why it failed when you did it as I just did the exact same thing. Anyway I am happy to approve - thanks so mcuh for doing this - and let's get it merged in.
|
Thanks so much for taking care of this! I don't know what happened. I got frustrated and walked away last night; this morning, it's all settled! |
This is to allow it to work under Python 3.13 as described in #64
This was a little hairy, so I did not squash the commits or rebase or anything. I followed the nice guide at pyo3.rs
0.20 -> 0.21
0.21 -> 0.22
0.22 -> 0.23
Then it went from 0.23 to 0.25 without further modification.