Remix.run Logo
ptrj_ 5 days ago

How have you found the current experience of (async) networking in Rust? This is something which is stupidly easy out-of-the-box in Python -- semi-seriously, async/await in Python was _made_ for interacting w/ a chat completions/messages API.

(As an aside, my "ideal" language mix would be a pairing of Rust with Python, though the PyO3 interface could be improved.)

Would also love to learn more about your Rust agent + Qwen3!

jasonjmcghee 5 days ago | parent [-]

I would pick rust for doing async over python every time, if it's the only consideration.

In python there are hidden sharp edges and depending on what dependencies you use you can get into deadlocks in production without ever knowing you were in danger.

Rust has traits to protect against this. Async in rust is great.

I'd do something like:

let (tx, rx) = std::sync::mpsc::channel(); thread::spawn(move || { // blocking request let response = reqwest::blocking::get(url).unwrap(); tx.send(response.text().unwrap()); });

Or

let (tx, mut rx) = tokio::sync::mpsc::channel(100); tokio::spawn(async move { let response = client.get(url).send().await; tx.send(response).await; });

ptrj_ 5 days ago | parent [-]

> In python there are hidden sharp edges and depending on what dependencies you use you can get into deadlocks in production without ever knowing you were in danger.

I've heard of deadlocks when using aiohttp or maybe httpx (e.g. due to hidden async-related globals), but have never managed myself to get any system based on asyncio + concurrent.futures + urllib (i.e. stdlib-only) to deadlock, including w/ some mix of asyncio and threading locks.