-
-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
With a Mixed Python/Rust project, only Rust functions appear in Python Wheel. #1649
Comments
Have you tried maturin 1.0 yet? No bugfixes will be backported to the old 0.13 versions. |
I didn't know maturin 1.0 existed! I've now updated, and I can now see my phython functions and classes. However, now I can't see my Rust functions. This is what print(dir(actag)) returns now:
Am I correct in assuming that both the python and rust functions should be available? |
No, Rust functions/classes are contained in |
Please refer to https://www.maturin.rs/project_layout.html#mixed-rustpython-project for more information. |
Okay, thank you! I got it working by adding this to the init.py file:
|
Bug Description
This may seem like a duplicate of #885, but that uses a different version of Maturin, and the solution for that thread is not the solution for my issue. I am trying to build into a conda virtual environment in WSL, and my pip wheel that is created by running
maturin develop
does not have any of my python functions or classes in it, just the functions defined by the Rust module. I have a mixed Python/Rust project with the following structure:My pyproject.toml contains:
My Cargo.toml contains:
My init.py file contains:
My actag_src.py file contains an AcTag class. It also imports the
actag
module generated by the Rust side of the code.With this setup, I can successfully build the pip wheel and install it with
maturin develop
, but I get the following error when I try to use the AcTag class from the python code:However, I can see all of the Rust functions when I run
print(dir(actag))
:Your maturin version (
maturin --version
)0.13.0
Your Python version (
python -V
)3.9.16
Your pip version (
pip -V
)23.0.1
What bindings you're using
pyo3
Does
cargo build
work?If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash
/
)?Steps to Reproduce
conda create -n tester python=3.9
conda activate tester
pip install maturin
maturin develop --release
from the main directory of the repository.python test.py
The text was updated successfully, but these errors were encountered: