Skip to content

Commit ce9ac10

Browse files
glommerclaude
andcommitted
Deprecate Connection.sync() with runtime DeprecationWarning
Emit a Python DeprecationWarning via the warnings module when sync() is called. Users are directed to `pyturso` as a replacement. Learn more: https://tur.so/newsync Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4fee9cb commit ce9ac10

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/lib.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,19 @@ impl Connection {
259259
}
260260

261261
fn sync(self_: PyRef<'_, Self>, py: Python<'_>) -> PyResult<()> {
262+
let warnings = py.import("warnings").map_err(to_py_err)?;
263+
warnings.call_method1(
264+
"warn",
265+
(
266+
"sync() is deprecated and will be removed in a future release. Use `pyturso` instead. Learn more: https://tur.so/newsync",
267+
py.import("builtins")
268+
.map_err(to_py_err)?
269+
.getattr("DeprecationWarning")
270+
.map_err(to_py_err)?,
271+
2i32,
272+
),
273+
).map_err(to_py_err)?;
274+
262275
let fut = {
263276
let _enter = rt().enter();
264277
self_.db.sync()

0 commit comments

Comments
 (0)