Skip to content

Commit f167f30

Browse files
author
Andrew J Westlake
committed
Added links to the migration guide on every deprecation note
1 parent 9244cc4 commit f167f30

File tree

5 files changed

+23
-11
lines changed

5 files changed

+23
-11
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,8 +518,8 @@ fn main() -> PyResult<()> {
518518
```
519519

520520
### Additional Information
521-
- Managing event loop references can be tricky with pyo3-asyncio. See [Event Loop References](https://awestlake87.github.io/pyo3-asyncio/master/doc/#event-loop-references) in the API docs to get a better intuition for how event loop references are managed in this library.
522-
- Testing pyo3-asyncio libraries and applications requires a custom test harness since Python requires control over the main thread. You can find a testing guide in the [API docs for the `testing` module](https://awestlake87.github.io/pyo3-asyncio/master/doc/testing)
521+
- Managing event loop references can be tricky with pyo3-asyncio. See [Event Loop References](https://awestlake87.github.io/pyo3-asyncio/master/doc/pyo3_asyncio/#event-loop-references) in the API docs to get a better intuition for how event loop references are managed in this library.
522+
- Testing pyo3-asyncio libraries and applications requires a custom test harness since Python requires control over the main thread. You can find a testing guide in the [API docs for the `testing` module](https://awestlake87.github.io/pyo3-asyncio/master/doc/pyo3_asyncio/testing)
523523

524524
## Migrating from 0.13 to 0.14
525525

src/async_std.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ where
230230
/// ```
231231
#[deprecated(
232232
since = "0.14.0",
233-
note = "Use the pyo3_asyncio::async_std::future_into_py instead"
233+
note = "Use the pyo3_asyncio::async_std::future_into_py instead\n\t\t(see the [migration guide](https://github.com/awestlake87/pyo3-asyncio/#migrating-from-013-to-014) for more details)"
234234
)]
235235
#[allow(deprecated)]
236236
pub fn into_coroutine<F>(py: Python, fut: F) -> PyResult<PyObject>

src/generic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ where
660660
/// ```
661661
#[deprecated(
662662
since = "0.14.0",
663-
note = "Use the pyo3_asyncio::generic::future_into_py instead"
663+
note = "Use the pyo3_asyncio::generic::future_into_py instead\n\t\t(see the [migration guide](https://github.com/awestlake87/pyo3-asyncio/#migrating-from-013-to-014) for more details)"
664664
)]
665665
#[allow(deprecated)]
666666
pub fn into_coroutine<R, F>(py: Python, fut: F) -> PyResult<PyObject>

src/lib.rs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ fn create_future(event_loop: &PyAny) -> PyResult<&PyAny> {
391391
/// ```
392392
#[deprecated(
393393
since = "0.14.0",
394-
note = "Use the pyo3_asyncio::async_std::run or pyo3_asyncio::tokio::run instead"
394+
note = "Use the pyo3_asyncio::async_std::run or pyo3_asyncio::tokio::run instead\n\t\t(see the [migration guide](https://github.com/awestlake87/pyo3-asyncio/#migrating-from-013-to-014) for more details)"
395395
)]
396396
#[allow(deprecated)]
397397
pub fn with_runtime<F, R>(py: Python, f: F) -> PyResult<R>
@@ -431,7 +431,10 @@ fn close(event_loop: &PyAny) -> PyResult<()> {
431431
/// - Must be called before any other pyo3-asyncio functions.
432432
/// - Calling `try_init` a second time returns `Ok(())` and does nothing.
433433
/// > In future versions this may return an `Err`.
434-
#[deprecated(since = "0.14.0")]
434+
#[deprecated(
435+
since = "0.14.0",
436+
note = "see the [migration guide](https://github.com/awestlake87/pyo3-asyncio/#migrating-from-013-to-014) for more details"
437+
)]
435438
pub fn try_init(py: Python) -> PyResult<()> {
436439
CACHED_EVENT_LOOP.get_or_try_init(|| -> PyResult<PyObject> {
437440
let event_loop = asyncio_get_event_loop(py)?;
@@ -483,7 +486,10 @@ pub fn get_running_loop(py: Python) -> PyResult<&PyAny> {
483486
}
484487

485488
/// Get a reference to the Python event loop cached by `try_init` (0.13 behaviour)
486-
#[deprecated(since = "0.14.0")]
489+
#[deprecated(
490+
since = "0.14.0",
491+
note = "see the [migration guide](https://github.com/awestlake87/pyo3-asyncio/#migrating-from-013-to-014) for more details"
492+
)]
487493
pub fn get_event_loop(py: Python) -> &PyAny {
488494
CACHED_EVENT_LOOP.get().expect(EXPECT_INIT).as_ref(py)
489495
}
@@ -539,7 +545,10 @@ pub fn get_event_loop(py: Python) -> &PyAny {
539545
/// }
540546
/// # #[cfg(not(feature = "async-std-runtime"))]
541547
/// # fn main() {}
542-
#[deprecated(since = "0.14.0")]
548+
#[deprecated(
549+
since = "0.14.0",
550+
note = "see the [migration guide](https://github.com/awestlake87/pyo3-asyncio/#migrating-from-013-to-014) for more details"
551+
)]
543552
#[allow(deprecated)]
544553
pub fn run_forever(py: Python) -> PyResult<()> {
545554
if let Err(e) = get_event_loop(py).call_method0("run_forever") {
@@ -554,7 +563,10 @@ pub fn run_forever(py: Python) -> PyResult<()> {
554563
}
555564

556565
/// Shutdown the event loops and perform any necessary cleanup
557-
#[deprecated(since = "0.14.0")]
566+
#[deprecated(
567+
since = "0.14.0",
568+
note = "see the [migration guide](https://github.com/awestlake87/pyo3-asyncio/#migrating-from-013-to-014) for more details"
569+
)]
558570
pub fn try_close(py: Python) -> PyResult<()> {
559571
if let Some(exec) = EXECUTOR.get() {
560572
// Shutdown the executor and wait until all threads are cleaned up
@@ -751,7 +763,7 @@ pub fn into_future_with_loop(
751763
/// ```
752764
#[deprecated(
753765
since = "0.14.0",
754-
note = "Use pyo3_asyncio::async_std::into_future or pyo3_asyncio::tokio::into_future"
766+
note = "Use pyo3_asyncio::async_std::into_future or pyo3_asyncio::tokio::into_future instead\n (see the [migration guide](https://github.com/awestlake87/pyo3-asyncio/#migrating-from-013-to-014) for more details)"
755767
)]
756768
#[allow(deprecated)]
757769
pub fn into_future(awaitable: &PyAny) -> PyResult<impl Future<Output = PyResult<PyObject>> + Send> {

src/tokio.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ where
243243
/// ```
244244
#[deprecated(
245245
since = "0.14.0",
246-
note = "Use the pyo3_asyncio::tokio::future_into_py instead"
246+
note = "Use pyo3_asyncio::tokio::future_into_py instead\n (see the [migration guide](https://github.com/awestlake87/pyo3-asyncio/#migrating-from-013-to-014) for more details)"
247247
)]
248248
#[allow(deprecated)]
249249
pub fn into_coroutine<F>(py: Python, fut: F) -> PyResult<PyObject>

0 commit comments

Comments
 (0)