Skip to content

Conversation

@oylenshpeegul
Copy link
Collaborator

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.

@CarolineMorton CarolineMorton self-requested a review June 4, 2025 21:41
Copy link
Collaborator

@CarolineMorton CarolineMorton left a 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))]
Copy link
Collaborator

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)

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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<()> {
Copy link
Collaborator

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)?;
Copy link
Collaborator

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 CarolineMorton self-requested a review June 5, 2025 09:09
Copy link
Collaborator

@CarolineMorton CarolineMorton left a 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.

@CarolineMorton CarolineMorton merged commit 7371dfa into ehrtools:main Jun 5, 2025
7 checks passed
@oylenshpeegul
Copy link
Collaborator Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants