#proc-macro #pyo3 #impl-block #wrapping #helper #procedural #generate

yanked py03_helper_macros

A procedural macro to help wrapping rust structs for pyo3

0.0.2 Dec 31, 2023
0.0.1 Dec 31, 2023
0.0.0 Dec 31, 2023

#29 in #impl-block

MIT license

24KB
357 lines

Helper Macro For PyO3

This is a crate to provide helper macros for the PyO3 crate. Currently, it only supports wrapping impl blocks with the necessary boilerplate to make them work with PyO3 without having to rewrite functions.

To make this crate not use hacky workarounds to make it work you must use the feature multiple-pymethod for the PyO3 crate and same for this crate. This will enable you to use more than one impl block for a type and activate the wrap_impl macro in this crate. If this is not used you will need to use the pyo3_bindings macro to generate and store the wrapped functions in a file until the impl_pyo3 macro is called that will then generate one single impl block with all the functions in it.

Note that the names of the macros will change in future releases

Future Plans

  • Add support for args where user can specify the supported custom types

See the docs for information on how to use the macros.

Dependencies

~3.5–10MB
~87K SLoC