pyo3/examples
David Hewitt 870a4bb20d
deprecate GIL refs in function argument (#3847)
* deprecate GIL Refs in function arguments

* fix deprecated gil refs in function arguments

* add notes on deprecations limitations to migration guide

* Apply suggestions from code review

Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>

* review: Icxolu

* fix proto method extract failure for option

* fix gil refs in examples

---------

Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
2024-03-20 22:35:08 +00:00
..
decorator docs: update `Python classes` section of the guide (#3914) 2024-03-01 09:21:47 +00:00
getitem deprecate GIL refs in function argument (#3847) 2024-03-20 22:35:08 +00:00
maturin-starter deprecate `&PyModule` as `#[pymodule]` argument type (#3936) 2024-03-08 00:28:11 +00:00
plugin Use single-arg form of `#[pymodule]` function in docs and tests (#3899) 2024-02-28 22:36:50 +00:00
sequential Create subinterpreter example 2023-11-26 09:49:56 +00:00
setuptools-rust-starter deprecate `&PyModule` as `#[pymodule]` argument type (#3936) 2024-03-08 00:28:11 +00:00
string-sum Merge pull request #3536 from davidhewitt/maturin-build-args 2023-10-29 13:27:15 +00:00
word-count Use single-arg form of `#[pymodule]` function in docs and tests (#3899) 2024-02-28 22:36:50 +00:00
Cargo.toml bump version to 0.21.0-dev 2023-11-19 06:41:10 +00:00
README.md Create subinterpreter example 2023-11-26 09:49:56 +00:00

README.md

PyO3 Examples

These example crates are a collection of toy extension modules built with PyO3. They are all tested using nox in PyO3's CI.

Below is a brief description of each of these:

Example Description
decorator A project showcasing the example from the Emulating callable objects chapter of the guide.
maturin-starter A template project which is configured to use maturin for development.
setuptools-rust-starter A template project which is configured to use setuptools_rust for development.
word-count A quick performance comparison between word counter implementations written in each of Rust and Python.
plugin Illustrates how to use Python as a scripting language within a Rust application
sequential Illustrates how to use pyo3-ffi to write subinterpreter-safe modules

Creating new projects from these examples

To copy an example, use cargo-generate. Follow the commands below, replacing <example> with the example to start from:

$ cargo install cargo-generate
$ cargo generate --git https://github.com/PyO3/pyo3 examples/<example>

(cargo generate will take a little while to clone the PyO3 repo first; be patient when waiting for the command to run.)