For the project which mixing Rust code and Python code, how the namespace looks like? #1426
-
According to https://github.com/PyO3/maturin#readme , The directory layout of a PyO3 project is like this:
or this
No matter which one, after packaging and import the root module of this package. How its name space looks like (what members does it contain?) Is it the Union of both python code and rust code? Is there any way to manage the namespace? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Transferred to When using mixed Python / Rust in this way the
(Actually because it is compiled code, the file will be |
Beta Was this translation helpful? Give feedback.
Transferred to
maturin
as this is specific to project layout when using maturin.When using mixed Python / Rust in this way the
my_project/__init__.py
will control exactly the namespace you want.maturin
will package your Rust module beside this one, e.g. if your Rust library ismy_project
then you can import from it in the__init__.py
as if you hadmy_project/my_project.py
.(Actually because it is compiled code, the file will be
my_project.so
or similar depending on OS but it functions the same.)