Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibility of hot-reloading? #39

Open
alipunjani opened this issue Mar 25, 2020 · 1 comment
Open

Possibility of hot-reloading? #39

alipunjani opened this issue Mar 25, 2020 · 1 comment

Comments

@alipunjani
Copy link

It there some way to make it possible to hot-reload changes to a .cpp file in a running python process (e.g. jupyter notebook)?

In particular, for development of high performance numerical computing code, it would be very useful to be able to have a jupyter notebook where data and other memory structures are loaded and set up, and then be able to use cppimport to import a .cpp file that is being developed for some heavy compute implementation. Right now, calling importlib.reload on a cppimport compiled/imported module does seem to trigger a re-compile (if the .cpp file has changed), but the new module is not actually loaded into the python process.

This is probably a python limitation, but there are (hacky) workarounds like this:
https://stackoverflow.com/questions/8295555/how-to-reload-a-python3-c-extension-module/8295590#8295590
I wonder if there would be a way to enable an optional "development" mode for cppimport where modules are loaded with these tricks that allow reloading of binary extensions?

It would even be great to get some pointers about how to go about implementing this so I can make a PR.

@tbenthompson
Copy link
Owner

tbenthompson commented Mar 25, 2020

Great idea! I've also run into situations where hot-reloading would be nice. I have some thoughts on how it might be feasible. When I get around to it, I'll think about this more and write my thoughts here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants