Skip to content

Commit eb5dffe

Browse files
committed
Bump pyo3 dependency to v0.25
1 parent 2fc127a commit eb5dffe

File tree

6 files changed

+28
-29
lines changed

6 files changed

+28
-29
lines changed

Cargo.lock

Lines changed: 16 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ path = "src/pyskani/_skani/lib.rs"
1919
doctest = false
2020

2121
[build-dependencies.built]
22-
version = "0.7.3"
22+
version = "0.8.0"
2323
features = ["chrono", "cargo-lock"]
2424

2525
[dependencies]
2626
bincode = "1.3.3"
27-
pyo3 = "0.22.5"
28-
pyo3-built = "0.5.0"
27+
pyo3 = "0.25.0"
28+
pyo3-built = "0.6.0"
2929

3030
[dependencies.skani]
3131
version = "0.3.0"

src/pyskani/_skani/hit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl Hit {
5959

6060
/// Return ``repr(self)``.
6161
pub fn __repr__<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
62-
let template = PyString::new_bound(py, "Hit(identity={!r}, query_name={!r}, query_fraction={!r}, reference_name={!r}, reference_fraction={!r})");
62+
let template = PyString::new(py, "Hit(identity={!r}, query_name={!r}, query_fraction={!r}, reference_name={!r}, reference_fraction={!r})");
6363
let fmt = template.call_method1(
6464
pyo3::intern!(py, "format"),
6565
(

src/pyskani/_skani/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,9 @@ impl Database {
377377
match *sketches {
378378
DatabaseStorage::Memory(_) => Ok(py.None()),
379379
DatabaseStorage::Folder(ref folder) | DatabaseStorage::Consolidated(ref folder, _) => {
380-
let pathlib = py.import_bound(pyo3::intern!(py, "pathlib"))?;
380+
let pathlib = py.import(pyo3::intern!(py, "pathlib"))?;
381381
let path = pathlib.call_method1(pyo3::intern!(py, "Path"), (folder,))?;
382-
Ok(path.to_object(py))
382+
Ok(path.into())
383383
}
384384
}
385385
} else {

src/pyskani/_skani/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use pyo3::exceptions::PyOSError;
1616
/// Try to obtain a path from a Python object using `os.fsdecode`.
1717
pub fn fsdecode<'py>(object: &Bound<'py, PyAny>) -> PyResult<Bound<'py, PyString>> {
1818
let py = object.py();
19-
py.import_bound(pyo3::intern!(py, "os"))?
19+
py.import(pyo3::intern!(py, "os"))?
2020
.call_method1(pyo3::intern!(py, "fsdecode"), (object,))
2121
.and_then(|x| x.extract())
2222
}
@@ -66,7 +66,7 @@ impl Text {
6666
} else if let Ok(bytes) = object.downcast::<PyByteArray>() {
6767
Ok(Text::Bytes(PyBackedBytes::from(bytes.clone())))
6868
} else {
69-
let buffer = PyBuffer::get_bound(&object)?;
69+
let buffer = PyBuffer::get(&object)?;
7070
let contents = buffer.to_vec(object.py())?;
7171
Ok(Text::Vec(contents))
7272
}

src/pyskani/tests/unittest.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub fn main() -> PyResult<()> {
2727
Python::with_gil(|py| {
2828
// insert the project folder in `sys.modules` so that
2929
// the main module can be imported by Python
30-
let sys = py.import_bound("sys").unwrap();
30+
let sys = py.import("sys").unwrap();
3131
sys.getattr("path")
3232
.unwrap()
3333
.downcast::<PyList>()
@@ -36,7 +36,7 @@ pub fn main() -> PyResult<()> {
3636
.unwrap();
3737

3838
// create a Python module from our rust code with debug symbols
39-
let module = PyModule::new_bound(py, "pyskani._skani").unwrap();
39+
let module = PyModule::new(py, "pyskani._skani").unwrap();
4040
pyskani::init(py, &module).unwrap();
4141
sys.getattr("modules")
4242
.unwrap()
@@ -46,10 +46,10 @@ pub fn main() -> PyResult<()> {
4646
.unwrap();
4747

4848
// run unittest on the tests
49-
let kwargs = PyDict::new_bound(py);
49+
let kwargs = PyDict::new(py);
5050
kwargs.set_item("exit", false).unwrap();
5151
kwargs.set_item("verbosity", 2u8).unwrap();
52-
py.import_bound("unittest")
52+
py.import("unittest")
5353
.unwrap()
5454
.call_method("TestProgram", ("pyskani.tests",), Some(&kwargs))
5555
.map(|_| ())

0 commit comments

Comments
 (0)