Description
This issue is a placeholder issue which I'd like to use to keep track of what we need to do to support async fn
for #[pyfunction]
(and #[pymethods]
).
While this would be a great feature to have, I think anything which we merge into PyO3 core should be simple to use, performant, and (ideally) async-runtime agnostic.
Users have started researching the design space of how possible cross-language implementations could be written. The most advanced candidate is pyo3-async-runtimes
, (formerly pyo3-asyncio
). See the guide as a great example of how to use it: https://pyo3.rs/latest/ecosystem/async-await.html
At the moment I suggest we allow some time for that and other crates to mature, and once we understand performance trade-offs / difficulties etc. we can consider upstreaming something here.
As this is supported by third-party crates I think we can afford patience for now.