reloading a cython module

99 views
Skip to first unread message

Kireet Reddy

unread,
Mar 14, 2019, 2:36:10 AM3/14/19
to cython-users
Is there a way to reload a cython module in a running python process? I have some code that takes awhile to load up some data on startup, so it would be much easier if i could just reload the code instead of having to reload the data again to test changes. I've tried pyximport and importlib.reload with no luck. I have a full description of the problem here:


Thanks
Kireet

Chris Barker

unread,
Mar 14, 2019, 12:32:33 PM3/14/19
to cython-users
It's not a Cython issue per-se -- you can't reload compiled extensions at all.

Can you find a way to cache the data / store it in a more compact efficient way to make loading it faster?

Final kludge -- I think pyximport does a hack where it doesn't actually reload a module, but rather, loads a new one, and "hides" the old one. This means that if you did this for along time, it would keep piling up a bunch of old modules, but a few exrtras lying around won't hurt.

So you could do a similar kludge, or maybe use pyximport:


-CHB


--

---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris....@noaa.gov
Reply all
Reply to author
Forward
0 new messages