Skip to content

Commit 2d935dc

Browse files
committed
Upgrade pyo3 to 0.17.X and bump version
1 parent bc2d75d commit 2d935dc

File tree

10 files changed

+82
-67
lines changed

10 files changed

+82
-67
lines changed

.github/workflows/ci.yml

+19-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
steps:
1818
- uses: actions/checkout@v2
1919
- uses: actions/setup-python@v2
20-
- run: pip install black==19.10b0
20+
- run: pip install black==22.8.0
2121
- uses: actions-rs/toolchain@v1
2222
with:
2323
toolchain: stable
@@ -110,6 +110,7 @@ jobs:
110110
python-architecture: "x64",
111111
rust-target: "x86_64-unknown-linux-gnu",
112112
}
113+
msrv: "nightly"
113114
extra_features: "nightly"
114115

115116
steps:
@@ -133,6 +134,15 @@ jobs:
133134
name: Prepare LD_LIBRARY_PATH (Ubuntu only)
134135
run: echo LD_LIBRARY_PATH=${pythonLocation}/lib >> $GITHUB_ENV
135136

137+
- if: matrix.msrv == 'MSRV'
138+
name: Prepare minimal package versions (MSRV only)
139+
run: |
140+
set -x
141+
cargo update -p tokio --precise 1.13.1
142+
cargo update -p indexmap --precise 1.6.2
143+
cargo update -p parking_lot:0.12.1 --precise 0.11.2
144+
cargo update -p async-global-executor --precise 2.2.0
145+
136146
- name: Build (no features)
137147
run: cargo build --no-default-features --verbose --target ${{ matrix.platform.rust-target }}
138148

@@ -145,6 +155,14 @@ jobs:
145155
run: |
146156
python -m pip install -U uvloop
147157
158+
- if: matrix.msrv != 'MSRV'
159+
name: Test
160+
run: cargo test --all-features
161+
162+
- if: matrix.msrv == 'MSRV'
163+
name: Test (MSRV, --no-default-features)
164+
run: cargo test --no-default-features --features tokio,async-std-runtime,unstable-streams
165+
148166
env:
149167
RUST_BACKTRACE: 1
150168
RUSTFLAGS: "-D warnings"

Cargo.toml

+6-6
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.16.0"
4+
version = "0.17.0"
55
authors = ["Andrew J Westlake <[email protected]>"]
66
readme = "README.md"
77
keywords = ["pyo3", "python", "ffi", "async", "asyncio"]
@@ -106,21 +106,21 @@ required-features = ["tokio-runtime", "testing"]
106106
async-channel = { version = "1.6", optional = true }
107107
clap = { version = "3.1.5", optional = true }
108108
futures = "0.3"
109-
inventory = { version = "0.2", optional = true }
109+
inventory = { version = "0.3", optional = true }
110110
once_cell = "1.5"
111111
pin-project-lite = "0.2"
112-
pyo3 = "0.16"
113-
pyo3-asyncio-macros = { path = "pyo3-asyncio-macros", version = "=0.16.0", optional = true }
112+
pyo3 = "0.17"
113+
pyo3-asyncio-macros = { path = "pyo3-asyncio-macros", version = "=0.17.0", optional = true }
114114

115115
[dev-dependencies]
116-
pyo3 = { version = "0.16", features = ["macros"] }
116+
pyo3 = { version = "0.17", features = ["macros"] }
117117

118118
[dependencies.async-std]
119119
version = "1.10"
120120
features = ["unstable"]
121121
optional = true
122122

123123
[dependencies.tokio]
124-
version = "1.13"
124+
version = "1.13"
125125
features = ["full"]
126126
optional = true

pyo3-asyncio-macros/Cargo.toml

+1-1
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.16.0"
4+
version = "0.17.0"
55
authors = ["Andrew J Westlake <[email protected]>"]
66
readme = "../README.md"
77
keywords = ["pyo3", "python", "ffi", "async", "asyncio"]

pytests/common/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use pyo3::prelude::*;
44
use pyo3_asyncio::TaskLocals;
55

66
pub(super) const TEST_MOD: &'static str = r#"
7-
import asyncio
7+
import asyncio
88
99
async def py_sleep(duration):
1010
await asyncio.sleep(duration)

pytests/test_async_std_asyncio.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use std::{
99
use async_std::task;
1010
use pyo3::{
1111
prelude::*,
12-
proc_macro::pymodule,
1312
types::{IntoPyDict, PyType},
1413
wrap_pyfunction, wrap_pymodule,
1514
};
@@ -174,12 +173,12 @@ async fn test_cancel() -> PyResult<()> {
174173

175174
#[cfg(feature = "unstable-streams")]
176175
const ASYNC_STD_TEST_MOD: &str = r#"
177-
import asyncio
176+
import asyncio
178177
179178
async def gen():
180179
for i in range(10):
181180
await asyncio.sleep(0.1)
182-
yield i
181+
yield i
183182
"#;
184183

185184
#[cfg(feature = "unstable-streams")]
@@ -257,15 +256,15 @@ fn test_local_cancel(event_loop: PyObject) -> PyResult<()> {
257256
#[pymodule]
258257
fn test_mod(_py: Python, m: &PyModule) -> PyResult<()> {
259258
#![allow(deprecated)]
260-
#[pyfunction]
261-
fn sleep(py: Python) -> PyResult<&PyAny> {
259+
#[pyfunction(name = "sleep")]
260+
fn sleep_(py: Python) -> PyResult<&PyAny> {
262261
pyo3_asyncio::async_std::future_into_py(py, async move {
263262
async_std::task::sleep(Duration::from_millis(500)).await;
264263
Ok(())
265264
})
266265
}
267266

268-
m.add_function(wrap_pyfunction!(sleep, m)?)?;
267+
m.add_function(wrap_pyfunction!(sleep_, m)?)?;
269268

270269
Ok(())
271270
}

pytests/tokio_asyncio/mod.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use std::{
66

77
use pyo3::{
88
prelude::*,
9-
proc_macro::pymodule,
109
types::{IntoPyDict, PyType},
1110
wrap_pyfunction, wrap_pymodule,
1211
};
@@ -229,15 +228,15 @@ fn test_local_cancel(event_loop: PyObject) -> PyResult<()> {
229228
#[pymodule]
230229
fn test_mod(_py: Python, m: &PyModule) -> PyResult<()> {
231230
#![allow(deprecated)]
232-
#[pyfunction]
233-
fn sleep(py: Python) -> PyResult<&PyAny> {
231+
#[pyfunction(name = "sleep")]
232+
fn sleep_(py: Python) -> PyResult<&PyAny> {
234233
pyo3_asyncio::tokio::future_into_py(py, async move {
235234
tokio::time::sleep(Duration::from_millis(500)).await;
236235
Ok(())
237236
})
238237
}
239238

240-
m.add_function(wrap_pyfunction!(sleep, m)?)?;
239+
m.add_function(wrap_pyfunction!(sleep_, m)?)?;
241240

242241
Ok(())
243242
}
@@ -293,12 +292,12 @@ fn cvars_mod(_py: Python, m: &PyModule) -> PyResult<()> {
293292

294293
#[cfg(feature = "unstable-streams")]
295294
const TOKIO_TEST_MOD: &str = r#"
296-
import asyncio
295+
import asyncio
297296
298297
async def gen():
299298
for i in range(10):
300299
await asyncio.sleep(0.1)
301-
yield i
300+
yield i
302301
"#;
303302

304303
#[cfg(feature = "unstable-streams")]

src/async_std.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ where
210210
/// Ok(())
211211
/// })
212212
/// .map_err(|e| {
213-
/// e.print_and_set_sys_last_vars(py);
213+
/// e.print_and_set_sys_last_vars(py);
214214
/// })
215215
/// .unwrap();
216216
/// })
@@ -497,7 +497,7 @@ where
497497
/// )
498498
/// })?
499499
/// .await?;
500-
/// Ok(())
500+
/// Ok(())
501501
/// }
502502
/// ```
503503
pub fn into_future(awaitable: &PyAny) -> PyResult<impl Future<Output = PyResult<PyObject>> + Send> {
@@ -524,7 +524,7 @@ pub fn into_future(awaitable: &PyAny) -> PyResult<impl Future<Output = PyResult<
524524
/// async def gen():
525525
/// for i in range(10):
526526
/// await asyncio.sleep(0.1)
527-
/// yield i
527+
/// yield i
528528
/// "#;
529529
///
530530
/// # #[cfg(all(feature = "unstable-streams", feature = "attributes"))]
@@ -537,7 +537,7 @@ pub fn into_future(awaitable: &PyAny) -> PyResult<impl Future<Output = PyResult<
537537
/// "test_rust_coroutine/test_mod.py",
538538
/// "test_mod",
539539
/// )?;
540-
///
540+
///
541541
/// pyo3_asyncio::async_std::into_stream_v1(test_mod.call_method0("gen")?)
542542
/// })?;
543543
///
@@ -581,7 +581,7 @@ pub fn into_stream_v1<'p>(
581581
/// async def gen():
582582
/// for i in range(10):
583583
/// await asyncio.sleep(0.1)
584-
/// yield i
584+
/// yield i
585585
/// "#;
586586
///
587587
/// # #[cfg(all(feature = "unstable-streams", feature = "attributes"))]
@@ -594,7 +594,7 @@ pub fn into_stream_v1<'p>(
594594
/// "test_rust_coroutine/test_mod.py",
595595
/// "test_mod",
596596
/// )?;
597-
///
597+
///
598598
/// pyo3_asyncio::async_std::into_stream_with_locals_v1(
599599
/// pyo3_asyncio::async_std::get_current_locals(py)?,
600600
/// test_mod.call_method0("gen")?
@@ -642,7 +642,7 @@ pub fn into_stream_with_locals_v1<'p>(
642642
/// async def gen():
643643
/// for i in range(10):
644644
/// await asyncio.sleep(0.1)
645-
/// yield i
645+
/// yield i
646646
/// "#;
647647
///
648648
/// # #[cfg(all(feature = "unstable-streams", feature = "attributes"))]
@@ -655,7 +655,7 @@ pub fn into_stream_with_locals_v1<'p>(
655655
/// "test_rust_coroutine/test_mod.py",
656656
/// "test_mod",
657657
/// )?;
658-
///
658+
///
659659
/// pyo3_asyncio::async_std::into_stream_with_locals_v2(
660660
/// pyo3_asyncio::async_std::get_current_locals(py)?,
661661
/// test_mod.call_method0("gen")?
@@ -702,7 +702,7 @@ pub fn into_stream_with_locals_v2<'p>(
702702
/// async def gen():
703703
/// for i in range(10):
704704
/// await asyncio.sleep(0.1)
705-
/// yield i
705+
/// yield i
706706
/// "#;
707707
///
708708
/// # #[cfg(all(feature = "unstable-streams", feature = "attributes"))]
@@ -715,7 +715,7 @@ pub fn into_stream_with_locals_v2<'p>(
715715
/// "test_rust_coroutine/test_mod.py",
716716
/// "test_mod",
717717
/// )?;
718-
///
718+
///
719719
/// pyo3_asyncio::async_std::into_stream_v2(test_mod.call_method0("gen")?)
720720
/// })?;
721721
///

0 commit comments

Comments
 (0)