| 1 | # `pyo3-ffi` Examples |
| 2 | |
| 3 | These example crates are a collection of toy extension modules built with |
| 4 | `pyo3-ffi`. They are all tested using `nox` in PyO3's CI. |
| 5 | |
| 6 | Below is a brief description of each of these: |
| 7 | |
| 8 | | Example | Description | |
| 9 | | `word-count` | Illustrates how to use pyo3-ffi to write a static rust extension | |
| 10 | | `sequential` | Illustrates how to use pyo3-ffi to write subinterpreter-safe modules using multi-phase module initialization | |
| 11 | |
| 12 | ## Creating new projects from these examples |
| 13 | |
| 14 | To copy an example, use [`cargo-generate`](https://crates.io/crates/cargo-generate). Follow the commands below, replacing `<example>` with the example to start from: |
| 15 | |
| 16 | ```bash |
| 17 | $ cargo install cargo-generate |
| 18 | $ cargo generate --git https://github.com/PyO3/pyo3 examples/<example> |
| 19 | ``` |
| 20 | |
| 21 | (`cargo generate` will take a little while to clone the PyO3 repo first; be patient when waiting for the command to run.) |