cppimport
cppimport copied to clipboard
cppimport should put output files in a hidden directory
Perhaps I missed a configuration option to handle this, but currently cppimport puts all the generated files in the same place as the source.
I would much prefer if the files were stored in a .cppimport folder or something of the sort. Would it be possible to add a configuration setting to handle this?
This might be partially achievable, but I'm not particularly motivated to implement this. The benefit of putting the generated files in the same place as the source is that we don't need to do anything fancy for Python to find the compiled modules. What do you see as the problem with storing the generated files in the source folder?
It's not a major thing, but in an IDE for example it adds 3 extra files per extension. With only 1 cpp file it's not a big deal, but if there are multiple extensions that means the file tree is now 4x as large. Makes it difficult to navigate.
At the moment I just put each cpp file in its own folder, and then use imp_from_filepath. It works but is suboptimal since having the cpp files in the middle of the python files is not the issue, the generated files are.
This is very much a low priority thing.
Yeah. I can understand that. For the module importing to work well, the compiled module (.so, .dylib, .dll depending on platform) needs to be in the same place as the .cpp file. I don't think there's a way around that. But, the other two files could go somewhere else. That wouldn't be too hard to implement if you'd be interested in doing it!
For the IDE, most IDEs have an option to hide files with certain extensions. That might help you.
Now that I think about it, putting the compiled module in a sub folder would also be possible but would require a medium sized amount of re-architecting. I'll just leave this issue open in case me or someone else wants to work on this some time in the future.
Thanks for the idea!
No problem 👍