-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can we use pyo3-asyncio with pyo3 >=0.14 #38
Comments
Sorry for the late response. There is not currently a way to use it with 0.14, the main hold up being #30 right now. Currently, I haven't bumped the pyo3 version to 0.14 on that branch, but I can do that sometime today. #30 has been approved, but there's still some documentation to be done since it's a fairly major change. You should still be able to use the 0.13 API, but you'll get some deprecation warnings until you start using the newer functions. I expect it'll be at least a day or two before this is released as 0.14. |
Ok, I've got the version bumped to 0.14 on the [dependencies]
pyo3 = "0.14"
pyo3-asyncio = { git = "https://github.com/awestlake87/pyo3-asyncio", branch = "init-fixes" } |
Thank you @awestlake87! 😄 |
No problem! Let me know if you run into any issues with that branch. You're a bit of a guinea pig for the pyo3-asyncio 0.14 release, so any feedback would be valuable. |
@awestlake87 absolutely. I am getting some deprecation warnings in the update. --> src/lib.rs:25:5
|
25 | pyo3_asyncio::try_init(py)?;
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(deprecated)]` on by default
warning: use of deprecated function `pyo3_asyncio::into_future`: Use pyo3_asyncio::async_std::into_future or pyo3_asyncio::tokio::into_future
--> src/processor.rs:108:17
|
108 | pyo3_asyncio::into_future(coro?)
| ^^^^^^^^^^^^^^^^^^^^^^^^^
warning: use of deprecated function `pyo3_asyncio::run_forever`
--> src/server.rs:15:5
|
15 | use pyo3_asyncio::run_forever;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
warning: use of deprecated function `pyo3_asyncio::run_forever`
--> src/server.rs:66:9
|
66 | run_forever(py).unwrap()
| ^^^^^^^^^^^
warning: 4 warnings emitted Do you have any docs that I can refer for these? |
Yeah, the initialization changes affected the way this library deals with the event loop and this was significant enough to warrant a new set of API functions with slightly different semantics. The old API is still usable, but like you've noticed, it's gated behind some deprecation attributes. You have a couple of options:
I haven't put together a formal migration guide for 0.14 yet, but if you're ready to convert to the 0.14 API, here are some general migration tips:
|
@awestlake87 , removing pyo3_asyncio::try_init and replacing pyo3_asyncio::run_forever with the tokio snippet doesn't make the async loop run. Earlier, I used to run the snippet:
Now, I have replaced it with:
The app closes as soon as it is started. Should I be running an empty loop somewhere? |
Hmm, I probably cant take a look at this until later this evening, but at first glance nothing seems wrong. Is there more context you can provide? I dont see any conversions anywhere. |
@awestlake87 , sure. I just replaced the line |
Also, if |
If you're still using the deprecated conversions like |
@awestlake87 , I got rid of that error. But it is telling me that: |
I think that's probably happening in some other code snippet I haven't seen yet. Is this project on GitHub? I'd probably be able to give better advice if I see more parts of it. |
@awestlake87 , sure. Here is the PR, where I am trying to do the migration: sparckles/Robyn#65 Here is the main repo: https://github.com/sansyrox/robyn |
🐛 Bug Reports
When I am using pyo3-asyncio with pyo3 v0.13.2, I getting an error which was solved in v0.14 . Is there a way to the error below or use the latest pyo3?
🌍 Environment
rustc --version
): 1.52.1version = "0.x.y"
withgit = "https://github.com/awestlake87/pyo3-asyncio")?
:💥 Reproducing
Please provide a minimal working example. This means both the Rust code and the Python.
This is the cargo.toml
And I get the following error:
The text was updated successfully, but these errors were encountered: