Skip to content

Commit 291a72e

Browse files
awestlake87rise0chendependabot[bot]
authored
Pyo3 0.18 upgrade (#88)
* feat: Initialize the Tokio runtime with a custom Tokio runtime * Update pyo3 requirement from 0.17 to 0.18 Updates the requirements on [pyo3](https://github.com/pyo3/pyo3) to permit the latest version. - [Release notes](https://github.com/pyo3/pyo3/releases) - [Changelog](https://github.com/PyO3/pyo3/blob/main/CHANGELOG.md) - [Commits](PyO3/pyo3@v0.17.0...v0.18.0) --- updated-dependencies: - dependency-name: pyo3 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> * Fixed warning, removed unnecessary allow(deprecated) * Updated some more version numbers * Marked local conversions as deprecated * Pinned clap version for MSRV test * Reverted tokio and clap versions to support MSRV * Removed version pinning for clap since it's unnecessary * Updating some github actions versions * Upgraded rust toolchain action * Removed unused args * Added python version to setup-python action --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: rise0chen <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 8b0f70e commit 291a72e

File tree

12 files changed

+106
-48
lines changed

12 files changed

+106
-48
lines changed

.github/dependabot.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ updates:
99
directory: "/" # Location of package manifests
1010
schedule:
1111
interval: "weekly"
12+
allow:
13+
- dependency-type: direct
14+
- dependency-name: tokio # haven't been seeing updates for tokio

.github/workflows/ci.yml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@ jobs:
1515
fmt:
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v2
19-
- uses: actions/setup-python@v2
18+
- uses: actions/checkout@v3
19+
- uses: actions/setup-python@v4
20+
with:
21+
python-version: "3.10"
2022
- run: pip install black==22.8.0
21-
- uses: actions-rs/toolchain@v1
23+
- uses: dtolnay/rust-toolchain@stable
2224
with:
2325
toolchain: stable
24-
profile: minimal
2526
components: rustfmt
2627
- name: Check python formatting (black)
2728
run: black --check .
@@ -31,11 +32,10 @@ jobs:
3132
clippy:
3233
runs-on: ubuntu-latest
3334
steps:
34-
- uses: actions/checkout@v2
35-
- uses: actions-rs/toolchain@v1
35+
- uses: actions/checkout@v3
36+
- uses: dtolnay/rust-toolchain@stable
3637
with:
3738
toolchain: stable
38-
profile: minimal
3939
components: clippy
4040
- run: make clippy
4141

@@ -114,21 +114,19 @@ jobs:
114114
extra_features: "nightly"
115115

116116
steps:
117-
- uses: actions/checkout@v2
117+
- uses: actions/checkout@v3
118118

119119
- name: Set up Python ${{ matrix.python-version }}
120-
uses: actions/setup-python@v2
120+
uses: actions/setup-python@v4
121121
with:
122122
python-version: ${{ matrix.python-version }}
123123
architecture: ${{ matrix.platform.python-architecture }}
124124

125125
- name: Install Rust toolchain
126-
uses: actions-rs/toolchain@v1
126+
uses: dtolnay/rust-toolchain@stable
127127
with:
128128
toolchain: ${{ matrix.rust }}
129129
target: ${{ matrix.platform.rust-target }}
130-
profile: minimal
131-
default: true
132130

133131
- if: matrix.platform.os == 'ubuntu-latest'
134132
name: Prepare LD_LIBRARY_PATH (Ubuntu only)
@@ -175,12 +173,11 @@ jobs:
175173
needs: [fmt]
176174
runs-on: ubuntu-latest
177175
steps:
178-
- uses: actions/checkout@v2
179-
- uses: actions-rs/toolchain@v1
176+
- uses: actions/checkout@v3
177+
- uses: dtolnay/rust-toolchain@stable
180178
with:
181179
toolchain: nightly
182180
override: true
183-
profile: minimal
184181
- name: Install pyo3-asyncio test dependencies
185182
run: |
186183
python -m pip install -U uvloop

.github/workflows/guide.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
outputs:
1717
tag_name: ${{ steps.prepare_tag.outputs.tag_name }}
1818
steps:
19-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v3
2020

2121
# This adds the docs to gh-pages-build/doc
2222
- name: Build the doc
@@ -38,7 +38,7 @@ jobs:
3838
github_token: ${{ secrets.GITHUB_TOKEN }}
3939
publish_dir: ./gh-pages-build/
4040
destination_dir: ${{ steps.prepare_tag.outputs.tag_name }}
41-
full_commit_message: 'Upload documentation for ${{ steps.prepare_tag.outputs.tag_name }}'
41+
full_commit_message: "Upload documentation for ${{ steps.prepare_tag.outputs.tag_name }}"
4242

4343
release:
4444
needs: deploy
@@ -57,5 +57,5 @@ jobs:
5757
with:
5858
github_token: ${{ secrets.GITHUB_TOKEN }}
5959
publish_dir: ./public/
60-
full_commit_message: 'Release ${{ needs.deploy.outputs.tag_name }}'
60+
full_commit_message: "Release ${{ needs.deploy.outputs.tag_name }}"
6161
keep_files: true

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "pyo3-asyncio"
33
description = "PyO3 utilities for Python's Asyncio library"
4-
version = "0.17.0"
4+
version = "0.18.0"
55
authors = ["Andrew J Westlake <[email protected]>"]
66
readme = "README.md"
77
keywords = ["pyo3", "python", "ffi", "async", "asyncio"]
@@ -116,11 +116,11 @@ futures = "0.3"
116116
inventory = { version = "0.3", optional = true }
117117
once_cell = "1.14"
118118
pin-project-lite = "0.2"
119-
pyo3 = "0.17"
120-
pyo3-asyncio-macros = { path = "pyo3-asyncio-macros", version = "=0.17.0", optional = true }
119+
pyo3 = "0.18"
120+
pyo3-asyncio-macros = { path = "pyo3-asyncio-macros", version = "=0.18.0", optional = true }
121121

122122
[dev-dependencies]
123-
pyo3 = { version = "0.17", features = ["macros"] }
123+
pyo3 = { version = "0.18", features = ["macros"] }
124124

125125
[dependencies.async-std]
126126
version = "1.12"
@@ -129,5 +129,5 @@ optional = true
129129

130130
[dependencies.tokio]
131131
version = "1.13"
132-
features = ["full"]
132+
features = ["rt", "rt-multi-thread", "time"]
133133
optional = true

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ Here we initialize the runtime, import Python's `asyncio` library and run the gi
5252
```toml
5353
# Cargo.toml dependencies
5454
[dependencies]
55-
pyo3 = { version = "0.17" }
56-
pyo3-asyncio = { version = "0.17", features = ["attributes", "async-std-runtime"] }
55+
pyo3 = { version = "0.18" }
56+
pyo3-asyncio = { version = "0.18", features = ["attributes", "async-std-runtime"] }
5757
async-std = "1.9"
5858
```
5959

@@ -82,8 +82,8 @@ attribute.
8282
```toml
8383
# Cargo.toml dependencies
8484
[dependencies]
85-
pyo3 = { version = "0.17" }
86-
pyo3-asyncio = { version = "0.17", features = ["attributes", "tokio-runtime"] }
85+
pyo3 = { version = "0.18" }
86+
pyo3-asyncio = { version = "0.18", features = ["attributes", "tokio-runtime"] }
8787
tokio = "1.9"
8888
```
8989

@@ -127,17 +127,17 @@ For `async-std`:
127127

128128
```toml
129129
[dependencies]
130-
pyo3 = { version = "0.17", features = ["extension-module"] }
131-
pyo3-asyncio = { version = "0.17", features = ["async-std-runtime"] }
130+
pyo3 = { version = "0.18", features = ["extension-module"] }
131+
pyo3-asyncio = { version = "0.18", features = ["async-std-runtime"] }
132132
async-std = "1.9"
133133
```
134134

135135
For `tokio`:
136136

137137
```toml
138138
[dependencies]
139-
pyo3 = { version = "0.17", features = ["extension-module"] }
140-
pyo3-asyncio = { version = "0.17", features = ["tokio-runtime"] }
139+
pyo3 = { version = "0.18", features = ["extension-module"] }
140+
pyo3-asyncio = { version = "0.18", features = ["tokio-runtime"] }
141141
tokio = "1.9"
142142
```
143143

@@ -431,8 +431,8 @@ name = "my_async_module"
431431
crate-type = ["cdylib"]
432432

433433
[dependencies]
434-
pyo3 = { version = "0.17", features = ["extension-module"] }
435-
pyo3-asyncio = { version = "0.17", features = ["tokio-runtime"] }
434+
pyo3 = { version = "0.18", features = ["extension-module"] }
435+
pyo3-asyncio = { version = "0.18", features = ["tokio-runtime"] }
436436
async-std = "1.9"
437437
tokio = "1.9"
438438
```
@@ -491,8 +491,8 @@ event loop before we can install the `uvloop` policy.
491491
```toml
492492
[dependencies]
493493
async-std = "1.9"
494-
pyo3 = "0.17"
495-
pyo3-asyncio = { version = "0.17", features = ["async-std-runtime"] }
494+
pyo3 = "0.18"
495+
pyo3-asyncio = { version = "0.18", features = ["async-std-runtime"] }
496496
```
497497

498498
```rust no_run

pyo3-asyncio-macros/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "pyo3-asyncio-macros"
33
description = "Proc Macro Attributes for PyO3 Asyncio"
4-
version = "0.17.0"
4+
version = "0.18.0"
55
authors = ["Andrew J Westlake <[email protected]>"]
66
readme = "../README.md"
77
keywords = ["pyo3", "python", "ffi", "async", "asyncio"]

pytests/test_async_std_asyncio.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ async fn test_local_future_into_py() -> PyResult<()> {
117117
Python::with_gil(|py| {
118118
let non_send_secs = Rc::new(1);
119119

120+
#[allow(deprecated)]
120121
let py_future = pyo3_asyncio::async_std::local_future_into_py(py, async move {
121122
async_std::task::sleep(Duration::from_secs(*non_send_secs)).await;
122123
Ok(())

pytests/tokio_asyncio/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ fn test_local_future_into_py(event_loop: PyObject) -> PyResult<()> {
9292
Python::with_gil(|py| {
9393
let non_send_secs = Rc::new(1);
9494

95+
#[allow(deprecated)]
9596
let py_future = pyo3_asyncio::tokio::local_future_into_py_with_locals(
9697
py,
9798
TaskLocals::new(event_loop.as_ref(py)),
@@ -175,6 +176,7 @@ async fn test_cancel() -> PyResult<()> {
175176
}
176177

177178
#[pyo3_asyncio::tokio::test]
179+
#[allow(deprecated)]
178180
fn test_local_cancel(event_loop: PyObject) -> PyResult<()> {
179181
let locals = Python::with_gil(|py| -> PyResult<TaskLocals> {
180182
Ok(TaskLocals::new(event_loop.as_ref(py)).copy_context(py)?)
@@ -186,6 +188,8 @@ fn test_local_cancel(event_loop: PyObject) -> PyResult<()> {
186188
let completed = Arc::new(Mutex::new(false));
187189
let py_future = Python::with_gil(|py| -> PyResult<PyObject> {
188190
let completed = Arc::clone(&completed);
191+
192+
#[allow(deprecated)]
189193
Ok(pyo3_asyncio::tokio::local_future_into_py(py, async move {
190194
tokio::time::sleep(Duration::from_secs(1)).await;
191195
*completed.lock().unwrap() = true;

src/async_std.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//!
1010
//! ```toml
1111
//! [dependencies.pyo3-asyncio]
12-
//! version = "0.17"
12+
//! version = "0.18"
1313
//! features = ["unstable-streams"]
1414
//! ```
1515
@@ -379,6 +379,11 @@ where
379379
/// # #[cfg(not(all(feature = "async-std-runtime", feature = "attributes")))]
380380
/// # fn main() {}
381381
/// ```
382+
#[deprecated(
383+
since = "0.18.0",
384+
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!)"
385+
)]
386+
#[allow(deprecated)]
382387
pub fn local_future_into_py_with_locals<F, T>(
383388
py: Python,
384389
locals: TaskLocals,
@@ -444,6 +449,11 @@ where
444449
/// # #[cfg(not(all(feature = "async-std-runtime", feature = "attributes")))]
445450
/// # fn main() {}
446451
/// ```
452+
#[deprecated(
453+
since = "0.18.0",
454+
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!)"
455+
)]
456+
#[allow(deprecated)]
447457
pub fn local_future_into_py<F, T>(py: Python, fut: F) -> PyResult<&PyAny>
448458
where
449459
F: Future<Output = PyResult<T>> + 'static,

src/generic.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//!
1010
//! ```toml
1111
//! [dependencies.pyo3-asyncio]
12-
//! version = "0.17"
12+
//! version = "0.18"
1313
//! features = ["unstable-streams"]
1414
//! ```
1515
@@ -29,7 +29,6 @@ use once_cell::sync::OnceCell;
2929
use pin_project_lite::pin_project;
3030
use pyo3::prelude::*;
3131

32-
#[allow(deprecated)]
3332
use crate::{
3433
asyncio, call_soon_threadsafe, close, create_future, dump_err, err::RustPanic,
3534
get_running_loop, into_future_with_locals, TaskLocals,
@@ -930,6 +929,10 @@ where
930929
/// )
931930
/// }
932931
/// ```
932+
#[deprecated(
933+
since = "0.18.0",
934+
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!)"
935+
)]
933936
pub fn local_future_into_py_with_locals<R, F, T>(
934937
py: Python,
935938
locals: TaskLocals,
@@ -1119,6 +1122,11 @@ where
11191122
/// })
11201123
/// }
11211124
/// ```
1125+
#[deprecated(
1126+
since = "0.18.0",
1127+
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!)"
1128+
)]
1129+
#[allow(deprecated)]
11221130
pub fn local_future_into_py<R, F, T>(py: Python, fut: F) -> PyResult<&PyAny>
11231131
where
11241132
R: Runtime + ContextExt + SpawnLocalExt + LocalContextExt,

0 commit comments

Comments
 (0)