From ce9ac101905a541f80b55c54daac1cdfa4cbcdc5 Mon Sep 17 00:00:00 2001 From: Glauber Costa Date: Thu, 23 Apr 2026 16:37:50 -0400 Subject: [PATCH] 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 --- src/lib.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 5f792e4..bac62a5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -259,6 +259,19 @@ impl Connection { } fn sync(self_: PyRef<'_, Self>, py: Python<'_>) -> PyResult<()> { + let warnings = py.import("warnings").map_err(to_py_err)?; + warnings.call_method1( + "warn", + ( + "sync() is deprecated and will be removed in a future release. Use `pyturso` instead. Learn more: https://tur.so/newsync", + py.import("builtins") + .map_err(to_py_err)? + .getattr("DeprecationWarning") + .map_err(to_py_err)?, + 2i32, + ), + ).map_err(to_py_err)?; + let fut = { let _enter = rt().enter(); self_.db.sync()