Skip to content

cppimport should put output files in a hidden directory #31

Open

Description

@sirwhinesalot

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?

Activity

  1. tbenthompson commented on Mar 7, 2019

    @tbenthompson
    Owner

    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?

  2. sirwhinesalot commented on Mar 7, 2019

    @sirwhinesalot
    Author

    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.

  3. tbenthompson commented on Mar 7, 2019

    @tbenthompson
    Owner

    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.

  4. tbenthompson commented on Mar 7, 2019

    @tbenthompson
    Owner

    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!

  5. sirwhinesalot commented on Mar 7, 2019

    @sirwhinesalot
    Author

    No problem 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions