Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "pyo3-async-runtimes"
description = "PyO3 bridges from Rust runtimes to Python's Asyncio library"
version = "0.22.0"
version = "0.23.0"
authors = [
"Andrew J Westlake <[email protected]>",
"David Hewitt <[email protected]>",
Expand Down Expand Up @@ -120,11 +120,11 @@ futures = "0.3"
inventory = { version = "0.3", optional = true }
once_cell = "1.14"
pin-project-lite = "0.2"
pyo3 = "0.22"
pyo3-async-runtimes-macros = { path = "pyo3-async-runtimes-macros", version = "=0.22.0", optional = true }
pyo3 = "0.23"
pyo3-async-runtimes-macros = { path = "pyo3-async-runtimes-macros", version = "=0.23.0", optional = true }

[dev-dependencies]
pyo3 = { version = "0.22", features = ["macros"] }
pyo3 = { version = "0.23", features = ["macros"] }

[dependencies.async-std]
version = "1.12"
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ Here we initialize the runtime, import Python's `asyncio` library and run the gi
```toml
# Cargo.toml dependencies
[dependencies]
pyo3 = { version = "0.22" }
pyo3-async-runtimes = { version = "0.22", features = ["attributes", "async-std-runtime"] }
pyo3 = { version = "0.23" }
pyo3-async-runtimes = { version = "0.23", features = ["attributes", "async-std-runtime"] }
async-std = "1.13"
```

Expand Down Expand Up @@ -84,8 +84,8 @@ attribute.
```toml
# Cargo.toml dependencies
[dependencies]
pyo3 = { version = "0.22" }
pyo3-async-runtimes = { version = "0.22", features = ["attributes", "tokio-runtime"] }
pyo3 = { version = "0.23" }
pyo3-async-runtimes = { version = "0.23", features = ["attributes", "tokio-runtime"] }
tokio = "1.40"
```

Expand Down Expand Up @@ -130,8 +130,8 @@ For `async-std`:

```toml
[dependencies]
pyo3 = { version = "0.22", features = ["extension-module"] }
pyo3-async-runtimes = { version = "0.22", features = ["async-std-runtime"] }
pyo3 = { version = "0.23", features = ["extension-module"] }
pyo3-async-runtimes = { version = "0.23", features = ["async-std-runtime"] }
async-std = "1.13"
```

Expand All @@ -140,7 +140,7 @@ For `tokio`:
```toml
[dependencies]
pyo3 = { version = "0.20", features = ["extension-module"] }
pyo3-async-runtimes = { version = "0.22", features = ["tokio-runtime"] }
pyo3-async-runtimes = { version = "0.23", features = ["tokio-runtime"] }
tokio = "1.40"
```

Expand Down Expand Up @@ -434,8 +434,8 @@ name = "my_async_module"
crate-type = ["cdylib"]

[dependencies]
pyo3 = { version = "0.22", features = ["extension-module"] }
pyo3-async-runtimes = { version = "0.22", features = ["tokio-runtime"] }
pyo3 = { version = "0.23", features = ["extension-module"] }
pyo3-async-runtimes = { version = "0.23", features = ["tokio-runtime"] }
async-std = "1.13"
tokio = "1.40"
```
Expand Down Expand Up @@ -494,8 +494,8 @@ event loop before we can install the `uvloop` policy.
```toml
[dependencies]
async-std = "1.13"
pyo3 = "0.22"
pyo3-async-runtimes = { version = "0.22", features = ["async-std-runtime"] }
pyo3 = "0.23"
pyo3-async-runtimes = { version = "0.23", features = ["async-std-runtime"] }
```

```rust no_run
Expand Down
2 changes: 1 addition & 1 deletion pyo3-async-runtimes-macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "pyo3-async-runtimes-macros"
description = "Proc Macro Attributes for `pyo3-async-runtimes`"
version = "0.22.0"
version = "0.23.0"
authors = [
"Andrew J Westlake <[email protected]>",
"David Hewitt <[email protected]>",
Expand Down
30 changes: 17 additions & 13 deletions src/async_std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//!
//! ```toml
//! [dependencies.pyo3-async-runtimes]
//! version = "0.22"
//! version = "0.23"
//! features = ["unstable-streams"]
//! ```

Expand Down Expand Up @@ -272,16 +272,17 @@ where
/// )
/// }
/// ```
pub fn future_into_py_with_locals<F, T>(
pub fn future_into_py_with_locals<F, T, P>(
py: Python,
locals: TaskLocals,
fut: F,
) -> PyResult<Bound<PyAny>>
where
F: Future<Output = PyResult<T>> + Send + 'static,
T: IntoPy<PyObject>,
T: for<'py> IntoPyObject<'py, Target = P>,
P: AsRef<PyAny>,
{
generic::future_into_py_with_locals::<AsyncStdRuntime, F, T>(py, locals, fut)
generic::future_into_py_with_locals::<AsyncStdRuntime, F, T, P>(py, locals, fut)
}

/// Convert a Rust Future into a Python awaitable
Expand Down Expand Up @@ -322,12 +323,13 @@ where
/// })
/// }
/// ```
pub fn future_into_py<F, T>(py: Python, fut: F) -> PyResult<Bound<PyAny>>
pub fn future_into_py<F, T, P>(py: Python, fut: F) -> PyResult<Bound<PyAny>>
where
F: Future<Output = PyResult<T>> + Send + 'static,
T: IntoPy<PyObject>,
T: for<'py> IntoPyObject<'py, Target = P>,
P: AsRef<PyAny>,
{
generic::future_into_py::<AsyncStdRuntime, _, T>(py, fut)
generic::future_into_py::<AsyncStdRuntime, _, T, P>(py, fut)
}

/// Convert a `!Send` Rust Future into a Python awaitable
Expand Down Expand Up @@ -393,16 +395,17 @@ where
note = "Questionable whether these conversions have real-world utility (see https://github.com/awestlake87/pyo3-asyncio/issues/59#issuecomment-1008038497 and let me know if you disagree!)"
)]
#[allow(deprecated)]
pub fn local_future_into_py_with_locals<F, T>(
pub fn local_future_into_py_with_locals<F, T, P>(
py: Python,
locals: TaskLocals,
fut: F,
) -> PyResult<Bound<PyAny>>
where
F: Future<Output = PyResult<T>> + 'static,
T: IntoPy<PyObject>,
T: for<'py> IntoPyObject<'py, Target = P>,
P: AsRef<PyAny>,
{
generic::local_future_into_py_with_locals::<AsyncStdRuntime, _, T>(py, locals, fut)
generic::local_future_into_py_with_locals::<AsyncStdRuntime, _, T, P>(py, locals, fut)
}

/// Convert a `!Send` Rust Future into a Python awaitable
Expand Down Expand Up @@ -463,12 +466,13 @@ where
note = "Questionable whether these conversions have real-world utility (see https://github.com/awestlake87/pyo3-asyncio/issues/59#issuecomment-1008038497 and let me know if you disagree!)"
)]
#[allow(deprecated)]
pub fn local_future_into_py<F, T>(py: Python, fut: F) -> PyResult<Bound<PyAny>>
pub fn local_future_into_py<F, T, P>(py: Python, fut: F) -> PyResult<Bound<PyAny>>
where
F: Future<Output = PyResult<T>> + 'static,
T: IntoPy<PyObject>,
T: for<'py> IntoPyObject<'py, Target = P>,
P: AsRef<PyAny>,
{
generic::local_future_into_py::<AsyncStdRuntime, _, T>(py, fut)
generic::local_future_into_py::<AsyncStdRuntime, _, T, _>(py, fut)
}

/// Convert a Python `awaitable` into a Rust Future
Expand Down
Loading