From 51e5937abe07e272fb1c37d28bd6f58efc4d782d Mon Sep 17 00:00:00 2001 From: Congyu WANG Date: Sun, 9 Nov 2025 11:44:34 +0800 Subject: [PATCH 01/10] Update to pyo3-26 --- Cargo.lock | 22 ++++++++++------------ Cargo.toml | 2 +- src/encoder.rs | 4 ++-- src/iter.rs | 4 ++-- src/options.rs | 4 ++-- src/rdict.rs | 31 +++++++++++++++---------------- src/snapshot.rs | 2 +- src/sst_file_writer.rs | 4 ++-- src/write_batch.rs | 4 ++-- 9 files changed, 37 insertions(+), 40 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 31e0b2e..1736e9d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -315,11 +315,10 @@ dependencies = [ [[package]] name = "pyo3" -version = "0.24.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5203598f366b11a02b13aa20cab591229ff0a89fd121a308a5df751d5fc9219" +checksum = "7ba0117f4212101ee6544044dae45abe1083d30ce7b29c4b5cbdfa2354e07383" dependencies = [ - "cfg-if", "indoc", "libc", "memoffset", @@ -334,19 +333,18 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.24.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99636d423fa2ca130fa5acde3059308006d46f98caac629418e53f7ebb1e9999" +checksum = "4fc6ddaf24947d12a9aa31ac65431fb1b851b8f4365426e182901eabfb87df5f" dependencies = [ - "once_cell", "target-lexicon", ] [[package]] name = "pyo3-ffi" -version = "0.24.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78f9cf92ba9c409279bc3305b5409d90db2d2c22392d443a87df3a1adad59e33" +checksum = "025474d3928738efb38ac36d4744a74a400c901c7596199e20e45d98eb194105" dependencies = [ "libc", "pyo3-build-config", @@ -354,9 +352,9 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.24.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b999cb1a6ce21f9a6b147dcf1be9ffedf02e0043aec74dc390f3007047cecd9" +checksum = "2e64eb489f22fe1c95911b77c44cc41e7c19f3082fc81cce90f657cdc42ffded" dependencies = [ "proc-macro2", "pyo3-macros-backend", @@ -366,9 +364,9 @@ dependencies = [ [[package]] name = "pyo3-macros-backend" -version = "0.24.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "822ece1c7e1012745607d5cf0bcb2874769f0f7cb34c4cde03b9358eb9ef911a" +checksum = "100246c0ecf400b475341b8455a9213344569af29a3c841d29270e53102e0fcf" dependencies = [ "heck", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index e75408b..43b1a41 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,7 @@ bindgen-static = ["rocksdb/bindgen-static"] lto = ["rocksdb/lto"] [dependencies.pyo3] -version = "0.24" +version = "0.26" features = ["py-clone", "extension-module", "num-bigint"] [profile.release] diff --git a/src/encoder.rs b/src/encoder.rs index 98ffd00..1f42c5f 100644 --- a/src/encoder.rs +++ b/src/encoder.rs @@ -66,7 +66,7 @@ pub(crate) fn encode_key<'a>(key: &'a Bound, raw_mode: bool) -> PyResult< #[inline(always)] pub(crate) fn encode_value<'a>( value: &'a Bound, - dumps: &PyObject, + dumps: &Py, raw_mode: bool, ) -> PyResult> { if raw_mode { @@ -126,7 +126,7 @@ fn py_to_value_types<'a, 'b>(value: &'a Bound<'b, PyAny>) -> PyResult( py: Python<'py>, bytes: &[u8], - loads: &PyObject, + loads: &Py, raw_mode: bool, ) -> PyResult> { // directly return bytes if raw_mode is true diff --git a/src/iter.rs b/src/iter.rs index e228694..2c8f493 100644 --- a/src/iter.rs +++ b/src/iter.rs @@ -26,7 +26,7 @@ pub(crate) struct RdictIter { pub(crate) readopts: ReadOpt, /// use pickle loads to convert bytes to pyobjects - pub(crate) loads: PyObject, + pub(crate) loads: Py, pub(crate) raw_mode: bool, } @@ -66,7 +66,7 @@ impl RdictIter { db: &DbReferenceHolder, cf: &Option>, readopts: ReadOptionsPy, - pickle_loads: &PyObject, + pickle_loads: &Py, raw_mode: bool, py: Python, ) -> PyResult { diff --git a/src/options.rs b/src/options.rs index 59d25ab..0aeeaba 100644 --- a/src/options.rs +++ b/src/options.rs @@ -179,8 +179,8 @@ pub(crate) struct FlushOptionsPy { #[derive(Clone)] pub(crate) struct ReadOptionsPy { fill_cache: bool, - iterate_upper_bound: PyObject, - iterate_lower_bound: PyObject, + iterate_upper_bound: Py, + iterate_lower_bound: Py, prefix_same_as_start: bool, total_order_seek: bool, max_skippable_internal_keys: u64, diff --git a/src/rdict.rs b/src/rdict.rs index 5f0a087..e316fbc 100644 --- a/src/rdict.rs +++ b/src/rdict.rs @@ -70,8 +70,8 @@ pub(crate) struct Rdict { pub(crate) write_opt: WriteOptions, pub(crate) flush_opt: FlushOptionsPy, pub(crate) read_opt: ReadOptions, - pub(crate) loads: PyObject, - pub(crate) dumps: PyObject, + pub(crate) loads: Py, + pub(crate) dumps: Py, pub(crate) write_opt_py: WriteOptionsPy, pub(crate) read_opt_py: ReadOptionsPy, pub(crate) column_family: Option>, @@ -300,12 +300,12 @@ impl Rdict { } /// set custom dumps function - fn set_dumps(&mut self, dumps: PyObject) { + fn set_dumps(&mut self, dumps: Py) { self.dumps = dumps } /// set custom loads function - fn set_loads(&mut self, loads: PyObject) { + fn set_loads(&mut self, loads: Py) { self.loads = loads } @@ -893,7 +893,7 @@ impl Rdict { fn flush(&self, wait: bool, py: Python) -> PyResult<()> { let db = self.get_db()?; - py.allow_threads(|| { + py.detach(|| { let mut f_opt = FlushOptions::new(); f_opt.set_wait(wait); if let Some(cf) = &self.column_family { @@ -910,7 +910,7 @@ impl Rdict { #[pyo3(signature = (sync = true))] fn flush_wal(&self, sync: bool, py: Python) -> PyResult<()> { let db = self.get_db()?; - py.allow_threads(|| db.flush_wal(sync)) + py.detach(|| db.flush_wal(sync)) .map_err(|e| PyException::new_err(e.into_string())) } @@ -1053,7 +1053,7 @@ impl Rdict { /// opts: IngestExternalFileOptionsPy instance #[pyo3(signature = ( paths, - opts = Python::with_gil(|py| Py::new(py, IngestExternalFileOptionsPy::new()).unwrap()) + opts = Python::attach(|py| Py::new(py, IngestExternalFileOptionsPy::new()).unwrap()) ))] fn ingest_external_file( &self, @@ -1170,14 +1170,14 @@ impl Rdict { if let AccessTypeInner::ReadOnly { .. } | AccessTypeInner::Secondary { .. } = &self.access_type.0 { - py.allow_threads(|| { + py.detach(|| { drop(self.column_family.take()); self.db.close(); }); return Ok(()); } - let (flush_wal_result, flush_result) = py.allow_threads(|| { + let (flush_wal_result, flush_result) = py.detach(|| { let f_opt = &self.flush_opt; let db = self.get_db()?; @@ -1211,7 +1211,7 @@ impl Rdict { } /// Runs a manual compaction on the Range of keys given for the current Column Family. - #[pyo3(signature = (begin, end, compact_opt = Python::with_gil(|py| Py::new(py, CompactOptionsPy::default()).unwrap())))] + #[pyo3(signature = (begin, end, compact_opt = Python::attach(|py| Py::new(py, CompactOptionsPy::default()).unwrap())))] fn compact_range( &self, begin: &Bound, @@ -1232,7 +1232,7 @@ impl Rdict { } else { Some(encode_key(end, self.opt_py.raw_mode)?) }; - py.allow_threads(|| { + py.detach(|| { if let Some(cf) = &self.column_family { db.compact_range_cf_opt(cf, from, to, &opt_ref.0) } else { @@ -1315,7 +1315,7 @@ impl Rdict { fn destroy(path: &str, options: OptionsPy, py: Python) -> PyResult<()> { let inner_opt = options.inner_opt; - py.allow_threads(|| { + py.detach(|| { fs::remove_file(config_file(path)).ok(); DB::destroy(&inner_opt, path) }) @@ -1332,7 +1332,7 @@ impl Rdict { fn repair(path: &str, options: OptionsPy, py: Python) -> PyResult<()> { let inner_opt = options.inner_opt; - py.allow_threads(|| DB::repair(&inner_opt, path)) + py.detach(|| DB::repair(&inner_opt, path)) .map_err(|e| PyException::new_err(e.to_string())) } @@ -1346,7 +1346,7 @@ impl Rdict { fn display_live_file_dict<'py>( lf: LiveFile, py: Python<'py>, - pickle_loads: &PyObject, + pickle_loads: &Py, raw_mode: bool, ) -> PyResult> { let result = PyDict::new(py); @@ -1382,8 +1382,7 @@ impl Rdict { for key in keys_py.iter() { keys.push(encode_key(key, self.opt_py.raw_mode)?); } - let values = - py.allow_threads(|| db.batched_multi_get_cf_opt(cf, &keys, false, &self.read_opt)); + let values = py.detach(|| db.batched_multi_get_cf_opt(cf, &keys, false, &self.read_opt)); let result = PyList::empty(py); for v in values { match v { diff --git a/src/snapshot.rs b/src/snapshot.rs index 686715c..aaf6a7a 100644 --- a/src/snapshot.rs +++ b/src/snapshot.rs @@ -40,7 +40,7 @@ use std::sync::Arc; pub struct Snapshot { pub(crate) inner: *const librocksdb_sys::rocksdb_snapshot_t, pub(crate) column_family: Option>, - pub(crate) pickle_loads: PyObject, + pub(crate) pickle_loads: Py, pub(crate) read_opt: ReadOptions, // decrease db Rc last pub(crate) db: DbReferenceHolder, diff --git a/src/sst_file_writer.rs b/src/sst_file_writer.rs index f476442..08bce87 100644 --- a/src/sst_file_writer.rs +++ b/src/sst_file_writer.rs @@ -18,7 +18,7 @@ use std::ffi::CString; pub struct SstFileWriterPy { pub(crate) inner: *mut librocksdb_sys::rocksdb_sstfilewriter_t, opts: Options, - dumps: PyObject, + dumps: Py, raw_mode: bool, } @@ -69,7 +69,7 @@ impl SstFileWriterPy { } /// set custom dumps function - fn set_dumps(&mut self, dumps: PyObject) { + fn set_dumps(&mut self, dumps: Py) { self.dumps = dumps } diff --git a/src/write_batch.rs b/src/write_batch.rs index baca3ea..4f9630d 100644 --- a/src/write_batch.rs +++ b/src/write_batch.rs @@ -38,7 +38,7 @@ macro_rules! inner_mut { pub(crate) struct WriteBatchPy { inner: Option, default_column_family: Option, - dumps: PyObject, + dumps: Py, pub(crate) raw_mode: bool, } @@ -65,7 +65,7 @@ impl WriteBatchPy { } /// change to a custom dumps function - pub fn set_dumps(&mut self, dumps: PyObject) { + pub fn set_dumps(&mut self, dumps: Py) { self.dumps = dumps } From 21a190a38f7fa754dac2f8ef663957040c24a53e Mon Sep 17 00:00:00 2001 From: Congyu WANG Date: Sun, 9 Nov 2025 12:31:50 +0800 Subject: [PATCH 02/10] update-rust-rocksdb --- Cargo.lock | 46 ++++++++++++++++------------------------------ Cargo.toml | 2 +- rust-rocksdb | 2 +- src/encoder.rs | 16 ++++++++-------- src/iter.rs | 5 +++-- src/options.rs | 4 ++-- src/rdict.rs | 4 ++-- 7 files changed, 33 insertions(+), 46 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1736e9d..6beec9f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -32,16 +32,14 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bindgen" -version = "0.69.5" +version = "0.72.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" +checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895" dependencies = [ "bitflags", "cexpr", "clang-sys", "itertools", - "lazy_static", - "lazycell", "proc-macro2", "quote", "regex", @@ -164,18 +162,6 @@ dependencies = [ "libc", ] -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - [[package]] name = "libc" version = "0.2.172" @@ -199,7 +185,6 @@ dependencies = [ "bindgen", "bzip2-sys", "cc", - "glob", "libc", "libz-sys", "lz4-sys", @@ -315,14 +300,15 @@ dependencies = [ [[package]] name = "pyo3" -version = "0.26.0" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ba0117f4212101ee6544044dae45abe1083d30ce7b29c4b5cbdfa2354e07383" +checksum = "37a6df7eab65fc7bee654a421404947e10a0f7085b6951bf2ea395f4659fb0cf" dependencies = [ "indoc", "libc", "memoffset", "num-bigint", + "num-traits", "once_cell", "portable-atomic", "pyo3-build-config", @@ -333,18 +319,18 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.26.0" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fc6ddaf24947d12a9aa31ac65431fb1b851b8f4365426e182901eabfb87df5f" +checksum = "f77d387774f6f6eec64a004eac0ed525aab7fa1966d94b42f743797b3e395afb" dependencies = [ "target-lexicon", ] [[package]] name = "pyo3-ffi" -version = "0.26.0" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "025474d3928738efb38ac36d4744a74a400c901c7596199e20e45d98eb194105" +checksum = "2dd13844a4242793e02df3e2ec093f540d948299a6a77ea9ce7afd8623f542be" dependencies = [ "libc", "pyo3-build-config", @@ -352,9 +338,9 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.26.0" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e64eb489f22fe1c95911b77c44cc41e7c19f3082fc81cce90f657cdc42ffded" +checksum = "eaf8f9f1108270b90d3676b8679586385430e5c0bb78bb5f043f95499c821a71" dependencies = [ "proc-macro2", "pyo3-macros-backend", @@ -364,9 +350,9 @@ dependencies = [ [[package]] name = "pyo3-macros-backend" -version = "0.26.0" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "100246c0ecf400b475341b8455a9213344569af29a3c841d29270e53102e0fcf" +checksum = "70a3b2274450ba5288bc9b8c1b69ff569d1d61189d4bff38f8d22e03d17f932b" dependencies = [ "heck", "proc-macro2", @@ -421,7 +407,7 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "rocksdb" -version = "0.22.0" +version = "0.24.0" dependencies = [ "libc", "librocksdb-sys", @@ -429,9 +415,9 @@ dependencies = [ [[package]] name = "rustc-hash" -version = "1.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" [[package]] name = "ryu" diff --git a/Cargo.toml b/Cargo.toml index 43b1a41..e26cfb0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,7 @@ bindgen-static = ["rocksdb/bindgen-static"] lto = ["rocksdb/lto"] [dependencies.pyo3] -version = "0.26" +version = "0.27" features = ["py-clone", "extension-module", "num-bigint"] [profile.release] diff --git a/rust-rocksdb b/rust-rocksdb index 66ff530..c7157f8 160000 --- a/rust-rocksdb +++ b/rust-rocksdb @@ -1 +1 @@ -Subproject commit 66ff53024bb6291800aa313ec5780fc1e23c9ce7 +Subproject commit c7157f810f16cd1db9f3ffbfe3943f188e04823c diff --git a/src/encoder.rs b/src/encoder.rs index 1f42c5f..cdbb38b 100644 --- a/src/encoder.rs +++ b/src/encoder.rs @@ -28,7 +28,7 @@ pub(crate) fn encoding_byte(v_type: &ValueTypes) -> u8 { #[inline(always)] pub(crate) fn encode_key<'a>(key: &'a Bound, raw_mode: bool) -> PyResult> { if raw_mode { - return if let Ok(value) = key.downcast::() { + return if let Ok(value) = key.cast::() { Ok(Cow::Borrowed(value.as_bytes())) } else { Err(PyKeyError::new_err("raw mode only support bytes")) @@ -70,7 +70,7 @@ pub(crate) fn encode_value<'a>( raw_mode: bool, ) -> PyResult> { if raw_mode { - if let Ok(value) = value.downcast::() { + if let Ok(value) = value.cast::() { Ok(Cow::Borrowed(value.as_bytes())) } else { Err(PyValueError::new_err("raw mode only support bytes")) @@ -93,7 +93,7 @@ pub(crate) fn encode_value<'a>( ValueTypes::Any(value) => { let py = value.py(); let pickle_bytes = dumps.call1(py, (value,))?; - let bytes: &[u8] = pickle_bytes.downcast_bound::(py)?.as_bytes(); + let bytes: &[u8] = pickle_bytes.cast_bound::(py)?.as_bytes(); concat_type_encoding(type_encoding, bytes) } }; @@ -103,19 +103,19 @@ pub(crate) fn encode_value<'a>( #[inline(always)] fn py_to_value_types<'a, 'b>(value: &'a Bound<'b, PyAny>) -> PyResult> { - if let Ok(value) = value.downcast::() { + if let Ok(value) = value.cast::() { return Ok(ValueTypes::Bool(value.extract()?)); } - if let Ok(value) = value.downcast::() { + if let Ok(value) = value.cast::() { return Ok(ValueTypes::Bytes(value.as_bytes())); } - if let Ok(value) = value.downcast::() { + if let Ok(value) = value.cast::() { return Ok(ValueTypes::String(value.to_str()?)); } - if let Ok(value) = value.downcast::() { + if let Ok(value) = value.cast::() { return Ok(ValueTypes::Int(value.extract()?)); } - if let Ok(value) = value.downcast::() { + if let Ok(value) = value.cast::() { return Ok(ValueTypes::Float(value.value())); } Ok(ValueTypes::Any(value)) diff --git a/src/iter.rs b/src/iter.rs index 2c8f493..81ff1aa 100644 --- a/src/iter.rs +++ b/src/iter.rs @@ -8,7 +8,8 @@ use libc::{c_char, c_uchar, size_t}; use pyo3::exceptions::PyException; use pyo3::prelude::*; use pyo3::types::{PyList, PyTuple}; -use rocksdb::{AsColumnFamilyRef, Iterable as _, UnboundColumnFamily}; +use rocksdb::wide_columns::{Iterable as _, WideColumns}; +use rocksdb::{AsColumnFamilyRef, UnboundColumnFamily}; use std::ptr::null_mut; use std::sync::{Arc, Mutex}; @@ -313,7 +314,7 @@ impl RdictIter { pub fn columns<'py>(&self, py: Python<'py>) -> PyResult> { if self.valid() { let columns = unsafe { - rocksdb::WideColumns::from_c(librocksdb_sys::rocksdb_iter_columns( + WideColumns::from_c(librocksdb_sys::rocksdb_iter_columns( *self.inner.lock().unwrap(), )) }; diff --git a/src/options.rs b/src/options.rs index 0aeeaba..328a47f 100644 --- a/src/options.rs +++ b/src/options.rs @@ -782,7 +782,7 @@ impl OptionsPy { pub fn set_db_paths(&mut self, paths: &Bound) -> PyResult<()> { let mut db_paths = Vec::with_capacity(paths.len()); for p in paths.iter() { - let path: &Bound = p.downcast()?; + let path: &Bound = p.cast()?; db_paths.push( match DBPath::new(&path.borrow().path, path.borrow().target_size) { Ok(p) => p, @@ -898,7 +898,7 @@ impl OptionsPy { pub fn set_compression_per_level(&mut self, level_types: &Bound) -> PyResult<()> { let mut result = Vec::with_capacity(level_types.len()); for py_any in level_types.iter() { - let level_type: &Bound = py_any.downcast()?; + let level_type: &Bound = py_any.cast()?; result.push(level_type.borrow().0) } self.inner_opt.set_compression_per_level(&result); diff --git a/src/rdict.rs b/src/rdict.rs index e316fbc..5f7bc27 100644 --- a/src/rdict.rs +++ b/src/rdict.rs @@ -11,7 +11,7 @@ use pyo3::exceptions::{PyException, PyKeyError}; use pyo3::prelude::*; use pyo3::types::{PyDict, PyList, PyTuple}; use rocksdb::{ - ColumnFamilyDescriptor, FlushOptions, Iterable as _, LiveFile, ReadOptions, + wide_columns::Iterable as _, ColumnFamilyDescriptor, FlushOptions, LiveFile, ReadOptions, UnboundColumnFamily, WriteOptions, DEFAULT_COLUMN_FAMILY_NAME, }; use serde::{Deserialize, Serialize}; @@ -394,7 +394,7 @@ impl Rdict { } Some(cf) => cf.clone(), }; - if let Ok(keys) = key.downcast() { + if let Ok(keys) = key.cast() { return Ok(self.get_batch_inner(db, keys, default, py, &cf)?.into_any()); } let key_bytes = encode_key(key, self.opt_py.raw_mode)?; From 4d64ab9134f4b09d753af9d46e483e78f8798193 Mon Sep 17 00:00:00 2001 From: Congyu WANG Date: Sun, 9 Nov 2025 13:05:44 +0800 Subject: [PATCH 03/10] add-py314 --- .github/workflows/CI.yml | 37 +++++++++++++++++++++++++++++-------- .github/workflows/PR.yml | 37 +++++++++++++++++++++++++++++-------- 2 files changed, 58 insertions(+), 16 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index cb5f7f8..959530e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -64,7 +64,17 @@ jobs: fail-fast: false matrix: py_version: - [3.8, 3.9, "3.10", "3.11", "3.12", "3.13", "pypy3.9", "pypy3.10"] + [ + 3.8, + 3.9, + "3.10", + "3.11", + "3.12", + "3.13", + "3.14", + "pypy3.9", + "pypy3.10", + ] steps: - uses: actions/checkout@v2 with: @@ -119,7 +129,18 @@ jobs: matrix: target: [x64] py_version: - [3.7, 3.8, 3.9, "3.10", "3.11", "3.12", "3.13", "pypy3.9", "pypy3.10"] + [ + 3.7, + 3.8, + 3.9, + "3.10", + "3.11", + "3.12", + "3.13", + "3.14", + "pypy3.9", + "pypy3.10", + ] steps: - uses: actions/checkout@v2 with: @@ -183,7 +204,7 @@ jobs: rustup-components: rustfmt target: ${{ matrix.target }} manylinux: 2_28 - args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10' + args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' container: congyuwang/manylinux_2_28_x86_64:llvm-20.1.5 env: LIBCLANG_PATH: /usr/local/lib @@ -226,7 +247,7 @@ jobs: rustup-components: rustfmt target: ${{ matrix.target }} manylinux: 2014 - args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10' + args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' container: congyuwang/manylinux2014_x86_64:llvm-20.1.5 env: LIBCLANG_PATH: /usr/local/lib @@ -268,7 +289,7 @@ jobs: rustup-components: rustfmt target: ${{ matrix.target }} manylinux: 2_28 - args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10' + args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' container: congyuwang/manylinux_2_28_aarch64:llvm-20.1.5 env: LIBCLANG_PATH: /usr/local/lib @@ -310,7 +331,7 @@ jobs: rustup-components: rustfmt target: ${{ matrix.target }} manylinux: 2014 - args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10' + args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' container: congyuwang/manylinux2014_aarch64:llvm-20.1.5 env: LIBCLANG_PATH: /usr/local/lib @@ -348,7 +369,7 @@ jobs: rustup-components: rustfmt target: ${{ matrix.target }} manylinux: musllinux_1_2 - args: --release --no-default-features --features bindgen-static,lto --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10' + args: --release --no-default-features --features bindgen-static,lto --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' container: congyuwang/musllinux_1_2_x86_64:llvm-20.1.5 before-script-linux: | apk update @@ -396,7 +417,7 @@ jobs: rustup-components: rustfmt target: ${{ matrix.target }} manylinux: musllinux_1_2 - args: --release --no-default-features --features bindgen-static,lto --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10' + args: --release --no-default-features --features bindgen-static,lto --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' container: congyuwang/musllinux_1_2_aarch64:llvm-20.1.5 before-script-linux: | apk update diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml index dace213..eb0fa03 100644 --- a/.github/workflows/PR.yml +++ b/.github/workflows/PR.yml @@ -64,7 +64,17 @@ jobs: fail-fast: false matrix: py_version: - [3.8, 3.9, "3.10", "3.11", "3.12", "3.13", "pypy3.9", "pypy3.10"] + [ + 3.8, + 3.9, + "3.10", + "3.11", + "3.12", + "3.13", + "3.14", + "pypy3.9", + "pypy3.10", + ] steps: - uses: actions/checkout@v2 with: @@ -119,7 +129,18 @@ jobs: matrix: target: [x64] py_version: - [3.7, 3.8, 3.9, "3.10", "3.11", "3.12", "3.13", "pypy3.9", "pypy3.10"] + [ + 3.7, + 3.8, + 3.9, + "3.10", + "3.11", + "3.12", + "3.13", + "3.14", + "pypy3.9", + "pypy3.10", + ] steps: - uses: actions/checkout@v2 with: @@ -183,7 +204,7 @@ jobs: rustup-components: rustfmt target: ${{ matrix.target }} manylinux: 2_28 - args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10' + args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' container: congyuwang/manylinux_2_28_x86_64:llvm-20.1.5 env: LIBCLANG_PATH: /usr/local/lib @@ -226,7 +247,7 @@ jobs: rustup-components: rustfmt target: ${{ matrix.target }} manylinux: 2014 - args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10' + args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' container: congyuwang/manylinux2014_x86_64:llvm-20.1.5 env: LIBCLANG_PATH: /usr/local/lib @@ -268,7 +289,7 @@ jobs: rustup-components: rustfmt target: ${{ matrix.target }} manylinux: 2_28 - args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10' + args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' container: congyuwang/manylinux_2_28_aarch64:llvm-20.1.5 env: LIBCLANG_PATH: /usr/local/lib @@ -310,7 +331,7 @@ jobs: rustup-components: rustfmt target: ${{ matrix.target }} manylinux: 2014 - args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10' + args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' container: congyuwang/manylinux2014_aarch64:llvm-20.1.5 env: LIBCLANG_PATH: /usr/local/lib @@ -348,7 +369,7 @@ jobs: rustup-components: rustfmt target: ${{ matrix.target }} manylinux: musllinux_1_2 - args: --release --no-default-features --features bindgen-static,lto --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10' + args: --release --no-default-features --features bindgen-static,lto --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' container: congyuwang/musllinux_1_2_x86_64:llvm-20.1.5 before-script-linux: | apk update @@ -396,7 +417,7 @@ jobs: rustup-components: rustfmt target: ${{ matrix.target }} manylinux: musllinux_1_2 - args: --release --no-default-features --features bindgen-static,lto --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10' + args: --release --no-default-features --features bindgen-static,lto --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' container: congyuwang/musllinux_1_2_aarch64:llvm-20.1.5 before-script-linux: | apk update From 5ab70b4b20a0538645de06610dfca269f9d73954 Mon Sep 17 00:00:00 2001 From: Congyu WANG Date: Sun, 9 Nov 2025 19:03:28 +0800 Subject: [PATCH 04/10] upgrade to llvm21 + rust v1.91 --- .github/workflows/CI.yml | 70 +++++++++++++++---------------- .github/workflows/PR.yml | 70 +++++++++++++++---------------- .github/workflows/rust-clippy.yml | 2 +- 3 files changed, 71 insertions(+), 71 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 959530e..0903a7c 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -15,10 +15,10 @@ jobs: - uses: actions/checkout@v2 with: submodules: recursive - - name: Install llvm-20 + - name: Install llvm-21 run: | brew update - brew install llvm@20 + brew install llvm@21 brew install lld - uses: actions/setup-python@v5 with: @@ -27,7 +27,7 @@ jobs: - name: Install Rust toolchain uses: actions-rs/toolchain@v1 with: - toolchain: 1.87.0 + toolchain: 1.91.0 default: true - name: Build wheels run: | @@ -35,10 +35,10 @@ jobs: pip install maturin eval "$(brew shellenv)" export MACOSX_DEPLOYMENT_TARGET=10.14 - export LIBCLANG_PATH=${HOMEBREW_PREFIX}/opt/llvm@20/lib - export CC=${HOMEBREW_PREFIX}/opt/llvm@20/bin/clang - export CXX=${HOMEBREW_PREFIX}/opt/llvm@20/bin/clang++ - export AR=${HOMEBREW_PREFIX}/opt/llvm@20/bin/llvm-ar + export LIBCLANG_PATH=${HOMEBREW_PREFIX}/opt/llvm@21/lib + export CC=${HOMEBREW_PREFIX}/opt/llvm@21/bin/clang + export CXX=${HOMEBREW_PREFIX}/opt/llvm@21/bin/clang++ + export AR=${HOMEBREW_PREFIX}/opt/llvm@21/bin/llvm-ar export CFLAGS="-flto=thin -O3 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" export CXXFLAGS="-flto=thin -O3 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" export LLD=${HOMEBREW_PREFIX}/opt/lld/bin/ld64.lld @@ -79,10 +79,10 @@ jobs: - uses: actions/checkout@v2 with: submodules: recursive - - name: Install llvm-20 + - name: Install llvm-21 run: | brew update - brew install llvm@20 + brew install llvm@21 brew install lld - uses: actions/setup-python@v5 with: @@ -91,7 +91,7 @@ jobs: - name: Install Rust toolchain uses: actions-rs/toolchain@v1 with: - toolchain: 1.87.0 + toolchain: 1.91.0 default: true - name: Build wheels run: | @@ -99,10 +99,10 @@ jobs: pip install maturin eval "$(brew shellenv)" export MACOSX_DEPLOYMENT_TARGET=10.14 - export LIBCLANG_PATH=${HOMEBREW_PREFIX}/opt/llvm@20/lib - export CC=${HOMEBREW_PREFIX}/opt/llvm@20/bin/clang - export CXX=${HOMEBREW_PREFIX}/opt/llvm@20/bin/clang++ - export AR=${HOMEBREW_PREFIX}/opt/llvm@20/bin/llvm-ar + export LIBCLANG_PATH=${HOMEBREW_PREFIX}/opt/llvm@21/lib + export CC=${HOMEBREW_PREFIX}/opt/llvm@21/bin/clang + export CXX=${HOMEBREW_PREFIX}/opt/llvm@21/bin/clang++ + export AR=${HOMEBREW_PREFIX}/opt/llvm@21/bin/llvm-ar export CFLAGS="-flto=thin -O3 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" export CXXFLAGS="-flto=thin -O3 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" export LLD=${HOMEBREW_PREFIX}/opt/lld/bin/ld64.lld @@ -152,12 +152,12 @@ jobs: - name: Install LLVM and Clang uses: KyleMayes/install-llvm-action@v2.0.7 with: - version: 20.1.4 - directory: ${{ runner.temp }}/llvm-20.1.4 + version: 21.1.3 + directory: ${{ runner.temp }}/llvm-21.1.3 - name: Install Rust toolchain uses: actions-rs/toolchain@v1 with: - toolchain: 1.87.0 + toolchain: 1.91.0 default: true - name: Build wheels uses: messense/maturin-action@v1 @@ -165,10 +165,10 @@ jobs: target: ${{ matrix.target }} args: --release --out dist --no-default-features --features bindgen-runtime env: - LIBCLANG_PATH: ${{ runner.temp }}/llvm-20.1.4/lib - CC: ${{ runner.temp }}/llvm-20.1.4/bin/clang-cl - CXX: ${{ runner.temp }}/llvm-20.1.4/bin/clang-cl - AR: ${{ runner.temp }}/llvm-20.1.4/bin/llvm-lib + LIBCLANG_PATH: ${{ runner.temp }}/llvm-21.1.3/lib + CC: ${{ runner.temp }}/llvm-21.1.3/bin/clang-cl + CXX: ${{ runner.temp }}/llvm-21.1.3/bin/clang-cl + AR: ${{ runner.temp }}/llvm-21.1.3/bin/llvm-lib CFLAGS: "/clang:-flto=thin /clang:-O3 /clang:-fuse-ld=lld-link" CXXFLAGS: "/clang:-flto=thin /clang:-O3 /clang:-fuse-ld=lld-link" RUSTFLAGS: "-Clinker-plugin-lto -Clinker=lld-link" @@ -200,12 +200,12 @@ jobs: - name: Build Wheels uses: messense/maturin-action@v1 with: - rust-toolchain: 1.87.0 + rust-toolchain: 1.91.0 rustup-components: rustfmt target: ${{ matrix.target }} manylinux: 2_28 args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' - container: congyuwang/manylinux_2_28_x86_64:llvm-20.1.5 + container: congyuwang/manylinux_2_28_x86_64:llvm-21.1.5 env: LIBCLANG_PATH: /usr/local/lib CC: /usr/local/bin/clang @@ -243,12 +243,12 @@ jobs: - name: Build Wheels uses: messense/maturin-action@v1 with: - rust-toolchain: 1.87.0 + rust-toolchain: 1.91.0 rustup-components: rustfmt target: ${{ matrix.target }} manylinux: 2014 args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' - container: congyuwang/manylinux2014_x86_64:llvm-20.1.5 + container: congyuwang/manylinux2014_x86_64:llvm-21.1.5 env: LIBCLANG_PATH: /usr/local/lib CC: /usr/local/bin/clang @@ -285,12 +285,12 @@ jobs: - name: Build Wheels uses: messense/maturin-action@v1 with: - rust-toolchain: 1.87.0 + rust-toolchain: 1.91.0 rustup-components: rustfmt target: ${{ matrix.target }} manylinux: 2_28 args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' - container: congyuwang/manylinux_2_28_aarch64:llvm-20.1.5 + container: congyuwang/manylinux_2_28_aarch64:llvm-21.1.5 env: LIBCLANG_PATH: /usr/local/lib CC: /usr/local/bin/clang @@ -327,12 +327,12 @@ jobs: - name: Build Wheels uses: messense/maturin-action@v1 with: - rust-toolchain: 1.87.0 + rust-toolchain: 1.91.0 rustup-components: rustfmt target: ${{ matrix.target }} manylinux: 2014 args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' - container: congyuwang/manylinux2014_aarch64:llvm-20.1.5 + container: congyuwang/manylinux2014_aarch64:llvm-21.1.5 env: LIBCLANG_PATH: /usr/local/lib CC: /usr/local/bin/clang @@ -365,12 +365,12 @@ jobs: - name: Build Wheels uses: messense/maturin-action@v1 with: - rust-toolchain: 1.87.0 + rust-toolchain: 1.91.0 rustup-components: rustfmt target: ${{ matrix.target }} manylinux: musllinux_1_2 args: --release --no-default-features --features bindgen-static,lto --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' - container: congyuwang/musllinux_1_2_x86_64:llvm-20.1.5 + container: congyuwang/musllinux_1_2_x86_64:llvm-21.1.5 before-script-linux: | apk update apk add ncurses-static @@ -390,7 +390,7 @@ jobs: LIBCLANG_STATIC_PATH: /usr/local/lib - name: Run Tests run: | - docker run --rm -v ${{ github.workspace }}/dist:/dist:ro -v ${{ github.workspace }}/test:/test:ro congyuwang/musllinux_1_2_x86_64:llvm-20.1.5 bash -c " + docker run --rm -v ${{ github.workspace }}/dist:/dist:ro -v ${{ github.workspace }}/test:/test:ro congyuwang/musllinux_1_2_x86_64:llvm-21.1.5 bash -c " python3.12 -m pip install rocksdict --no-index --find-links /dist --force-reinstall || true python3.12 -m pip install speedict --no-index --find-links /dist --force-reinstall || true python3.12 -m unittest discover -v /test" @@ -413,12 +413,12 @@ jobs: - name: Build Wheels uses: messense/maturin-action@v1 with: - rust-toolchain: 1.87.0 + rust-toolchain: 1.91.0 rustup-components: rustfmt target: ${{ matrix.target }} manylinux: musllinux_1_2 args: --release --no-default-features --features bindgen-static,lto --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' - container: congyuwang/musllinux_1_2_aarch64:llvm-20.1.5 + container: congyuwang/musllinux_1_2_aarch64:llvm-21.1.5 before-script-linux: | apk update apk add ncurses-static @@ -438,7 +438,7 @@ jobs: LIBCLANG_STATIC_PATH: /usr/local/lib - name: Run Tests run: | - docker run --rm -v ${{ github.workspace }}/dist:/dist:ro -v ${{ github.workspace }}/test:/test:ro congyuwang/musllinux_1_2_aarch64:llvm-20.1.5 bash -c " + docker run --rm -v ${{ github.workspace }}/dist:/dist:ro -v ${{ github.workspace }}/test:/test:ro congyuwang/musllinux_1_2_aarch64:llvm-21.1.5 bash -c " python3.12 -m pip install rocksdict --no-index --find-links /dist --force-reinstall || true python3.12 -m pip install speedict --no-index --find-links /dist --force-reinstall || true python3.12 -m unittest discover -v /test" diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml index eb0fa03..a9df6c6 100644 --- a/.github/workflows/PR.yml +++ b/.github/workflows/PR.yml @@ -15,10 +15,10 @@ jobs: - uses: actions/checkout@v2 with: submodules: recursive - - name: Install llvm-20 + - name: Install llvm-21 run: | brew update - brew install llvm@20 + brew install llvm@21 brew install lld - uses: actions/setup-python@v5 with: @@ -27,7 +27,7 @@ jobs: - name: Install Rust toolchain uses: actions-rs/toolchain@v1 with: - toolchain: 1.87.0 + toolchain: 1.91.0 default: true - name: Build wheels run: | @@ -35,10 +35,10 @@ jobs: pip install maturin eval "$(brew shellenv)" export MACOSX_DEPLOYMENT_TARGET=10.14 - export LIBCLANG_PATH=${HOMEBREW_PREFIX}/opt/llvm@20/lib - export CC=${HOMEBREW_PREFIX}/opt/llvm@20/bin/clang - export CXX=${HOMEBREW_PREFIX}/opt/llvm@20/bin/clang++ - export AR=${HOMEBREW_PREFIX}/opt/llvm@20/bin/llvm-ar + export LIBCLANG_PATH=${HOMEBREW_PREFIX}/opt/llvm@21/lib + export CC=${HOMEBREW_PREFIX}/opt/llvm@21/bin/clang + export CXX=${HOMEBREW_PREFIX}/opt/llvm@21/bin/clang++ + export AR=${HOMEBREW_PREFIX}/opt/llvm@21/bin/llvm-ar export CFLAGS="-flto=thin -O3 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" export CXXFLAGS="-flto=thin -O3 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" export LLD=${HOMEBREW_PREFIX}/opt/lld/bin/ld64.lld @@ -79,10 +79,10 @@ jobs: - uses: actions/checkout@v2 with: submodules: recursive - - name: Install llvm-20 + - name: Install llvm-21 run: | brew update - brew install llvm@20 + brew install llvm@21 brew install lld - uses: actions/setup-python@v5 with: @@ -91,7 +91,7 @@ jobs: - name: Install Rust toolchain uses: actions-rs/toolchain@v1 with: - toolchain: 1.87.0 + toolchain: 1.91.0 default: true - name: Build wheels run: | @@ -99,10 +99,10 @@ jobs: pip install maturin eval "$(brew shellenv)" export MACOSX_DEPLOYMENT_TARGET=10.14 - export LIBCLANG_PATH=${HOMEBREW_PREFIX}/opt/llvm@20/lib - export CC=${HOMEBREW_PREFIX}/opt/llvm@20/bin/clang - export CXX=${HOMEBREW_PREFIX}/opt/llvm@20/bin/clang++ - export AR=${HOMEBREW_PREFIX}/opt/llvm@20/bin/llvm-ar + export LIBCLANG_PATH=${HOMEBREW_PREFIX}/opt/llvm@21/lib + export CC=${HOMEBREW_PREFIX}/opt/llvm@21/bin/clang + export CXX=${HOMEBREW_PREFIX}/opt/llvm@21/bin/clang++ + export AR=${HOMEBREW_PREFIX}/opt/llvm@21/bin/llvm-ar export CFLAGS="-flto=thin -O3 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" export CXXFLAGS="-flto=thin -O3 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" export LLD=${HOMEBREW_PREFIX}/opt/lld/bin/ld64.lld @@ -152,12 +152,12 @@ jobs: - name: Install LLVM and Clang uses: KyleMayes/install-llvm-action@v2.0.7 with: - version: 20.1.4 - directory: ${{ runner.temp }}/llvm-20.1.4 + version: 21.1.3 + directory: ${{ runner.temp }}/llvm-21.1.3 - name: Install Rust toolchain uses: actions-rs/toolchain@v1 with: - toolchain: 1.87.0 + toolchain: 1.91.0 default: true - name: Build wheels uses: messense/maturin-action@v1 @@ -165,10 +165,10 @@ jobs: target: ${{ matrix.target }} args: --release --out dist --no-default-features --features bindgen-runtime env: - LIBCLANG_PATH: ${{ runner.temp }}/llvm-20.1.4/lib - CC: ${{ runner.temp }}/llvm-20.1.4/bin/clang-cl - CXX: ${{ runner.temp }}/llvm-20.1.4/bin/clang-cl - AR: ${{ runner.temp }}/llvm-20.1.4/bin/llvm-lib + LIBCLANG_PATH: ${{ runner.temp }}/llvm-21.1.3/lib + CC: ${{ runner.temp }}/llvm-21.1.3/bin/clang-cl + CXX: ${{ runner.temp }}/llvm-21.1.3/bin/clang-cl + AR: ${{ runner.temp }}/llvm-21.1.3/bin/llvm-lib CFLAGS: "/clang:-flto=thin /clang:-O3 /clang:-fuse-ld=lld-link" CXXFLAGS: "/clang:-flto=thin /clang:-O3 /clang:-fuse-ld=lld-link" RUSTFLAGS: "-Clinker-plugin-lto -Clinker=lld-link" @@ -200,12 +200,12 @@ jobs: - name: Build Wheels uses: messense/maturin-action@v1 with: - rust-toolchain: 1.87.0 + rust-toolchain: 1.91.0 rustup-components: rustfmt target: ${{ matrix.target }} manylinux: 2_28 args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' - container: congyuwang/manylinux_2_28_x86_64:llvm-20.1.5 + container: congyuwang/manylinux_2_28_x86_64:llvm-21.1.5 env: LIBCLANG_PATH: /usr/local/lib CC: /usr/local/bin/clang @@ -243,12 +243,12 @@ jobs: - name: Build Wheels uses: messense/maturin-action@v1 with: - rust-toolchain: 1.87.0 + rust-toolchain: 1.91.0 rustup-components: rustfmt target: ${{ matrix.target }} manylinux: 2014 args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' - container: congyuwang/manylinux2014_x86_64:llvm-20.1.5 + container: congyuwang/manylinux2014_x86_64:llvm-21.1.5 env: LIBCLANG_PATH: /usr/local/lib CC: /usr/local/bin/clang @@ -285,12 +285,12 @@ jobs: - name: Build Wheels uses: messense/maturin-action@v1 with: - rust-toolchain: 1.87.0 + rust-toolchain: 1.91.0 rustup-components: rustfmt target: ${{ matrix.target }} manylinux: 2_28 args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' - container: congyuwang/manylinux_2_28_aarch64:llvm-20.1.5 + container: congyuwang/manylinux_2_28_aarch64:llvm-21.1.5 env: LIBCLANG_PATH: /usr/local/lib CC: /usr/local/bin/clang @@ -327,12 +327,12 @@ jobs: - name: Build Wheels uses: messense/maturin-action@v1 with: - rust-toolchain: 1.87.0 + rust-toolchain: 1.91.0 rustup-components: rustfmt target: ${{ matrix.target }} manylinux: 2014 args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' - container: congyuwang/manylinux2014_aarch64:llvm-20.1.5 + container: congyuwang/manylinux2014_aarch64:llvm-21.1.5 env: LIBCLANG_PATH: /usr/local/lib CC: /usr/local/bin/clang @@ -365,12 +365,12 @@ jobs: - name: Build Wheels uses: messense/maturin-action@v1 with: - rust-toolchain: 1.87.0 + rust-toolchain: 1.91.0 rustup-components: rustfmt target: ${{ matrix.target }} manylinux: musllinux_1_2 args: --release --no-default-features --features bindgen-static,lto --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' - container: congyuwang/musllinux_1_2_x86_64:llvm-20.1.5 + container: congyuwang/musllinux_1_2_x86_64:llvm-21.1.5 before-script-linux: | apk update apk add ncurses-static @@ -390,7 +390,7 @@ jobs: LIBCLANG_STATIC_PATH: /usr/local/lib - name: Run Tests run: | - docker run --rm -v ${{ github.workspace }}/dist:/dist:ro -v ${{ github.workspace }}/test:/test:ro congyuwang/musllinux_1_2_x86_64:llvm-20.1.5 bash -c " + docker run --rm -v ${{ github.workspace }}/dist:/dist:ro -v ${{ github.workspace }}/test:/test:ro congyuwang/musllinux_1_2_x86_64:llvm-21.1.5 bash -c " python3.12 -m pip install rocksdict --no-index --find-links /dist --force-reinstall || true python3.12 -m pip install speedict --no-index --find-links /dist --force-reinstall || true python3.12 -m unittest discover -v /test" @@ -413,12 +413,12 @@ jobs: - name: Build Wheels uses: messense/maturin-action@v1 with: - rust-toolchain: 1.87.0 + rust-toolchain: 1.91.0 rustup-components: rustfmt target: ${{ matrix.target }} manylinux: musllinux_1_2 args: --release --no-default-features --features bindgen-static,lto --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' - container: congyuwang/musllinux_1_2_aarch64:llvm-20.1.5 + container: congyuwang/musllinux_1_2_aarch64:llvm-21.1.5 before-script-linux: | apk update apk add ncurses-static @@ -438,7 +438,7 @@ jobs: LIBCLANG_STATIC_PATH: /usr/local/lib - name: Run Tests run: | - docker run --rm -v ${{ github.workspace }}/dist:/dist:ro -v ${{ github.workspace }}/test:/test:ro congyuwang/musllinux_1_2_aarch64:llvm-20.1.5 bash -c " + docker run --rm -v ${{ github.workspace }}/dist:/dist:ro -v ${{ github.workspace }}/test:/test:ro congyuwang/musllinux_1_2_aarch64:llvm-21.1.5 bash -c " python3.12 -m pip install rocksdict --no-index --find-links /dist --force-reinstall || true python3.12 -m pip install speedict --no-index --find-links /dist --force-reinstall || true python3.12 -m unittest discover -v /test" diff --git a/.github/workflows/rust-clippy.yml b/.github/workflows/rust-clippy.yml index 1cddc87..740ce45 100644 --- a/.github/workflows/rust-clippy.yml +++ b/.github/workflows/rust-clippy.yml @@ -36,7 +36,7 @@ jobs: uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #@v1 with: profile: minimal - toolchain: 1.87.0 + toolchain: 1.91.0 components: clippy override: true From 397239f8d6933371c5001c9c28a219040f07680c Mon Sep 17 00:00:00 2001 From: Congyu WANG Date: Sun, 9 Nov 2025 19:03:47 +0800 Subject: [PATCH 05/10] deprecated methods --- python/rocksdict/rocksdict.pyi | 386 ++++++++++++++++++++++----------- rust-rocksdb | 2 +- src/options.rs | 29 --- 3 files changed, 256 insertions(+), 161 deletions(-) diff --git a/python/rocksdict/rocksdict.pyi b/python/rocksdict/rocksdict.pyi index a439adb..c4ee9dc 100644 --- a/python/rocksdict/rocksdict.pyi +++ b/python/rocksdict/rocksdict.pyi @@ -3,40 +3,42 @@ from __future__ import annotations from types import TracebackType from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union -__all__ = ["Rdict", - "RdictIter", - "Options", - "WriteOptions", - "ReadOptions", - "DBPath", - "MemtableFactory", - "BlockBasedOptions", - "PlainTableFactoryOptions", - "CuckooTableOptions", - "UniversalCompactOptions", - "UniversalCompactionStopStyle", - "SliceTransform", - "DataBlockIndexType", - "BlockBasedIndexType", - "Cache", - "ChecksumType", - "DBCompactionStyle", - "DBCompressionType", - "DBRecoveryMode", - "Env", - "FifoCompactOptions", - "SstFileWriter", - "IngestExternalFileOptions", - "WriteBatch", - "ColumnFamily", - "AccessType", - "Snapshot", - "CompactOptions", - "BottommostLevelCompaction", - "KeyEncodingType", - "DbClosedError", - "WriteBufferManager", - "Checkpoint"] +__all__ = [ + "Rdict", + "RdictIter", + "Options", + "WriteOptions", + "ReadOptions", + "DBPath", + "MemtableFactory", + "BlockBasedOptions", + "PlainTableFactoryOptions", + "CuckooTableOptions", + "UniversalCompactOptions", + "UniversalCompactionStopStyle", + "SliceTransform", + "DataBlockIndexType", + "BlockBasedIndexType", + "Cache", + "ChecksumType", + "DBCompactionStyle", + "DBCompressionType", + "DBRecoveryMode", + "Env", + "FifoCompactOptions", + "SstFileWriter", + "IngestExternalFileOptions", + "WriteBatch", + "ColumnFamily", + "AccessType", + "Snapshot", + "CompactOptions", + "BottommostLevelCompaction", + "KeyEncodingType", + "DbClosedError", + "WriteBufferManager", + "Checkpoint", +] class DataBlockIndexType: @staticmethod @@ -175,7 +177,12 @@ class MemtableFactory: class Options: def __init__(self, raw_mode: bool = False) -> None: ... @staticmethod - def load_latest(path: str, env: Env = Env(), ignore_unknown_options: bool = False, cache: Cache = Cache(8 * 1024 * 1024)) -> Tuple[Options, Dict[str, Options]]: ... + def load_latest( + path: str, + env: Env = Env(), + ignore_unknown_options: bool = False, + cache: Cache = Cache(8 * 1024 * 1024), + ) -> Tuple[Options, Dict[str, Options]]: ... def create_if_missing(self, create_if_missing: bool) -> None: ... def create_missing_column_families(self, create_missing_cfs: bool) -> None: ... def enable_statistics(self) -> None: ... @@ -183,7 +190,9 @@ class Options: def increase_parallelism(self, parallelism: int) -> None: ... def optimize_for_point_lookup(self, cache_size: int) -> None: ... def optimize_level_style_compaction(self, memtable_memory_budget: int) -> None: ... - def optimize_universal_style_compaction(self, memtable_memory_budget: int) -> None: ... + def optimize_universal_style_compaction( + self, memtable_memory_budget: int + ) -> None: ... def prepare_for_bulk_load(self) -> None: ... def set_advise_random_on_open(self, advise: bool) -> None: ... def set_allow_concurrent_memtable_write(self, allow: bool) -> None: ... @@ -196,11 +205,17 @@ class Options: def set_bytes_per_sync(self, nbytes: int) -> None: ... def set_compaction_readahead_size(self, compaction_readahead_size: int) -> None: ... def set_compaction_style(self, style: DBCompactionStyle) -> None: ... - def set_compression_options(self, w_bits: int, level: int, strategy: int, max_dict_bytes: int) -> None: ... - def set_compression_per_level(self, level_types: List[DBCompressionType]) -> None: ... + def set_compression_options( + self, w_bits: int, level: int, strategy: int, max_dict_bytes: int + ) -> None: ... + def set_compression_per_level( + self, level_types: List[DBCompressionType] + ) -> None: ... def set_compression_type(self, t: DBCompressionType) -> None: ... def set_bottommost_compression_type(self, t: DBCompressionType) -> None: ... - def set_bottommost_compression_options(self, w_bits: int, level: int, strategy: int, max_dict_bytes: int, enable: bool) -> None: ... + def set_bottommost_compression_options( + self, w_bits: int, level: int, strategy: int, max_dict_bytes: int, enable: bool + ) -> None: ... def set_bottommost_zstd_max_train_bytes(self, value: int, enable: bool) -> None: ... def set_cuckoo_table_factory(self, factory: CuckooTableOptions) -> None: ... def set_db_log_dir(self, path: str) -> None: ... @@ -228,7 +243,9 @@ class Options: def set_max_background_jobs(self, jobs: int) -> None: ... def set_max_bytes_for_level_base(self, size: int) -> None: ... def set_max_bytes_for_level_multiplier(self, mul: float) -> None: ... - def set_max_bytes_for_level_multiplier_additional(self, level_values: List[int]) -> None: ... + def set_max_bytes_for_level_multiplier_additional( + self, level_values: List[int] + ) -> None: ... def set_max_compaction_bytes(self, nbytes: int) -> None: ... def set_max_file_opening_threads(self, nthreads: int) -> None: ... def set_max_log_file_size(self, size: int) -> None: ... @@ -252,11 +269,12 @@ class Options: def set_paranoid_checks(self, enabled: bool) -> None: ... def set_plain_table_factory(self, options: PlainTableFactoryOptions) -> None: ... def set_prefix_extractor(self, prefix_extractor: SliceTransform) -> None: ... - def set_ratelimiter(self, rate_bytes_per_sec: int, refill_period_us: int, fairness: int) -> None: ... + def set_ratelimiter( + self, rate_bytes_per_sec: int, refill_period_us: int, fairness: int + ) -> None: ... def set_recycle_log_file_num(self, num: int) -> None: ... def set_report_bg_io_stats(self, enable: bool) -> None: ... def set_row_cache(self, cache: Cache) -> None: ... - def set_skip_checking_sst_file_sizes_on_db_open(self, value: bool) -> None: ... def set_skip_stats_update_on_db_open(self, skip: bool) -> None: ... def set_soft_pending_compaction_bytes_limit(self, limit: int) -> None: ... def set_stats_dump_period_sec(self, period: int) -> None: ... @@ -264,7 +282,9 @@ class Options: def set_table_cache_num_shard_bits(self, nbits: int) -> None: ... def set_target_file_size_base(self, size: int) -> None: ... def set_target_file_size_multiplier(self, multiplier: int) -> None: ... - def set_universal_compaction_options(self, uco: UniversalCompactOptions) -> None: ... + def set_universal_compaction_options( + self, uco: UniversalCompactOptions + ) -> None: ... def set_unordered_write(self, unordered: bool) -> None: ... def set_use_adaptive_mutex(self, enabled: bool) -> None: ... def set_use_direct_io_for_flush_and_compaction(self, enabled: bool) -> None: ... @@ -287,10 +307,16 @@ class Options: def set_blob_gc_force_threshold(self, val: float) -> None: ... def set_blob_compaction_readahead_size(self, val: int) -> None: ... def set_allow_ingest_behind(self, val: bool) -> None: ... - def add_compact_on_deletion_collector_factory(self, window_size: int, num_dels_trigger: int, deletion_ratio: float) -> None: ... - def set_write_buffer_manager(self, write_buffer_manager: WriteBufferManager) -> None: ... + def add_compact_on_deletion_collector_factory( + self, window_size: int, num_dels_trigger: int, deletion_ratio: float + ) -> None: ... + def set_write_buffer_manager( + self, write_buffer_manager: WriteBufferManager + ) -> None: ... def set_avoid_unnecessary_blocking_io(self, val: bool) -> None: ... - def set_auto_tuned_ratelimiter(self, rate_bytes_per_sec: int, refill_period_us: int, fairness: int) -> None: ... + def set_auto_tuned_ratelimiter( + self, rate_bytes_per_sec: int, refill_period_us: int, fairness: int + ) -> None: ... class PlainTableFactoryOptions: @property @@ -315,9 +341,12 @@ class ReadOptions: def __init__(self) -> None: ... def fill_cache(self) -> None: ... def set_background_purge_on_iterator_cleanup(self, v: bool) -> None: ... - def set_ignore_range_deletions(self, v: bool) -> None: ... - def set_iterate_lower_bound(self, key: Union[str, int, float, bytes, bool]) -> None: ... - def set_iterate_upper_bound(self, key: Union[str, int, float, bytes, bool]) -> None: ... + def set_iterate_lower_bound( + self, key: Union[str, int, float, bytes, bool] + ) -> None: ... + def set_iterate_upper_bound( + self, key: Union[str, int, float, bytes, bool] + ) -> None: ... def set_max_skippable_internal_keys(self, num: int) -> None: ... def set_pin_data(self, v: bool) -> None: ... def set_prefix_same_as_start(self, v: bool) -> None: ... @@ -425,15 +454,20 @@ class BottommostLevelCompaction: class CompactOptions: def __init__(self) -> None: ... def set_exclusive_manual_compaction(self, v: bool) -> None: ... - def set_bottommost_level_compaction(self, lvl: BottommostLevelCompaction) -> None: ... + def set_bottommost_level_compaction( + self, lvl: BottommostLevelCompaction + ) -> None: ... def set_change_level(self, v: bool) -> None: ... def set_target_level(self, lvl: int) -> None: ... class Rdict: - def __init__(self, path: str, - options: Optional[Options] = None, - column_families: Optional[Dict[str, Options]] = None, - access_type: AccessType = AccessType.read_write()) -> None: ... + def __init__( + self, + path: str, + options: Optional[Options] = None, + column_families: Optional[Dict[str, Options]] = None, + access_type: AccessType = AccessType.read_write(), + ) -> None: ... def __enter__(self) -> Rdict: ... def set_dumps(self, dumps: Callable[[Any], bytes]) -> None: ... def set_loads(self, dumps: Callable[[bytes], Any]) -> None: ... @@ -441,56 +475,106 @@ class Rdict: def set_write_options(self, write_opt: WriteOptions) -> None: ... def __contains__(self, key: Union[str, int, float, bytes, bool]) -> bool: ... def __delitem__(self, key: Union[str, int, float, bytes, bool]) -> None: ... - def __getitem__(self, key: Union[str, int, float, bytes, bool, List[Union[str, int, float, bytes, bool]]]) -> Any | None: ... - def __setitem__(self, key: Union[str, int, float, bytes, bool], value: Any) -> None: ... - def get(self, - key: Union[str, int, float, bytes, bool, List[Union[str, int, float, bytes, bool]]], - default: Any = None, - read_opt: Optional[ReadOptions] = None) -> Any | None: ... - def get_entity(self, - key: Union[str, int, float, bytes, bool, List[Union[str, int, float, bytes, bool]]], - default: Any = None, - read_opt: Optional[ReadOptions] = None) -> List[Tuple[Any, Any]] | None: ... - def put(self, - key: Union[str, int, float, bytes, bool], - value: Any, - write_opt: Optional[WriteOptions] = None) -> None: ... - def put_entity(self, - key: Union[str, int, float, bytes, bool], - names: List[Any], - values: List[Any], - write_opt: Optional[WriteOptions] = None) -> None: ... - def delete(self, key: Union[str, int, float, bytes, bool], write_opt: Optional[WriteOptions] = None) -> None: ... - def key_may_exist(self, - key: Union[str, int, float, bytes, bool], - fetch: bool = False, - read_opt: Optional[ReadOptions] = None) -> Union[bool, Tuple[bool, Any]]: ... + def __getitem__( + self, + key: Union[ + str, int, float, bytes, bool, List[Union[str, int, float, bytes, bool]] + ], + ) -> Any | None: ... + def __setitem__( + self, key: Union[str, int, float, bytes, bool], value: Any + ) -> None: ... + def get( + self, + key: Union[ + str, int, float, bytes, bool, List[Union[str, int, float, bytes, bool]] + ], + default: Any = None, + read_opt: Optional[ReadOptions] = None, + ) -> Any | None: ... + def get_entity( + self, + key: Union[ + str, int, float, bytes, bool, List[Union[str, int, float, bytes, bool]] + ], + default: Any = None, + read_opt: Optional[ReadOptions] = None, + ) -> List[Tuple[Any, Any]] | None: ... + def put( + self, + key: Union[str, int, float, bytes, bool], + value: Any, + write_opt: Optional[WriteOptions] = None, + ) -> None: ... + def put_entity( + self, + key: Union[str, int, float, bytes, bool], + names: List[Any], + values: List[Any], + write_opt: Optional[WriteOptions] = None, + ) -> None: ... + def delete( + self, + key: Union[str, int, float, bytes, bool], + write_opt: Optional[WriteOptions] = None, + ) -> None: ... + def key_may_exist( + self, + key: Union[str, int, float, bytes, bool], + fetch: bool = False, + read_opt: Optional[ReadOptions] = None, + ) -> Union[bool, Tuple[bool, Any]]: ... def iter(self, read_opt: Optional[ReadOptions] = None) -> RdictIter: ... - def items(self, backwards: bool = False, - from_key: Union[str, int, float, bytes, bool, None] = None, - read_opt: Optional[ReadOptions] = None) -> RdictItems: ... - def keys(self, backwards: bool = False, - from_key: Union[str, int, float, bytes, bool, None] = None, - read_opt: Optional[ReadOptions] = None) -> RdictKeys: ... - def values(self, backwards: bool = False, - from_key: Union[str, int, float, bytes, bool, None] = None, - read_opt: Optional[ReadOptions] = None) -> RdictValues: ... - def columns(self, backwards: bool = False, - from_key: Union[str, int, float, bytes, bool, None] = None, - read_opt: Optional[ReadOptions] = None) -> RdictColumns: ... - def entities(self, backwards: bool = False, - from_key: Union[str, int, float, bytes, bool, None] = None, - read_opt: Optional[ReadOptions] = None) -> RdictEntities: ... - def ingest_external_file(self, paths: List[str], opts: IngestExternalFileOptions = IngestExternalFileOptions()) -> None: ... + def items( + self, + backwards: bool = False, + from_key: Union[str, int, float, bytes, bool, None] = None, + read_opt: Optional[ReadOptions] = None, + ) -> RdictItems: ... + def keys( + self, + backwards: bool = False, + from_key: Union[str, int, float, bytes, bool, None] = None, + read_opt: Optional[ReadOptions] = None, + ) -> RdictKeys: ... + def values( + self, + backwards: bool = False, + from_key: Union[str, int, float, bytes, bool, None] = None, + read_opt: Optional[ReadOptions] = None, + ) -> RdictValues: ... + def columns( + self, + backwards: bool = False, + from_key: Union[str, int, float, bytes, bool, None] = None, + read_opt: Optional[ReadOptions] = None, + ) -> RdictColumns: ... + def entities( + self, + backwards: bool = False, + from_key: Union[str, int, float, bytes, bool, None] = None, + read_opt: Optional[ReadOptions] = None, + ) -> RdictEntities: ... + def ingest_external_file( + self, + paths: List[str], + opts: IngestExternalFileOptions = IngestExternalFileOptions(), + ) -> None: ... def get_column_family(self, name: str) -> Rdict: ... def get_column_family_handle(self, name: str) -> ColumnFamily: ... def drop_column_family(self, name: str) -> None: ... - def create_column_family(self, name: str, options: Options = Options()) -> Rdict: ... - def write(self, write_batch: WriteBatch, write_opt: Optional[WriteOptions] = None) -> None: ... - def delete_range(self, - begin: Union[str, int, float, bytes, bool], - end: Union[str, int, float, bytes, bool], - write_opt: Optional[WriteOptions] = None) -> None: ... + def create_column_family( + self, name: str, options: Options = Options() + ) -> Rdict: ... + def write( + self, write_batch: WriteBatch, write_opt: Optional[WriteOptions] = None + ) -> None: ... + def delete_range( + self, + begin: Union[str, int, float, bytes, bool], + end: Union[str, int, float, bytes, bool], + write_opt: Optional[WriteOptions] = None, + ) -> None: ... def snapshot(self) -> Snapshot: ... def path(self) -> str: ... def set_options(self, options: Dict[str, str]) -> None: ... @@ -498,13 +582,21 @@ class Rdict: def property_int_value(self, name: str) -> Optional[int]: ... def latest_sequence_number(self) -> int: ... def live_files(self) -> List[Dict[str, Any]]: ... - def compact_range(self, begin: Union[str, int, float, bytes, bool, None], - end: Union[str, int, float, bytes, bool, None], - compact_opt: CompactOptions = CompactOptions()) -> None: ... + def compact_range( + self, + begin: Union[str, int, float, bytes, bool, None], + end: Union[str, int, float, bytes, bool, None], + compact_opt: CompactOptions = CompactOptions(), + ) -> None: ... def try_catch_up_with_primary(self) -> None: ... def cancel_all_background(self, wait: bool) -> None: ... def close(self) -> None: ... - def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> None: ... + def __exit__( + self, + exc_type: Optional[Type[BaseException]], + exc_val: Optional[BaseException], + exc_tb: Optional[TracebackType], + ) -> None: ... def flush(self, wait: bool = True) -> None: ... def flush_wal(self, sync: bool = True) -> None: ... @staticmethod @@ -530,9 +622,13 @@ class RdictColumns(Iterator[Any]): def __iter__(self) -> RdictValues: ... def __next__(self) -> List[Tuple[Any, Any]]: ... -class RdictEntities(Iterator[Tuple[Union[str, int, float, bytes, bool], List[Tuple[Any, Any]]]]): +class RdictEntities( + Iterator[Tuple[Union[str, int, float, bytes, bool], List[Tuple[Any, Any]]]] +): def __iter__(self) -> RdictEntities: ... - def __next__(self) -> Tuple[Union[str, int, float, bytes, bool], List[Tuple[Any, Any]]]: ... + def __next__( + self, + ) -> Tuple[Union[str, int, float, bytes, bool], List[Tuple[Any, Any]]]: ... class RdictIter: def valid(self) -> bool: ... @@ -553,50 +649,78 @@ class SstFileWriter: def open(self, path: str) -> None: ... def finish(self) -> None: ... def file_size(self) -> int: ... - def __setitem__(self, key: Union[str, int, float, bytes, bool], value: Any) -> None: ... + def __setitem__( + self, key: Union[str, int, float, bytes, bool], value: Any + ) -> None: ... def __delitem__(self, key: Union[str, int, float, bytes, bool]) -> None: ... class WriteBatch: def __init__(self, raw_mode: bool = False) -> None: ... def __len__(self) -> int: ... - def __setitem__(self, key: Union[str, int, float, bytes, bool], value: Any) -> None: ... + def __setitem__( + self, key: Union[str, int, float, bytes, bool], value: Any + ) -> None: ... def __delitem__(self, key: Union[str, int, float, bytes, bool]) -> None: ... def set_dumps(self, dumps: Callable[[Any], bytes]) -> None: ... - def set_default_column_family(self, column_family: Optional[ColumnFamily]) -> None: ... + def set_default_column_family( + self, column_family: Optional[ColumnFamily] + ) -> None: ... def len(self) -> int: ... def size_in_bytes(self) -> int: ... def is_empty(self) -> bool: ... - def put(self, key: Union[str, int, float, bytes, bool], value: Any, - column_family: Optional[ColumnFamily] = None) -> None: ... - def put_entity(self, - key: Union[str, int, float, bytes, bool], - names: List[Any], - values: List[Any]) -> None: ... - def delete(self, key: Union[str, int, float, bytes, bool], - column_family: Optional[ColumnFamily] = None) -> None: ... - def delete_range(self, begin: Union[str, int, float, bytes, bool], - end: Union[str, int, float, bytes, bool], - column_family: Optional[ColumnFamily] = None) -> None: ... + def put( + self, + key: Union[str, int, float, bytes, bool], + value: Any, + column_family: Optional[ColumnFamily] = None, + ) -> None: ... + def put_entity( + self, + key: Union[str, int, float, bytes, bool], + names: List[Any], + values: List[Any], + ) -> None: ... + def delete( + self, + key: Union[str, int, float, bytes, bool], + column_family: Optional[ColumnFamily] = None, + ) -> None: ... + def delete_range( + self, + begin: Union[str, int, float, bytes, bool], + end: Union[str, int, float, bytes, bool], + column_family: Optional[ColumnFamily] = None, + ) -> None: ... def clear(self) -> None: ... - class Snapshot: def __getitem__(self, key: Union[str, int, float, bytes, bool]) -> Any: ... def iter(self, read_opt: Optional[ReadOptions] = None) -> RdictIter: ... - def items(self, backwards: bool = False, - from_key: Union[str, int, float, bytes, bool, None] = None, - read_opt: Optional[ReadOptions] = None) -> RdictItems: ... - def keys(self, backwards: bool = False, - from_key: Union[str, int, float, bytes, bool, None] = None, - read_opt: Optional[ReadOptions] = None) -> RdictKeys: ... - def values(self, backwards: bool = False, - from_key: Union[str, int, float, bytes, bool, None] = None, - read_opt: Optional[ReadOptions] = None) -> RdictValues: ... + def items( + self, + backwards: bool = False, + from_key: Union[str, int, float, bytes, bool, None] = None, + read_opt: Optional[ReadOptions] = None, + ) -> RdictItems: ... + def keys( + self, + backwards: bool = False, + from_key: Union[str, int, float, bytes, bool, None] = None, + read_opt: Optional[ReadOptions] = None, + ) -> RdictKeys: ... + def values( + self, + backwards: bool = False, + from_key: Union[str, int, float, bytes, bool, None] = None, + read_opt: Optional[ReadOptions] = None, + ) -> RdictValues: ... class WriteBufferManager: def __init__(self, buffer_size: int, allow_stall: bool) -> None: ... @staticmethod - def new_write_buffer_manager_with_cache(buffer_size: int, allow_stall: bool, cache: Cache) -> WriteBufferManager: ... + def new_write_buffer_manager_with_cache( + buffer_size: int, allow_stall: bool, cache: Cache + ) -> WriteBufferManager: ... def get_usage(self) -> int: ... def get_buffer_size(self) -> int: ... def set_buffer_size(self, new_size: int) -> None: ... diff --git a/rust-rocksdb b/rust-rocksdb index c7157f8..4cf3c68 160000 --- a/rust-rocksdb +++ b/rust-rocksdb @@ -1 +1 @@ -Subproject commit c7157f810f16cd1db9f3ffbfe3943f188e04823c +Subproject commit 4cf3c68a993b807bc54ff1c5293cdf49e62aaf72 diff --git a/src/options.rs b/src/options.rs index 328a47f..647a9fe 100644 --- a/src/options.rs +++ b/src/options.rs @@ -185,7 +185,6 @@ pub(crate) struct ReadOptionsPy { total_order_seek: bool, max_skippable_internal_keys: u64, background_purge_on_iterator_cleanup: bool, - ignore_range_deletions: bool, verify_checksums: bool, readahead_size: usize, tailing: bool, @@ -1502,19 +1501,6 @@ impl OptionsPy { .set_max_bytes_for_level_multiplier_additional(&level_values) } - /// If true, then DB::Open() will not fetch and check sizes of all sst files. - /// This may significantly speed up startup if there are many sst files, - /// especially when using non-default Env with expensive GetFileSize(). - /// We'll still check that all required sst files exist. - /// If paranoid_checks is false, this option is ignored, and sst files are - /// not checked at all. - /// - /// Default: false - pub fn set_skip_checking_sst_file_sizes_on_db_open(&mut self, value: bool) { - self.inner_opt - .set_skip_checking_sst_file_sizes_on_db_open(value) - } - /// The total maximum size(bytes) of write buffers to maintain in memory /// including copies of buffers that have already been flushed. This parameter /// only affects trimming of flushed buffers and does not affect flushing. @@ -2172,7 +2158,6 @@ impl ReadOptionsPy { total_order_seek: false, max_skippable_internal_keys: 0, background_purge_on_iterator_cleanup: false, - ignore_range_deletions: false, verify_checksums: true, readahead_size: 0, tailing: false, @@ -2242,15 +2227,6 @@ impl ReadOptionsPy { self.background_purge_on_iterator_cleanup = v } - /// If true, keys deleted using the DeleteRange() API will be visible to - /// readers until they are naturally deleted during compaction. This improves - /// read performance in DBs with many range deletions. - /// - /// Default: false - pub fn set_ignore_range_deletions(&mut self, v: bool) { - self.ignore_range_deletions = v - } - /// If true, all data read from underlying storage will be /// verified against corresponding checksums. /// @@ -2317,7 +2293,6 @@ impl ReadOptionsPy { opt.set_total_order_seek(self.total_order_seek); opt.set_max_skippable_internal_keys(self.max_skippable_internal_keys); opt.set_background_purge_on_iterator_cleanup(self.background_purge_on_iterator_cleanup); - opt.set_ignore_range_deletions(self.ignore_range_deletions); opt.set_verify_checksums(self.verify_checksums); opt.set_readahead_size(self.readahead_size); opt.set_tailing(self.tailing); @@ -2368,10 +2343,6 @@ impl ReadOptionsPy { opt.0, self.background_purge_on_iterator_cleanup as c_uchar, ); - librocksdb_sys::rocksdb_readoptions_set_ignore_range_deletions( - opt.0, - self.ignore_range_deletions as c_uchar, - ); librocksdb_sys::rocksdb_readoptions_set_verify_checksums( opt.0, self.verify_checksums as c_uchar, From 35637a13f490beef572848f72c853ca4eacba06b Mon Sep 17 00:00:00 2001 From: Congyu WANG Date: Sun, 9 Nov 2025 19:10:41 +0800 Subject: [PATCH 06/10] fix-windows-build --- .github/workflows/CI.yml | 2 +- .github/workflows/PR.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 0903a7c..4497d14 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -150,7 +150,7 @@ jobs: python-version: ${{ matrix.py_version }} architecture: ${{ matrix.target }} - name: Install LLVM and Clang - uses: KyleMayes/install-llvm-action@v2.0.7 + uses: KyleMayes/install-llvm-action@v2.0.8 with: version: 21.1.3 directory: ${{ runner.temp }}/llvm-21.1.3 diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml index a9df6c6..fe8b2ff 100644 --- a/.github/workflows/PR.yml +++ b/.github/workflows/PR.yml @@ -150,7 +150,7 @@ jobs: python-version: ${{ matrix.py_version }} architecture: ${{ matrix.target }} - name: Install LLVM and Clang - uses: KyleMayes/install-llvm-action@v2.0.7 + uses: KyleMayes/install-llvm-action@v2.0.8 with: version: 21.1.3 directory: ${{ runner.temp }}/llvm-21.1.3 From a90bb10659613e765d9fa62589b31520e1db0a1e Mon Sep 17 00:00:00 2001 From: Congyu WANG Date: Sun, 9 Nov 2025 19:20:09 +0800 Subject: [PATCH 07/10] update to support pypy3.11 --- .github/workflows/CI.yml | 37 ++++++++----------------------------- .github/workflows/PR.yml | 37 ++++++++----------------------------- Cargo.lock | 2 +- Cargo.toml | 2 +- pyproject.toml | 3 ++- 5 files changed, 20 insertions(+), 61 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 4497d14..d1b4ba0 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -64,17 +64,7 @@ jobs: fail-fast: false matrix: py_version: - [ - 3.8, - 3.9, - "3.10", - "3.11", - "3.12", - "3.13", - "3.14", - "pypy3.9", - "pypy3.10", - ] + [3.8, 3.9, "3.10", "3.11", "3.12", "3.13", "3.14", "pypy3.11"] steps: - uses: actions/checkout@v2 with: @@ -129,18 +119,7 @@ jobs: matrix: target: [x64] py_version: - [ - 3.7, - 3.8, - 3.9, - "3.10", - "3.11", - "3.12", - "3.13", - "3.14", - "pypy3.9", - "pypy3.10", - ] + [3.7, 3.8, 3.9, "3.10", "3.11", "3.12", "3.13", "3.14", "pypy3.11"] steps: - uses: actions/checkout@v2 with: @@ -204,7 +183,7 @@ jobs: rustup-components: rustfmt target: ${{ matrix.target }} manylinux: 2_28 - args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' + args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.11' container: congyuwang/manylinux_2_28_x86_64:llvm-21.1.5 env: LIBCLANG_PATH: /usr/local/lib @@ -247,7 +226,7 @@ jobs: rustup-components: rustfmt target: ${{ matrix.target }} manylinux: 2014 - args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' + args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.11' container: congyuwang/manylinux2014_x86_64:llvm-21.1.5 env: LIBCLANG_PATH: /usr/local/lib @@ -289,7 +268,7 @@ jobs: rustup-components: rustfmt target: ${{ matrix.target }} manylinux: 2_28 - args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' + args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.11' container: congyuwang/manylinux_2_28_aarch64:llvm-21.1.5 env: LIBCLANG_PATH: /usr/local/lib @@ -331,7 +310,7 @@ jobs: rustup-components: rustfmt target: ${{ matrix.target }} manylinux: 2014 - args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' + args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.11' container: congyuwang/manylinux2014_aarch64:llvm-21.1.5 env: LIBCLANG_PATH: /usr/local/lib @@ -369,7 +348,7 @@ jobs: rustup-components: rustfmt target: ${{ matrix.target }} manylinux: musllinux_1_2 - args: --release --no-default-features --features bindgen-static,lto --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' + args: --release --no-default-features --features bindgen-static,lto --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.11' container: congyuwang/musllinux_1_2_x86_64:llvm-21.1.5 before-script-linux: | apk update @@ -417,7 +396,7 @@ jobs: rustup-components: rustfmt target: ${{ matrix.target }} manylinux: musllinux_1_2 - args: --release --no-default-features --features bindgen-static,lto --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' + args: --release --no-default-features --features bindgen-static,lto --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.11' container: congyuwang/musllinux_1_2_aarch64:llvm-21.1.5 before-script-linux: | apk update diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml index fe8b2ff..0631f5a 100644 --- a/.github/workflows/PR.yml +++ b/.github/workflows/PR.yml @@ -64,17 +64,7 @@ jobs: fail-fast: false matrix: py_version: - [ - 3.8, - 3.9, - "3.10", - "3.11", - "3.12", - "3.13", - "3.14", - "pypy3.9", - "pypy3.10", - ] + [3.8, 3.9, "3.10", "3.11", "3.12", "3.13", "3.14", "pypy3.11"] steps: - uses: actions/checkout@v2 with: @@ -129,18 +119,7 @@ jobs: matrix: target: [x64] py_version: - [ - 3.7, - 3.8, - 3.9, - "3.10", - "3.11", - "3.12", - "3.13", - "3.14", - "pypy3.9", - "pypy3.10", - ] + [3.7, 3.8, 3.9, "3.10", "3.11", "3.12", "3.13", "3.14", "pypy3.11"] steps: - uses: actions/checkout@v2 with: @@ -204,7 +183,7 @@ jobs: rustup-components: rustfmt target: ${{ matrix.target }} manylinux: 2_28 - args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' + args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.11' container: congyuwang/manylinux_2_28_x86_64:llvm-21.1.5 env: LIBCLANG_PATH: /usr/local/lib @@ -247,7 +226,7 @@ jobs: rustup-components: rustfmt target: ${{ matrix.target }} manylinux: 2014 - args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' + args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.11' container: congyuwang/manylinux2014_x86_64:llvm-21.1.5 env: LIBCLANG_PATH: /usr/local/lib @@ -289,7 +268,7 @@ jobs: rustup-components: rustfmt target: ${{ matrix.target }} manylinux: 2_28 - args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' + args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.11' container: congyuwang/manylinux_2_28_aarch64:llvm-21.1.5 env: LIBCLANG_PATH: /usr/local/lib @@ -331,7 +310,7 @@ jobs: rustup-components: rustfmt target: ${{ matrix.target }} manylinux: 2014 - args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' + args: --release --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.11' container: congyuwang/manylinux2014_aarch64:llvm-21.1.5 env: LIBCLANG_PATH: /usr/local/lib @@ -369,7 +348,7 @@ jobs: rustup-components: rustfmt target: ${{ matrix.target }} manylinux: musllinux_1_2 - args: --release --no-default-features --features bindgen-static,lto --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' + args: --release --no-default-features --features bindgen-static,lto --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.11' container: congyuwang/musllinux_1_2_x86_64:llvm-21.1.5 before-script-linux: | apk update @@ -417,7 +396,7 @@ jobs: rustup-components: rustfmt target: ${{ matrix.target }} manylinux: musllinux_1_2 - args: --release --no-default-features --features bindgen-static,lto --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10' + args: --release --no-default-features --features bindgen-static,lto --out dist --interpreter '3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.11' container: congyuwang/musllinux_1_2_aarch64:llvm-21.1.5 before-script-linux: | apk update diff --git a/Cargo.lock b/Cargo.lock index 6beec9f..acfa3c0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,7 +4,7 @@ version = 4 [[package]] name = "RocksDict" -version = "0.3.27" +version = "0.3.28" dependencies = [ "libc", "librocksdb-sys", diff --git a/Cargo.toml b/Cargo.toml index e26cfb0..eee6a73 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "RocksDict" -version = "0.3.27" +version = "0.3.28" edition = "2021" description = "Rocksdb Python Binding" diff --git a/pyproject.toml b/pyproject.toml index 7bc26c3..6f1df46 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "rocksdict" -version = "0.3.27" +version = "0.3.28" description = "Rocksdb Python Binding" long_description_content_type = "text/markdown" readme = "README.md" @@ -21,6 +21,7 @@ classifiers = [ 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', 'Programming Language :: Python :: 3.13', + 'Programming Language :: Python :: 3.14', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Development Status :: 5 - Production/Stable', From f0033be6fd30adf6abcc9e7065920ae9831c3ffb Mon Sep 17 00:00:00 2001 From: Congyu WANG Date: Sun, 9 Nov 2025 19:54:59 +0800 Subject: [PATCH 08/10] drop support for macos py3.7 --- .github/workflows/CI.yml | 53 ---------------------------------------- .github/workflows/PR.yml | 53 ---------------------------------------- 2 files changed, 106 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d1b4ba0..349e06e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -5,59 +5,6 @@ on: types: [published] jobs: - macos-py37: - runs-on: macos-13 - strategy: - fail-fast: false - matrix: - py_version: [3.7] - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - name: Install llvm-21 - run: | - brew update - brew install llvm@21 - brew install lld - - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.py_version }} - architecture: x64 - - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.91.0 - default: true - - name: Build wheels - run: | - rustup target add aarch64-apple-darwin - pip install maturin - eval "$(brew shellenv)" - export MACOSX_DEPLOYMENT_TARGET=10.14 - export LIBCLANG_PATH=${HOMEBREW_PREFIX}/opt/llvm@21/lib - export CC=${HOMEBREW_PREFIX}/opt/llvm@21/bin/clang - export CXX=${HOMEBREW_PREFIX}/opt/llvm@21/bin/clang++ - export AR=${HOMEBREW_PREFIX}/opt/llvm@21/bin/llvm-ar - export CFLAGS="-flto=thin -O3 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" - export CXXFLAGS="-flto=thin -O3 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" - export LLD=${HOMEBREW_PREFIX}/opt/lld/bin/ld64.lld - export RUSTFLAGS="-Clinker-plugin-lto -Clinker=$PWD/macos-linker.sh -Clink-arg=-fuse-ld=${LLD}" - maturin build --release --target aarch64-apple-darwin --out dist -i ${{ matrix.py_version }} - maturin build --release --target x86_64-apple-darwin --out dist -i ${{ matrix.py_version }} - - name: Install built wheel - run: | - pip install rocksdict --no-index --find-links dist --force-reinstall || true - pip install speedict --no-index --find-links dist --force-reinstall || true - - name: Python UnitTest - run: | - python -m unittest discover -v test - - name: Upload wheels - uses: actions/upload-artifact@v4 - with: - name: wheels-macos-${{ matrix.py_version }} - path: dist - macos: runs-on: macos-latest strategy: diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml index 0631f5a..d13801d 100644 --- a/.github/workflows/PR.yml +++ b/.github/workflows/PR.yml @@ -5,59 +5,6 @@ on: branches: [main, speedict] jobs: - macos-py37: - runs-on: macos-13 - strategy: - fail-fast: false - matrix: - py_version: [3.7] - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - name: Install llvm-21 - run: | - brew update - brew install llvm@21 - brew install lld - - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.py_version }} - architecture: x64 - - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.91.0 - default: true - - name: Build wheels - run: | - rustup target add aarch64-apple-darwin - pip install maturin - eval "$(brew shellenv)" - export MACOSX_DEPLOYMENT_TARGET=10.14 - export LIBCLANG_PATH=${HOMEBREW_PREFIX}/opt/llvm@21/lib - export CC=${HOMEBREW_PREFIX}/opt/llvm@21/bin/clang - export CXX=${HOMEBREW_PREFIX}/opt/llvm@21/bin/clang++ - export AR=${HOMEBREW_PREFIX}/opt/llvm@21/bin/llvm-ar - export CFLAGS="-flto=thin -O3 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" - export CXXFLAGS="-flto=thin -O3 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" - export LLD=${HOMEBREW_PREFIX}/opt/lld/bin/ld64.lld - export RUSTFLAGS="-Clinker-plugin-lto -Clinker=$PWD/macos-linker.sh -Clink-arg=-fuse-ld=${LLD}" - maturin build --release --target aarch64-apple-darwin --out dist -i ${{ matrix.py_version }} - maturin build --release --target x86_64-apple-darwin --out dist -i ${{ matrix.py_version }} - - name: Install built wheel - run: | - pip install rocksdict --no-index --find-links dist --force-reinstall || true - pip install speedict --no-index --find-links dist --force-reinstall || true - - name: Python UnitTest - run: | - python -m unittest discover -v test - - name: Upload wheels - uses: actions/upload-artifact@v4 - with: - name: wheels-macos-${{ matrix.py_version }} - path: dist - macos: runs-on: macos-latest strategy: From f69187bc1cb2a75eb3d464c08674d3cc709ebb08 Mon Sep 17 00:00:00 2001 From: Congyu WANG Date: Sun, 9 Nov 2025 19:59:17 +0800 Subject: [PATCH 09/10] skip refcount test for python 3.14 --- test/test_rdict.py | 217 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 168 insertions(+), 49 deletions(-) diff --git a/test/test_rdict.py b/test/test_rdict.py index 2f16522..712e7c1 100644 --- a/test/test_rdict.py +++ b/test/test_rdict.py @@ -1,22 +1,22 @@ +import gc +import os +import platform +import sys import unittest +from json import dumps, loads +from random import getrandbits, randint, random + from rocksdict import ( AccessType, - Rdict, + Checkpoint, + CuckooTableOptions, + DbClosedError, Options, PlainTableFactoryOptions, + Rdict, SliceTransform, - CuckooTableOptions, - DbClosedError, WriteBatch, - Checkpoint ) -from random import randint, random, getrandbits -import os -import gc -import sys -import platform -from json import loads, dumps - TEST_INT_RANGE_UPPER = 999999 @@ -43,7 +43,14 @@ def setUpClass(cls) -> None: cls.test_dict["a"] = "a" cls.test_dict[123] = 123 - @unittest.skipIf(platform.python_implementation() == "PyPy", reason="sys.getrefcount() not available in PyPy") + @unittest.skipIf( + platform.python_implementation() == "PyPy", + reason="sys.getrefcount() not available in PyPy", + ) + @unittest.skipIf( + sys.version_info >= (3, 14), + reason="Python 3.14 refcount can be differently optimized", + ) def testGetItem(self): assert self.test_dict is not None self.assertEqual(self.test_dict["a"], "a") @@ -52,8 +59,14 @@ def testGetItem(self): self.assertIsNone(self.test_dict.get(250)) self.assertEqual(self.test_dict.get("b", "b"), "b") self.assertEqual(self.test_dict.get(250, 1324123), 1324123) - self.assertRaises(KeyError, lambda: self.test_dict["b"] if self.test_dict is not None else None) - self.assertRaises(KeyError, lambda: self.test_dict[250] if self.test_dict is not None else None) + self.assertRaises( + KeyError, + lambda: self.test_dict["b"] if self.test_dict is not None else None, + ) + self.assertRaises( + KeyError, + lambda: self.test_dict[250] if self.test_dict is not None else None, + ) def testDelItem(self): assert self.test_dict is not None @@ -94,8 +107,14 @@ def testGetItem(self): self.assertEqual(self.test_dict.get("b", "b"), "b") self.assertEqual(self.test_dict.get(250, 1324123), 1324123) self.assertEqual(self.test_dict["ok"], ["o", "k"]) - self.assertRaises(KeyError, lambda: self.test_dict["b"] if self.test_dict is not None else None) - self.assertRaises(KeyError, lambda: self.test_dict[250] if self.test_dict is not None else None) + self.assertRaises( + KeyError, + lambda: self.test_dict["b"] if self.test_dict is not None else None, + ) + self.assertRaises( + KeyError, + lambda: self.test_dict[250] if self.test_dict is not None else None, + ) def testDelItem(self): assert self.test_dict is not None @@ -309,7 +328,10 @@ def test_reopen(self): assert self.test_dict is not None self.test_dict.close() - self.assertRaises(DbClosedError, lambda: self.test_dict.get(1) if self.test_dict is not None else None) + self.assertRaises( + DbClosedError, + lambda: self.test_dict.get(1) if self.test_dict is not None else None, + ) gc.collect() test_dict = Rdict(self.path, self.opt) @@ -453,7 +475,14 @@ def setUpClass(cls) -> None: cls.test_dict = Rdict(cls.path, cls.opt) cls.ref_dict = dict() - @unittest.skipIf(platform.python_implementation() == "PyPy", reason="sys.getrefcount() not available in PyPy") + @unittest.skipIf( + platform.python_implementation() == "PyPy", + reason="sys.getrefcount() not available in PyPy", + ) + @unittest.skipIf( + sys.version_info >= (3, 14), + reason="Python 3.14 refcount can be differently optimized", + ) def test_add_bytes(self): assert self.test_dict is not None assert self.ref_dict is not None @@ -472,7 +501,14 @@ def test_add_bytes(self): compare_dicts(self, self.ref_dict, self.test_dict) - @unittest.skipIf(platform.python_implementation() == "PyPy", reason="sys.getrefcount() not available in PyPy") + @unittest.skipIf( + platform.python_implementation() == "PyPy", + reason="sys.getrefcount() not available in PyPy", + ) + @unittest.skipIf( + sys.version_info >= (3, 14), + reason="Python 3.14 refcount can be differently optimized", + ) def test_delete_bytes(self): assert self.test_dict is not None assert self.ref_dict is not None @@ -567,23 +603,47 @@ def setUpClass(cls) -> None: def test_put_wide_columns(self): assert self.test_dict is not None - self.test_dict.put_entity(key=b"Guangdong", names=[b"language", b"city"], values=[b"Cantonese", b"Shenzhen"]) - self.test_dict.put_entity(key=b"Sichuan", names=[b"language", b"city"], values=[b"Mandarin", b"Chengdu"]) + self.test_dict.put_entity( + key=b"Guangdong", + names=[b"language", b"city"], + values=[b"Cantonese", b"Shenzhen"], + ) + self.test_dict.put_entity( + key=b"Sichuan", + names=[b"language", b"city"], + values=[b"Mandarin", b"Chengdu"], + ) self.assertEqual(self.test_dict[b"Guangdong"], b"") - self.assertEqual(self.test_dict.get_entity(b"Guangdong"), [(b"city", b"Shenzhen"), (b"language", b"Cantonese")]) + self.assertEqual( + self.test_dict.get_entity(b"Guangdong"), + [(b"city", b"Shenzhen"), (b"language", b"Cantonese")], + ) self.assertEqual(self.test_dict[b"Sichuan"], b"") - self.assertEqual(self.test_dict.get_entity(b"Sichuan"), [(b"city", b"Chengdu"), (b"language", b"Mandarin")]) + self.assertEqual( + self.test_dict.get_entity(b"Sichuan"), + [(b"city", b"Chengdu"), (b"language", b"Mandarin")], + ) # overwrite - self.test_dict.put_entity(key=b"Sichuan", names=[b"language", b"city"], values=[b"Sichuanhua", b"Chengdu"]) + self.test_dict.put_entity( + key=b"Sichuan", + names=[b"language", b"city"], + values=[b"Sichuanhua", b"Chengdu"], + ) self.test_dict[b"Beijing"] = b"Beijing" # assertions self.assertEqual(self.test_dict[b"Beijing"], b"Beijing") self.assertEqual(self.test_dict.get_entity(b"Beijing"), [(b"", b"Beijing")]) self.assertEqual(self.test_dict[b"Guangdong"], b"") - self.assertEqual(self.test_dict.get_entity(b"Guangdong"), [(b"city", b"Shenzhen"), (b"language", b"Cantonese")]) + self.assertEqual( + self.test_dict.get_entity(b"Guangdong"), + [(b"city", b"Shenzhen"), (b"language", b"Cantonese")], + ) self.assertEqual(self.test_dict[b"Sichuan"], b"") - self.assertEqual(self.test_dict.get_entity(b"Sichuan"), [(b"city", b"Chengdu"), (b"language", b"Sichuanhua")]) + self.assertEqual( + self.test_dict.get_entity(b"Sichuan"), + [(b"city", b"Chengdu"), (b"language", b"Sichuanhua")], + ) # iterator it = self.test_dict.iter() @@ -596,12 +656,16 @@ def test_put_wide_columns(self): self.assertTrue(it.valid()) self.assertEqual(it.key(), b"Guangdong") self.assertEqual(it.value(), b"") - self.assertEqual(it.columns(), [(b"city", b"Shenzhen"), (b"language", b"Cantonese")]) + self.assertEqual( + it.columns(), [(b"city", b"Shenzhen"), (b"language", b"Cantonese")] + ) it.next() self.assertTrue(it.valid()) self.assertEqual(it.key(), b"Sichuan") self.assertEqual(it.value(), b"") - self.assertEqual(it.columns(), [(b"city", b"Chengdu"), (b"language", b"Sichuanhua")]) + self.assertEqual( + it.columns(), [(b"city", b"Chengdu"), (b"language", b"Sichuanhua")] + ) # iterators expected = [ @@ -619,7 +683,7 @@ def test_put_wide_columns(self): [(b"", b"Beijing")], [(b"city", b"Shenzhen"), (b"language", b"Cantonese")], [(b"city", b"Chengdu"), (b"language", b"Sichuanhua")], - ] + ], ) @classmethod @@ -647,10 +711,22 @@ def test_put_wide_columns(self): write_batch = WriteBatch(raw_mode=True) default_cf_handle = self.test_dict.get_column_family_handle("default") write_batch.set_default_column_family(default_cf_handle) - write_batch.put_entity(key=b"Guangdong", names=[b"language", b"city"], values=[b"Cantonese", b"Shenzhen"]) - write_batch.put_entity(key=b"Sichuan", names=[b"language", b"city"], values=[b"Mandarin", b"Chengdu"]) + write_batch.put_entity( + key=b"Guangdong", + names=[b"language", b"city"], + values=[b"Cantonese", b"Shenzhen"], + ) + write_batch.put_entity( + key=b"Sichuan", + names=[b"language", b"city"], + values=[b"Mandarin", b"Chengdu"], + ) # overwrite - write_batch.put_entity(key=b"Sichuan", names=[b"language", b"city"], values=[b"Sichuanhua", b"Chengdu"]) + write_batch.put_entity( + key=b"Sichuan", + names=[b"language", b"city"], + values=[b"Sichuanhua", b"Chengdu"], + ) write_batch[b"Beijing"] = b"Beijing" self.test_dict.write(write_batch) @@ -659,9 +735,15 @@ def test_put_wide_columns(self): self.assertEqual(self.test_dict[b"Beijing"], b"Beijing") self.assertEqual(self.test_dict.get_entity(b"Beijing"), [(b"", b"Beijing")]) self.assertEqual(self.test_dict[b"Guangdong"], b"") - self.assertEqual(self.test_dict.get_entity(b"Guangdong"), [(b"city", b"Shenzhen"), (b"language", b"Cantonese")]) + self.assertEqual( + self.test_dict.get_entity(b"Guangdong"), + [(b"city", b"Shenzhen"), (b"language", b"Cantonese")], + ) self.assertEqual(self.test_dict[b"Sichuan"], b"") - self.assertEqual(self.test_dict.get_entity(b"Sichuan"), [(b"city", b"Chengdu"), (b"language", b"Sichuanhua")]) + self.assertEqual( + self.test_dict.get_entity(b"Sichuan"), + [(b"city", b"Chengdu"), (b"language", b"Sichuanhua")], + ) # iterator it = self.test_dict.iter() @@ -674,12 +756,16 @@ def test_put_wide_columns(self): self.assertTrue(it.valid()) self.assertEqual(it.key(), b"Guangdong") self.assertEqual(it.value(), b"") - self.assertEqual(it.columns(), [(b"city", b"Shenzhen"), (b"language", b"Cantonese")]) + self.assertEqual( + it.columns(), [(b"city", b"Shenzhen"), (b"language", b"Cantonese")] + ) it.next() self.assertTrue(it.valid()) self.assertEqual(it.key(), b"Sichuan") self.assertEqual(it.value(), b"") - self.assertEqual(it.columns(), [(b"city", b"Chengdu"), (b"language", b"Sichuanhua")]) + self.assertEqual( + it.columns(), [(b"city", b"Chengdu"), (b"language", b"Sichuanhua")] + ) # iterators expected = [ @@ -697,7 +783,7 @@ def test_put_wide_columns(self): [(b"", b"Beijing")], [(b"city", b"Shenzhen"), (b"language", b"Cantonese")], [(b"city", b"Chengdu"), (b"language", b"Sichuanhua")], - ] + ], ) del write_batch @@ -724,23 +810,43 @@ def setUpClass(cls) -> None: def test_put_wide_columns(self): assert self.test_dict is not None - self.test_dict.put_entity(key="Guangdong", names=["language", "city", "population"], values=["Cantonese", "Shenzhen", 1.27]) - self.test_dict.put_entity(key="Sichuan", names=["language", "city"], values=["Mandarin", "Chengdu"]) + self.test_dict.put_entity( + key="Guangdong", + names=["language", "city", "population"], + values=["Cantonese", "Shenzhen", 1.27], + ) + self.test_dict.put_entity( + key="Sichuan", names=["language", "city"], values=["Mandarin", "Chengdu"] + ) self.assertEqual(self.test_dict["Guangdong"], "") - self.assertEqual(self.test_dict.get_entity("Guangdong"), [("city", "Shenzhen"), ("language", "Cantonese"), ("population", 1.27)]) + self.assertEqual( + self.test_dict.get_entity("Guangdong"), + [("city", "Shenzhen"), ("language", "Cantonese"), ("population", 1.27)], + ) self.assertEqual(self.test_dict["Sichuan"], "") - self.assertEqual(self.test_dict.get_entity("Sichuan"), [("city", "Chengdu"), ("language", "Mandarin")]) + self.assertEqual( + self.test_dict.get_entity("Sichuan"), + [("city", "Chengdu"), ("language", "Mandarin")], + ) # overwrite - self.test_dict.put_entity(key="Sichuan", names=["language", "city"], values=["Sichuanhua", "Chengdu"]) + self.test_dict.put_entity( + key="Sichuan", names=["language", "city"], values=["Sichuanhua", "Chengdu"] + ) self.test_dict["Beijing"] = "Beijing" # assertions self.assertEqual(self.test_dict["Beijing"], "Beijing") self.assertEqual(self.test_dict.get_entity("Beijing"), [("", "Beijing")]) self.assertEqual(self.test_dict["Guangdong"], "") - self.assertEqual(self.test_dict.get_entity("Guangdong"), [("city", "Shenzhen"), ("language", "Cantonese"), ("population", 1.27)]) + self.assertEqual( + self.test_dict.get_entity("Guangdong"), + [("city", "Shenzhen"), ("language", "Cantonese"), ("population", 1.27)], + ) self.assertEqual(self.test_dict["Sichuan"], "") - self.assertEqual(self.test_dict.get_entity("Sichuan"), [("city", "Chengdu"), ("language", "Sichuanhua")]) + self.assertEqual( + self.test_dict.get_entity("Sichuan"), + [("city", "Chengdu"), ("language", "Sichuanhua")], + ) it = self.test_dict.iter() it.seek_to_first() @@ -752,17 +858,25 @@ def test_put_wide_columns(self): self.assertTrue(it.valid()) self.assertEqual(it.key(), "Guangdong") self.assertEqual(it.value(), "") - self.assertEqual(it.columns(), [("city", "Shenzhen"), ("language", "Cantonese"), ("population", 1.27)]) + self.assertEqual( + it.columns(), + [("city", "Shenzhen"), ("language", "Cantonese"), ("population", 1.27)], + ) it.next() self.assertTrue(it.valid()) self.assertEqual(it.key(), "Sichuan") self.assertEqual(it.value(), "") - self.assertEqual(it.columns(), [("city", "Chengdu"), ("language", "Sichuanhua")]) + self.assertEqual( + it.columns(), [("city", "Chengdu"), ("language", "Sichuanhua")] + ) # iterators expected = [ ("Beijing", [("", "Beijing")]), - ("Guangdong", [("city", "Shenzhen"), ("language", "Cantonese"), ("population", 1.27)]), + ( + "Guangdong", + [("city", "Shenzhen"), ("language", "Cantonese"), ("population", 1.27)], + ), ("Sichuan", [("city", "Chengdu"), ("language", "Sichuanhua")]), ] for i, (key, entity) in enumerate(self.test_dict.entities()): @@ -775,7 +889,7 @@ def test_put_wide_columns(self): [("", "Beijing")], [("city", "Shenzhen"), ("language", "Cantonese"), ("population", 1.27)], [("city", "Chengdu"), ("language", "Sichuanhua")], - ] + ], ) @classmethod @@ -1111,7 +1225,12 @@ def test_reopen(self): assert self.ref_dict is not None self.secondary_dict.close() - self.assertRaises(DbClosedError, lambda: self.secondary_dict.get(1) if self.secondary_dict is not None else None) + self.assertRaises( + DbClosedError, + lambda: self.secondary_dict.get(1) + if self.secondary_dict is not None + else None, + ) gc.collect() self.secondary_dict = Rdict( From af7dfe77dc69a0b387b924433dbdde67c7d7bfca Mon Sep 17 00:00:00 2001 From: Congyu WANG Date: Sun, 9 Nov 2025 20:28:32 +0800 Subject: [PATCH 10/10] limit macos to use rust v1.90 and llvm20 due to llvm21 compatibility issue --- .github/workflows/CI.yml | 14 +++++++------- .github/workflows/PR.yml | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 349e06e..7f0c59c 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -16,10 +16,10 @@ jobs: - uses: actions/checkout@v2 with: submodules: recursive - - name: Install llvm-21 + - name: Install llvm-20 run: | brew update - brew install llvm@21 + brew install llvm@20 brew install lld - uses: actions/setup-python@v5 with: @@ -28,7 +28,7 @@ jobs: - name: Install Rust toolchain uses: actions-rs/toolchain@v1 with: - toolchain: 1.91.0 + toolchain: 1.90.0 default: true - name: Build wheels run: | @@ -36,10 +36,10 @@ jobs: pip install maturin eval "$(brew shellenv)" export MACOSX_DEPLOYMENT_TARGET=10.14 - export LIBCLANG_PATH=${HOMEBREW_PREFIX}/opt/llvm@21/lib - export CC=${HOMEBREW_PREFIX}/opt/llvm@21/bin/clang - export CXX=${HOMEBREW_PREFIX}/opt/llvm@21/bin/clang++ - export AR=${HOMEBREW_PREFIX}/opt/llvm@21/bin/llvm-ar + export LIBCLANG_PATH=${HOMEBREW_PREFIX}/opt/llvm@20/lib + export CC=${HOMEBREW_PREFIX}/opt/llvm@20/bin/clang + export CXX=${HOMEBREW_PREFIX}/opt/llvm@20/bin/clang++ + export AR=${HOMEBREW_PREFIX}/opt/llvm@20/bin/llvm-ar export CFLAGS="-flto=thin -O3 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" export CXXFLAGS="-flto=thin -O3 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" export LLD=${HOMEBREW_PREFIX}/opt/lld/bin/ld64.lld diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml index d13801d..894d501 100644 --- a/.github/workflows/PR.yml +++ b/.github/workflows/PR.yml @@ -16,10 +16,10 @@ jobs: - uses: actions/checkout@v2 with: submodules: recursive - - name: Install llvm-21 + - name: Install llvm-20 run: | brew update - brew install llvm@21 + brew install llvm@20 brew install lld - uses: actions/setup-python@v5 with: @@ -28,7 +28,7 @@ jobs: - name: Install Rust toolchain uses: actions-rs/toolchain@v1 with: - toolchain: 1.91.0 + toolchain: 1.90.0 default: true - name: Build wheels run: | @@ -36,10 +36,10 @@ jobs: pip install maturin eval "$(brew shellenv)" export MACOSX_DEPLOYMENT_TARGET=10.14 - export LIBCLANG_PATH=${HOMEBREW_PREFIX}/opt/llvm@21/lib - export CC=${HOMEBREW_PREFIX}/opt/llvm@21/bin/clang - export CXX=${HOMEBREW_PREFIX}/opt/llvm@21/bin/clang++ - export AR=${HOMEBREW_PREFIX}/opt/llvm@21/bin/llvm-ar + export LIBCLANG_PATH=${HOMEBREW_PREFIX}/opt/llvm@20/lib + export CC=${HOMEBREW_PREFIX}/opt/llvm@20/bin/clang + export CXX=${HOMEBREW_PREFIX}/opt/llvm@20/bin/clang++ + export AR=${HOMEBREW_PREFIX}/opt/llvm@20/bin/llvm-ar export CFLAGS="-flto=thin -O3 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" export CXXFLAGS="-flto=thin -O3 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" export LLD=${HOMEBREW_PREFIX}/opt/lld/bin/ld64.lld