Skip to content

Commit

Permalink
Update guide/src/class/optional_bindings.md
Browse files Browse the repository at this point in the history
Co-authored-by: Georg Brandl <georg@python.org>
  • Loading branch information
konstin and birkenfeld committed Jan 30, 2023
1 parent d4c1d50 commit 6583da7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion guide/src/class/optional_bindings.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Optional bindings

You might want to write a library the is usable both in pure rust and as a python library. For that, pyo3 support wrapping attributes in `#[cfg_attr(feature = "pyo3", ...)]` (the feature unfortunately has to be hardcoded, so the feature must be named `pyo3`). This does not only apply to classes and their methods but also to e.g. `#[pyfunction]`.
You might want to write a library the is usable both in pure Rust and as a Python library. For that, PyO3 supports wrapping attributes in `#[cfg_attr(feature = "pyo3", ...)]` (the feature name unfortunately has to be hardcoded, so the feature must be named `pyo3`). This does not only apply to classes and their methods but also to e.g. `#[pyfunction]`.

Make pyo3 optional in Cargo.toml:

Expand Down

0 comments on commit 6583da7

Please sign in to comment.