Skip to content

Commit bc8403a

Browse files
author
Andrew J Westlake
committed
Added Cargo.toml sections to the quickstart for applications
1 parent 634944c commit bc8403a

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,20 @@ This library can give spurious failures during finalization prior to PyO3 releas
2626
### Rust Applications
2727
Here we initialize the runtime, import Python's `asyncio` library and run the given future to completion using Python's default `EventLoop` and `async-std`. Inside the future, we convert `asyncio` sleep into a Rust future and await it.
2828

29-
More details on the usage of this library can be found in the [API docs](https://awestlake87.github.io/pyo3-asyncio/master/doc).
29+
30+
```toml
31+
# Cargo.toml
32+
...
33+
34+
[dependencies]
35+
pyo3 = { version = "0.13" }
36+
pyo3-asyncio = { version = "0.13", features = ["attributes", "async-std-runtime"] }
37+
async-std = "1.9"
38+
```
3039

3140
```rust
41+
//! main.rs
42+
3243
use pyo3::prelude::*;
3344

3445
#[pyo3_asyncio::async_std::main]
@@ -49,7 +60,19 @@ async fn main() -> PyResult<()> {
4960
The same application can be written to use `tokio` instead using the `#[pyo3_asyncio::tokio::main]`
5061
attribute.
5162

63+
```toml
64+
# Cargo.toml
65+
...
66+
67+
[dependencies]
68+
pyo3 = { version = "0.13" }
69+
pyo3-asyncio = { version = "0.13", features = ["attributes", "tokio-runtime"] }
70+
tokio = "1.4"
71+
```
72+
5273
```rust
74+
//! main.rs
75+
5376
use pyo3::prelude::*;
5477

5578
#[pyo3_asyncio::tokio::main]
@@ -67,6 +90,8 @@ async fn main() -> PyResult<()> {
6790
}
6891
```
6992

93+
More details on the usage of this library can be found in the [API docs](https://awestlake87.github.io/pyo3-asyncio/master/doc).
94+
7095
### PyO3 Native Rust Modules
7196

7297
PyO3 Asyncio can also be used to write native modules with async functions.

0 commit comments

Comments
 (0)