From b17d7fe27a68c0ea93fb0d6e5b81fe3c166dcee0 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Sat, 16 Nov 2024 14:16:39 +0100 Subject: build(treewide): Update dependencies --- Cargo.lock | 84 +++++++++++++++++++++++++++----------------- Cargo.toml | 4 +-- crates/libmpv2/Cargo.toml | 2 +- crates/yt_dlp/Cargo.toml | 2 +- crates/yt_dlp/src/lib.rs | 26 +++++++------- crates/yt_dlp/src/logging.rs | 16 ++++++--- flake.lock | 12 +++---- yt/Cargo.toml | 6 ++-- 8 files changed, 89 insertions(+), 63 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e0e8593..4c4931e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -110,9 +110,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.92" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74f37166d7d48a0284b99dd824694c26119c700b53bf0d1540cdb147dbdaaf13" +checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" [[package]] name = "arrayref" @@ -310,9 +310,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.20" +version = "4.5.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" +checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f" dependencies = [ "clap_builder", "clap_derive", @@ -320,9 +320,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.20" +version = "4.5.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" +checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec" dependencies = [ "anstream", "anstyle", @@ -1051,7 +1051,7 @@ dependencies = [ "libmpv2-sys", "log", "sdl2", - "thiserror", + "thiserror 2.0.3", ] [[package]] @@ -1297,7 +1297,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" dependencies = [ "memchr", - "thiserror", + "thiserror 1.0.68", "ucd-trie", ] @@ -1410,9 +1410,9 @@ dependencies = [ [[package]] name = "pyo3" -version = "0.22.5" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d922163ba1f79c04bc49073ba7b32fd5a8d3b76a87c955921234b8e77333c51" +checksum = "d51da03e17ef97ae4185cd606a4b316e04bb6f047d66913d6b57d4e6acfb41ec" dependencies = [ "cfg-if", "indoc", @@ -1428,9 +1428,9 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.22.5" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc38c5feeb496c8321091edf3d63e9a6829eab4b863b4a6a65f26f3e9cc6b179" +checksum = "455f646b3d007fb6d85cffccff9c7dfb752f24ec9fb0a04cb49537e7e9bdc2dd" dependencies = [ "once_cell", "target-lexicon", @@ -1438,9 +1438,9 @@ dependencies = [ [[package]] name = "pyo3-ffi" -version = "0.22.5" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94845622d88ae274d2729fcefc850e63d7a3ddff5e3ce11bd88486db9f1d357d" +checksum = "432fc20d4dd419f8d1dd402a659bb42e75430706b50d367cc978978778638084" dependencies = [ "libc", "pyo3-build-config", @@ -1448,9 +1448,9 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.22.5" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e655aad15e09b94ffdb3ce3d217acf652e26bbc37697ef012f5e5e348c716e5e" +checksum = "ae1cd532e9356f90d1be1317d8bf51873e4a9468b9305b950c20e8aef786cc16" dependencies = [ "proc-macro2", "pyo3-macros-backend", @@ -1460,9 +1460,9 @@ dependencies = [ [[package]] name = "pyo3-macros-backend" -version = "0.22.5" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae1e3f09eecd94618f60a455a23def79f79eba4dc561a97324bf9ac8c6df30ce" +checksum = "975b289b3d3901442a6def73eedf8251dc1aed2cdc0a80d1c4f3998d868a97aa" dependencies = [ "heck", "proc-macro2", @@ -1582,9 +1582,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustix" -version = "0.38.38" +version = "0.38.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa260229e6538e52293eeb577aabd09945a09d6d9cc0fc550ed7529056c2e32a" +checksum = "99e4ea3e1cdc4b559b8e5650f9c8e5998e3e5c1343b4eaf034565f32318d63c0" dependencies = [ "bitflags 2.6.0", "errno", @@ -1630,18 +1630,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.214" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.214" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", @@ -1830,7 +1830,7 @@ dependencies = [ "sha2", "smallvec", "sqlformat", - "thiserror", + "thiserror 1.0.68", "tokio", "tokio-stream", "tracing", @@ -1913,7 +1913,7 @@ dependencies = [ "smallvec", "sqlx-core", "stringprep", - "thiserror", + "thiserror 1.0.68", "tracing", "whoami", ] @@ -1951,7 +1951,7 @@ dependencies = [ "smallvec", "sqlx-core", "stringprep", - "thiserror", + "thiserror 1.0.68", "tracing", "whoami", ] @@ -2051,9 +2051,9 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tempfile" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", "fastrand", @@ -2077,7 +2077,16 @@ version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02dd99dc800bbb97186339685293e1cc5d9df1f8fae2d0aecd9ff1c77efea892" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.68", +] + +[[package]] +name = "thiserror" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa" +dependencies = [ + "thiserror-impl 2.0.3", ] [[package]] @@ -2091,6 +2100,17 @@ dependencies = [ "syn", ] +[[package]] +name = "thiserror-impl" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "thread_local" version = "1.1.8" @@ -2128,9 +2148,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.41.0" +version = "1.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb" +checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" dependencies = [ "backtrace", "bytes 1.8.0", diff --git a/Cargo.toml b/Cargo.toml index 28f3190..1205013 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,10 +35,10 @@ libmpv2 = { path = "./crates/libmpv2" } # Shared log = "0.4.22" -serde = { version = "1.0.214", features = ["derive"] } +serde = { version = "1.0.215", features = ["derive"] } serde_json = "1.0.132" url = { version = "2.5.3", features = ["serde"] } -tokio = { version = "1.41.0", features = [ +tokio = { version = "1.41.1", features = [ "rt-multi-thread", "macros", "process", diff --git a/crates/libmpv2/Cargo.toml b/crates/libmpv2/Cargo.toml index b7d9bdb..d41ea37 100644 --- a/crates/libmpv2/Cargo.toml +++ b/crates/libmpv2/Cargo.toml @@ -24,7 +24,7 @@ publish = false [dependencies] libmpv2-sys = { path = "libmpv2-sys" } -thiserror = "1.0.68" +thiserror = "2.0.3" log.workspace = true [dev-dependencies] diff --git a/crates/yt_dlp/Cargo.toml b/crates/yt_dlp/Cargo.toml index a8f9b53..10be247 100644 --- a/crates/yt_dlp/Cargo.toml +++ b/crates/yt_dlp/Cargo.toml @@ -22,7 +22,7 @@ rust-version.workspace = true publish = false [dependencies] -pyo3 = { version = "0.22.5", features = ["auto-initialize", "gil-refs"] } +pyo3 = { version = "0.23.0", features = ["auto-initialize"] } bytes.workspace = true log.workspace = true serde.workspace = true diff --git a/crates/yt_dlp/src/lib.rs b/crates/yt_dlp/src/lib.rs index 980d807..970bfe2 100644 --- a/crates/yt_dlp/src/lib.rs +++ b/crates/yt_dlp/src/lib.rs @@ -26,7 +26,7 @@ use pyo3::types::{PyString, PyTuple, PyTupleMethods}; use pyo3::{ pyfunction, types::{PyAnyMethods, PyDict, PyDictMethods, PyList, PyListMethods, PyModule}, - wrap_pyfunction_bound, Bound, PyAny, PyResult, Python, + wrap_pyfunction, Bound, PyAny, PyResult, Python, }; use serde::Serialize; use serde_json::{Map, Value}; @@ -53,7 +53,7 @@ pub fn add_logger_and_sig_handler<'a>( ) -> PyResult> { setup_logging(py, "yt_dlp")?; - let logging = PyModule::import_bound(py, "logging")?; + let logging = PyModule::import(py, "logging")?; let ytdl_logger = logging.call_method1("getLogger", ("yt_dlp",))?; // Ensure that all events are logged by setting the log level to NOTSET (we filter on rust's side) @@ -62,8 +62,8 @@ pub fn add_logger_and_sig_handler<'a>( // Disable the SIGINT (Ctrl+C) handler, python installs. // This allows the user to actually stop the application with Ctrl+C. // This is here because it can only be run in the main thread and this was here already. - py.run_bound( - "\ + py.run( + c"\ import signal signal.signal(signal.SIGINT, signal.SIG_DFL)", None, @@ -71,7 +71,7 @@ signal.signal(signal.SIGINT, signal.SIG_DFL)", ) .expect("This code should always work"); - let config_opts = PyDict::new_bound(py); + let config_opts = PyDict::new(py); config_opts .set_item("level", 0) .expect("Setting this item should always work"); @@ -285,12 +285,12 @@ pub fn progress_hook(py: Python<'_>, input: &Bound<'_, PyDict>) -> PyResult<()> pub fn add_hooks<'a>(opts: Bound<'a, PyDict>, py: Python<'_>) -> PyResult> { if let Some(hooks) = opts.get_item("progress_hooks")? { let hooks = hooks.downcast::()?; - hooks.append(wrap_pyfunction_bound!(progress_hook, py)?)?; + hooks.append(wrap_pyfunction!(progress_hook, py)?)?; opts.set_item("progress_hooks", hooks)?; } else { // No hooks are set yet - let hooks_list = PyList::new_bound(py, &[wrap_pyfunction_bound!(progress_hook, py)?]); + let hooks_list = PyList::new(py, &[wrap_pyfunction!(progress_hook, py)?])?; opts.set_item("progress_hooks", hooks_list)?; } @@ -327,7 +327,7 @@ pub async fn extract_info( let instance = get_yt_dlp(py, opts)?; let args = (url.as_str(),); - let kwargs = PyDict::new_bound(py); + let kwargs = PyDict::new(py); kwargs.set_item("download", download)?; kwargs.set_item("process", process)?; @@ -417,10 +417,10 @@ fn json_map_to_py_dict<'a>( fn json_dumps(py: Python<'_>, input: Bound<'_, PyAny>) -> PyResult { // json.dumps(yt_dlp.sanitize_info(input)) - let yt_dlp = get_yt_dlp(py, PyDict::new_bound(py))?; + let yt_dlp = get_yt_dlp(py, PyDict::new(py))?; let sanitized_result = yt_dlp.call_method1("sanitize_info", (input,))?; - let json = PyModule::import_bound(py, "json")?; + let json = PyModule::import(py, "json")?; let dumps = json.getattr("dumps")?; let output = dumps.call1((sanitized_result,))?; @@ -439,7 +439,7 @@ fn json_loads_str(py: Python<'_>, input: T) -> PyResult, input: String) -> PyResult> { // json.loads(input) - let json = PyModule::import_bound(py, "json")?; + let json = PyModule::import(py, "json")?; let dumps = json.getattr("loads")?; let output = dumps.call1((input,))?; @@ -451,7 +451,7 @@ fn json_loads(py: Python<'_>, input: String) -> PyResult> { } fn get_yt_dlp_utils(py: Python<'_>) -> PyResult> { - let yt_dlp = PyModule::import_bound(py, "yt_dlp")?; + let yt_dlp = PyModule::import(py, "yt_dlp")?; let utils = yt_dlp.getattr("utils")?; Ok(utils) @@ -461,7 +461,7 @@ fn get_yt_dlp<'a>(py: Python<'a>, opts: Bound<'a, PyDict>) -> PyResult, rust_target: &str) -> PyResult<()> { /// Registers the `host_log` function in rust as the event handler for Python's logging logger /// This function needs to be called from within a pyo3 context as early as possible to ensure logging messages /// arrive to the rust consumer. +/// +/// # Panics +/// Only if internal assertions fail. #[allow(clippy::module_name_repetitions)] pub fn setup_logging(py: Python<'_>, target: &str) -> PyResult<()> { - let logging = py.import_bound("logging")?; + let logging = py.import("logging")?; logging.setattr("host_log", wrap_pyfunction!(host_log, &logging)?)?; - py.run_bound( - format!( + py.run( + CString::new(format!( r#" class HostHandler(Handler): def __init__(self, level=0): @@ -113,8 +118,9 @@ def basicConfig(*pargs, **kwargs): kwargs["handlers"] = [HostHandler()] return oldBasicConfig(*pargs, **kwargs) "# - ) - .as_str(), + )) + .expect("This is hardcoded") + .as_c_str(), Some(&logging.dict()), None, )?; diff --git a/flake.lock b/flake.lock index ff650d9..dc1f7f4 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1726560853, - "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1730531603, - "narHash": "sha256-Dqg6si5CqIzm87sp57j5nTaeBbWhHFaVyG7V6L8k3lY=", + "lastModified": 1731319897, + "narHash": "sha256-PbABj4tnbWFMfBp6OcUK5iGy1QY+/Z96ZcLpooIbuEI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "7ffd9ae656aec493492b44d0ddfb28e79a1ea25d", + "rev": "dc460ec76cbff0e66e269457d7b728432263166c", "type": "github" }, "original": { diff --git a/yt/Cargo.toml b/yt/Cargo.toml index 8ead971..dc42f7e 100644 --- a/yt/Cargo.toml +++ b/yt/Cargo.toml @@ -23,18 +23,18 @@ rust-version.workspace = true publish = false [dependencies] -anyhow = "1.0.92" +anyhow = "1.0.93" blake3 = "1.5.4" chrono = { version = "0.4.38", features = ["now"] } chrono-humanize = "0.2.3" -clap = { version = "4.5.20", features = ["derive"] } +clap = { version = "4.5.21", features = ["derive"] } futures = "0.3.31" nucleo-matcher = "0.3.1" owo-colors = "4.1.0" regex = "1.11.1" sqlx = { version = "0.8.2", features = ["runtime-tokio", "sqlite"] } stderrlog = "0.6.0" -tempfile = "3.13.0" +tempfile = "3.14.0" toml = "0.8.19" trinitry = { version = "0.2.2" } xdg = "2.5.2" -- cgit 1.4.1