maturin icon indicating copy to clipboard operation
maturin copied to clipboard

Include files

Open ijl opened this issue 8 years ago • 4 comments

I'd like to include a file in the built wheel. How about packaging anything in a project's Cargo.toml include array?

ijl avatar Nov 27 '18 14:11 ijl

You can get a list of files with cargo package --list, so packaging them is definitely possible. One problem is that different types of files need to go into different subdirectories of the wheel and it's not clear which one is correct for include. The other is that a crate might be publish to crates.io and to pypi (like e.g. pyo3-pack itself) and you'd get conflict around that.

konstin avatar Nov 27 '18 19:11 konstin

But how can I add python files that are using my rust lib to the package? Is there somewhere an example for that. :vulcan_salute:

kstrempel avatar Nov 28 '18 10:11 kstrempel

There's currently no way to add python files. The main problem is that afaik python has no conventions on how combine native and python files. It is not clear where the native module (the .so/.pyd) goes relative to the python files. The big projects with c extensions such as numpy or pandas just define locations somewhere in the source tree in their custom build system and gitignore .so and .pyd, but this breaks ide support. Not solving this properly will lead also lead to the weird kind of behaviour setuptools-rust sometimes shows.

For now I recommend to make a package for the rust crate (e.g. by add _backend or _native to your package's name) and another one for the python part, which depends on the rust crate. Using the module-name-is-source-folder-name convention it should be possible to have both in a single git repository without any conflicts.

konstin avatar Dec 02 '18 09:12 konstin

The use case I had for this didn't pan out. If no one has another use, I suppose this won't be needed.

ijl avatar Jan 17 '19 17:01 ijl