Closed altendky closed 2 months ago
See https://www.maturin.rs/project_layout#import-rust-as-a-submodule-of-your-project
I don't think we should support the use case like sqlite3
v.s. _sqlite3
, it may make sense for standard library to do that, but for third party packages, putting the dylib inside the main package as submodule makes more sense.
Welp, it seems that this turned out to be a support request and not a feature request. I was not targeting exactly the _sqlite3
situation, it was just a simple example to reach for of having the extension module use a leading _
. Your suggestion of the extension module being a member of the package was my actual target. Sorry.
Thank you for the doc link. I had looked in the configuration doc page and a few other places and tried using all the name fields I saw without success. But... I did not try an import path as shown in your submodule doc link. It does appear that it has worked as I hoped in my case.
Thank you for the quick support.
Often, extension modules are given a leading
_
to mark them as private and encourage use of the public wrapper pure python file/package/module. For example, you are expected to use thesqlite3
package which in turn imports the private_sqlite3
extension package.I looked around and tried changing several names in various configs but did not find any separate control of the import package name vs. the extension module name.
Without having dug into the source, it seems like this might be as simple as a config entry to override the extension module name and code to apply that name to the extension module file writing when it is specified.
Let me know how you feel about this feature. If it sounds good, I could dig into the source and attempt a PR.