Skip to content

Commit f846701

Browse files
committed
more naming.
1 parent 8473eed commit f846701

File tree

7 files changed

+33
-33
lines changed

7 files changed

+33
-33
lines changed

.github/workflows/guide.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
cargo doc --no-deps --all-features
2525
mkdir -p gh-pages-build
2626
cp -r target/doc gh-pages-build/doc
27-
echo "<meta http-equiv=refresh content=0;url=pyo3_asyncio/index.html>" > gh-pages-build/doc/index.html
27+
echo "<meta http-equiv=refresh content=0;url=pyo3_async_runtimes/index.html>" > gh-pages-build/doc/index.html
2828
2929
- name: Prepare tag
3030
id: prepare_tag

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ to do something special with the object that it returns.
229229
Normally in Python, that something special is the `await` keyword, but in order to await this
230230
coroutine in Rust, we first need to convert it into Rust's version of a `coroutine`: a `Future`.
231231
That's where `pyo3-async-runtimes` comes in.
232-
[`pyo3_async_runtimes::into_future`](https://docs.rs/pyo3-asyncio/latest/pyo3_asyncio/fn.into_future.html)
232+
[`pyo3_async_runtimes::into_future`](https://docs.rs/pyo3-asyncio/latest/pyo3_async_runtimes/fn.into_future.html)
233233
performs this conversion for us:
234234

235235
```rust no_run
@@ -281,7 +281,7 @@ let future = rust_sleep();
281281

282282
We can convert this `Future` object into Python to make it `awaitable`. This tells Python that you
283283
can use the `await` keyword with it. In order to do this, we'll call
284-
[`pyo3_async_runtimes::async_std::future_into_py`](https://docs.rs/pyo3-asyncio/latest/pyo3_asyncio/async_std/fn.future_into_py.html):
284+
[`pyo3_async_runtimes::async_std::future_into_py`](https://docs.rs/pyo3-asyncio/latest/pyo3_async_runtimes/async_std/fn.future_into_py.html):
285285

286286
```rust
287287
use pyo3::prelude::*;
@@ -323,7 +323,7 @@ implementations _prefer_ control over the main thread, this can still make some
323323

324324
Because Python needs to control the main thread, we can't use the convenient proc macros from Rust
325325
runtimes to handle the `main` function or `#[test]` functions. Instead, the initialization for PyO3 has to be done from the `main` function and the main
326-
thread must block on [`pyo3_async_runtimes::run_forever`](https://docs.rs/pyo3-asyncio/latest/pyo3_asyncio/fn.run_forever.html) or [`pyo3_async_runtimes::async_std::run_until_complete`](https://docs.rs/pyo3-asyncio/latest/pyo3_asyncio/async_std/fn.run_until_complete.html).
326+
thread must block on [`pyo3_async_runtimes::run_forever`](https://docs.rs/pyo3-asyncio/latest/pyo3_async_runtimes/fn.run_forever.html) or [`pyo3_async_runtimes::async_std::run_until_complete`](https://docs.rs/pyo3-asyncio/latest/pyo3_async_runtimes/async_std/fn.run_until_complete.html).
327327

328328
Because we have to block on one of those functions, we can't use [`#[async_std::main]`](https://docs.rs/async-std/latest/async_std/attr.main.html) or [`#[tokio::main]`](https://docs.rs/tokio/1.1.0/tokio/attr.main.html)
329329
since it's not a good idea to make long blocking calls during an async function.
@@ -534,8 +534,8 @@ fn main() -> PyResult<()> {
534534

535535
### Additional Information
536536

537-
- Managing event loop references can be tricky with pyo3-asyncio. See [Event Loop References and ContextVars](https://awestlake87.github.io/pyo3-asyncio/master/doc/pyo3_asyncio/#event-loop-references-and-contextvars) in the API docs to get a better intuition for how event loop references are managed in this library.
538-
- 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)
537+
- Managing event loop references can be tricky with pyo3-asyncio. See [Event Loop References and ContextVars](https://awestlake87.github.io/pyo3-asyncio/master/doc/pyo3_async_runtimes/#event-loop-references-and-contextvars) in the API docs to get a better intuition for how event loop references are managed in this library.
538+
- 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_async_runtimes/testing)
539539

540540
## Migration Guide
541541

@@ -547,7 +547,7 @@ Well, a lot actually. There were some pretty major flaws in the initialization b
547547

548548
To make things a bit easier, I decided to keep most of the old API alongside the new one (with some deprecation warnings to encourage users to move away from it). It should be possible to use the `v0.13` API alongside the newer `v0.14` API, which should allow you to upgrade your application piecemeal rather than all at once.
549549

550-
**Before you get started, I personally recommend taking a look at [Event Loop References and ContextVars](https://awestlake87.github.io/pyo3-asyncio/master/doc/pyo3_asyncio/#event-loop-references-and-contextvars) in order to get a better grasp on the motivation behind these changes and the nuance involved in using the new conversions.**
550+
**Before you get started, I personally recommend taking a look at [Event Loop References and ContextVars](https://awestlake87.github.io/pyo3-asyncio/master/doc/pyo3_async_runtimes/#event-loop-references-and-contextvars) in order to get a better grasp on the motivation behind these changes and the nuance involved in using the new conversions.**
551551

552552
### 0.14 Highlights
553553

@@ -635,7 +635,7 @@ To make things a bit easier, I decided to keep most of the old API alongside the
635635
```
636636

637637
4. Replace conversions with their newer counterparts.
638-
> You may encounter some issues regarding the usage of `get_running_loop` vs `get_event_loop`. For more details on these newer conversions and how they should be used see [Event Loop References and ContextVars](https://awestlake87.github.io/pyo3-asyncio/master/doc/pyo3_asyncio/#event-loop-references-and-contextvars).
638+
> You may encounter some issues regarding the usage of `get_running_loop` vs `get_event_loop`. For more details on these newer conversions and how they should be used see [Event Loop References and ContextVars](https://awestlake87.github.io/pyo3-asyncio/master/doc/pyo3_async_runtimes/#event-loop-references-and-contextvars).
639639
- Replace `pyo3_async_runtimes::into_future` with `pyo3_async_runtimes::<runtime>::into_future`
640640
- Replace `pyo3_async_runtimes::<runtime>::into_coroutine` with `pyo3_async_runtimes::<runtime>::future_into_py`
641641
- Replace `pyo3_async_runtimes::get_event_loop` with `pyo3_async_runtimes::<runtime>::get_current_loop`

src/async_std.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
//! are only available when the `unstable-streams` Cargo feature is enabled:
99
//!
1010
//! ```toml
11-
//! [dependencies.pyo3-asyncio-0-21]
12-
//! version = "0.21"
11+
//! [dependencies.pyo3-async-runtimes]
12+
//! version = "0.22"
1313
//! features = ["unstable-streams"]
1414
//! ```
1515

src/err.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
mod exceptions {
44
use pyo3::{create_exception, exceptions::PyException};
55

6-
create_exception!(pyo3_asyncio, RustPanic, PyException);
6+
create_exception!(pyo3_async_runtimes, RustPanic, PyException);
77
}
88

99
pub use exceptions::RustPanic;

src/generic.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
//! > are only available when the `unstable-streams` Cargo feature is enabled:
99
//!
1010
//! ```toml
11-
//! [dependencies.pyo3-asyncio-0-21]
12-
//! version = "0.21"
11+
//! [dependencies.pyo3-async-runtimes]
12+
//! version = "0.22"
1313
//! features = ["unstable-streams"]
1414
//! ```
1515
@@ -1651,8 +1651,8 @@ where
16511651
Ok(PyModule::from_code_bound(
16521652
py,
16531653
STREAM_GLUE,
1654-
"pyo3_asyncio/pyo3_asyncio_glue.py",
1655-
"pyo3_asyncio_glue",
1654+
"pyo3_async_runtimes/pyo3_async_runtimes_glue.py",
1655+
"pyo3_async_runtimes_glue",
16561656
)?
16571657
.into())
16581658
})?

src/lib.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,8 @@
299299
//! > are only available when the `attributes` Cargo feature is enabled:
300300
//!
301301
//! ```toml
302-
//! [dependencies.pyo3-asyncio-0-21]
303-
//! version = "0.21"
302+
//! [dependencies.pyo3-async-runtimes]
303+
//! version = "0.22"
304304
//! features = ["attributes"]
305305
//! ```
306306
//!
@@ -312,8 +312,8 @@
312312
//! > are only available when the `async-std-runtime` Cargo feature is enabled:
313313
//!
314314
//! ```toml
315-
//! [dependencies.pyo3-asyncio-0-21]
316-
//! version = "0.21"
315+
//! [dependencies.pyo3-async-runtimes]
316+
//! version = "0.22"
317317
//! features = ["async-std-runtime"]
318318
//! ```
319319
//!
@@ -325,8 +325,8 @@
325325
//! > are only available when the `tokio-runtime` Cargo feature is enabled:
326326
//!
327327
//! ```toml
328-
//! [dependencies.pyo3-asyncio-0-21]
329-
//! version = "0.21"
328+
//! [dependencies.pyo3-async-runtimes]
329+
//! version = "0.22"
330330
//! features = ["tokio-runtime"]
331331
//! ```
332332
//!
@@ -338,8 +338,8 @@
338338
//! > are only available when the `testing` Cargo feature is enabled:
339339
//!
340340
//! ```toml
341-
//! [dependencies.pyo3-asyncio-0-21]
342-
//! version = "0.21"
341+
//! [dependencies.pyo3-async-runtimes]
342+
//! version = "0.22"
343343
//! features = ["testing"]
344344
//! ```
345345
@@ -363,7 +363,7 @@ pub mod err;
363363
pub mod generic;
364364

365365
#[pymodule]
366-
fn pyo3_asyncio(py: Python, m: &Bound<PyModule>) -> PyResult<()> {
366+
fn pyo3_async_runtimes(py: Python, m: &Bound<PyModule>) -> PyResult<()> {
367367
m.add("RustPanic", py.get_type_bound::<err::RustPanic>())?;
368368
Ok(())
369369
}

src/testing.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//! harness since it doesn't allow Python to gain control over the main thread. Instead, we have to
88
//! provide our own test harness in order to create integration tests.
99
//!
10-
//! Running `pyo3-asyncio` code in doc tests _is_ supported however since each doc test has its own
10+
//! Running `pyo3-async-runtimes` code in doc tests _is_ supported however since each doc test has its own
1111
//! `main` function. When writing doc tests, you may use the
1212
//! [`#[pyo3_async_runtimes::async_std::main]`](crate::async_std::main) or
1313
//! [`#[pyo3_async_runtimes::tokio::main]`](crate::tokio::main) macros on the test's main function to run
@@ -26,7 +26,7 @@
2626
//! > The name `pytests` is just a convention. You can name this folder anything you want in your own
2727
//! > projects.
2828
//!
29-
//! We'll also want to provide the test's main function. Most of the functionality that the test harness needs is packed in the [`pyo3_async_runtimes::testing::main`](https://docs.rs/pyo3-asyncio/latest/pyo3_asyncio/testing/fn.main.html) function. This function will parse the test's CLI arguments, collect and pass the functions marked with [`#[pyo3_async_runtimes::async_std::test]`](https://docs.rs/pyo3-asyncio/latest/pyo3_asyncio/async_std/attr.test.html) or [`#[pyo3_async_runtimes::tokio::test]`](https://docs.rs/pyo3-asyncio/latest/pyo3_asyncio/tokio/attr.test.html) and pass them into the test harness for running and filtering.
29+
//! We'll also want to provide the test's main function. Most of the functionality that the test harness needs is packed in the [`pyo3_async_runtimes::testing::main`](https://docs.rs/pyo3-async-runtimes/latest/pyo3_async_runtimes/testing/fn.main.html) function. This function will parse the test's CLI arguments, collect and pass the functions marked with [`#[pyo3_async_runtimes::async_std::test]`](https://docs.rs/pyo3-async-runtimes/latest/pyo3_async_runtimes/async_std/attr.test.html) or [`#[pyo3_async_runtimes::tokio::test]`](https://docs.rs/pyo3-async-runtimes/latest/pyo3_async_runtimes/tokio/attr.test.html) and pass them into the test harness for running and filtering.
3030
//!
3131
//! `pytests/test_example.rs` for the `tokio` runtime:
3232
//! ```rust
@@ -61,10 +61,10 @@
6161
//! harness = false
6262
//! ```
6363
//!
64-
//! Also add the `testing` and `attributes` features to the `pyo3-asyncio` dependency and select your preferred runtime:
64+
//! Also add the `testing` and `attributes` features to the `pyo3-async-runtimes` dependency and select your preferred runtime:
6565
//!
6666
//! ```toml
67-
//! pyo3-asyncio-0-21 = { version = "0.21", features = ["testing", "attributes", "async-std-runtime"] }
67+
//! pyo3-async-runtimes = { version = "0.22", features = ["testing", "attributes", "async-std-runtime"] }
6868
//! ```
6969
//!
7070
//! At this point, you should be able to run the test via `cargo test`
@@ -73,7 +73,7 @@
7373
//!
7474
//! We can add tests anywhere in the test crate with the runtime's corresponding `#[test]` attribute:
7575
//!
76-
//! For `async-std` use the [`pyo3_async_runtimes::async_std::test`](https://docs.rs/pyo3-asyncio/latest/pyo3_asyncio/async_std/attr.test.html) attribute:
76+
//! For `async-std` use the [`pyo3_async_runtimes::async_std::test`](https://docs.rs/pyo3-async-runtimes/latest/pyo3_async_runtimes/async_std/attr.test.html) attribute:
7777
//! ```rust
7878
//! # #[cfg(all(feature = "async-std-runtime", feature = "attributes"))]
7979
//! mod tests {
@@ -105,7 +105,7 @@
105105
//! # fn main() {}
106106
//! ```
107107
//!
108-
//! For `tokio` use the [`pyo3_async_runtimes::tokio::test`](https://docs.rs/pyo3-asyncio/latest/pyo3_asyncio/tokio/attr.test.html) attribute:
108+
//! For `tokio` use the [`pyo3_async_runtimes::tokio::test`](https://docs.rs/pyo3-async-runtimes/latest/pyo3_async_runtimes/tokio/attr.test.html) attribute:
109109
//! ```rust
110110
//! # #[cfg(all(feature = "tokio-runtime", feature = "attributes"))]
111111
//! mod tests {
@@ -202,7 +202,7 @@ pub struct Args {
202202
/// Ideally, we should mirror the default test harness's arguments exactly, but
203203
/// for the sake of simplicity, only filtering is supported for now. If you want
204204
/// more features, feel free to request them
205-
/// [here](https://github.com/awestlake87/pyo3-asyncio/issues).
205+
/// [here](https://github.com/PyO3/pyo3-async-runtimes/issues).
206206
///
207207
/// # Examples
208208
///
@@ -241,7 +241,7 @@ pub fn parse_args() -> Args {
241241

242242
type TestFn = dyn Fn() -> Pin<Box<dyn Future<Output = PyResult<()>> + Send>> + Send + Sync;
243243

244-
/// The structure used by the `#[test]` macros to provide a test to the `pyo3-asyncio` test harness.
244+
/// The structure used by the `#[test]` macros to provide a test to the `pyo3-async-runtimes` test harness.
245245
#[derive(Clone)]
246246
pub struct Test {
247247
/// The fully qualified name of the test
@@ -286,7 +286,7 @@ pub async fn test_harness(tests: Vec<Test>, args: Args) -> PyResult<()> {
286286
Ok(())
287287
}
288288

289-
/// Parses test arguments and passes the tests to the `pyo3-asyncio` test harness
289+
/// Parses test arguments and passes the tests to the `pyo3-async-runtimes` test harness
290290
///
291291
/// This function collects the test structures from the `inventory` boilerplate and forwards them to
292292
/// the test harness.

0 commit comments

Comments
 (0)