Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/run_python_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions bindings/python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ name = "codelists_rs"
crate-type = ["cdylib"]

[dependencies]
pyo3 = { version = "0.20.3", features = ["extension-module"] }
pyo3 = { version = "0.25", features = ["extension-module"] }
chrono = { version = "0.4.39", features = ["serde"] }
codelist-rs = { path = "../../rust/codelist-rs" }
codelist-validator-rs = { path = "../../rust/codelist-validator-rs" }
indexmap = "2.9.0"
indexmap = "2.9.0"
3 changes: 2 additions & 1 deletion bindings/python/src/codelist.rs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl PyCodeList {
}

/// 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.

fn add_entry(
&mut self,
code: String,
Expand Down Expand Up @@ -370,6 +370,7 @@ impl PyCodeList {
}

/// Add Validation Information to the codelist
#[pyo3(signature = (reviewer, status=None, notes=None))]
fn add_validation_info(
&mut self,
reviewer: String,
Expand Down
6 changes: 3 additions & 3 deletions bindings/python/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ use factory::PyCodeListFactory;

/// 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 !

// Add codelist submodule
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!


// Register it globally under the full dotted path
py.import("sys")?.getattr("modules")?.set_item("codelists_rs.codelist", codelist_module)?;

// Add factory submodule
let factory_module = PyModule::new(py, "factory")?;
factory_module.add_class::<PyCodeListFactory>()?;
m.add_submodule(factory_module)?;
m.add_submodule(&factory_module)?;

// Register it globally under the full dotted path
py.import("sys")?.getattr("modules")?.set_item("codelists_rs.factory", factory_module)?;
Expand Down
Loading