You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that the below issue only seems to occur when:
The binding is defined in a different crate than the entrypoint
The multiple-pybindings feature is enabled
If you define a pyclass in one module, then pymethods in a different module, it fails to expose the bindings to Python without a compile time error. I did this to clean up imports, and would have expected it to not make a difference (similar to how you can impl a normal struct in a different module within the same crate). I tried re-exporting everything from the pybindings module, as well as making it public, to no avail.
Bug Description
Note that the below issue only seems to occur when:
multiple-pybindings
feature is enabledIf you define a
pyclass
in one module, thenpymethods
in a different module, it fails to expose the bindings to Python without a compile time error. I did this to clean up imports, and would have expected it to not make a difference (similar to how you can impl a normal struct in a different module within the same crate). I tried re-exporting everything from thepybindings
module, as well as making it public, to no avail.Here is the original fix PR I had to make, if it helps
Chia-Network/chia_rs#583
Steps to Reproduce
Here is an example of this issue:
https://github.com/Rigidity/pyo3-repro
Clone the repo, then run
python3 -m venv venv . ./venv/bin/activate pip install maturin maturin develop -m Cargo.toml python main.py
Then remove
multiple-pymethods
fromCargo.toml
and run:It now works. You can also remove the
submodule
module, and put thepymethods
in the same module as theExample
struct, and it will also work.Backtrace
Your operating system and version
MacOS Sonoma 14.5
Your Python version (
python --version
)Python 3.8.18
Your Rust version (
rustc --version
)rustc 1.80.0-nightly (032af18af 2024-06-02)
Your PyO3 version
0.21.2
How did you install python? Did you use a virtualenv?
I use
pyenv
Additional Info
No response
The text was updated successfully, but these errors were encountered: