Reload a specific module
matt-bernstein opened this issue · comments
Hi! I'm interested in a use case where I only want to reload a particular library that I am developing, but I could change any function or file within that library. Would one of the following snippets achieve this, inside of IPython for example?
import jurigged
jurigged.watch(mymodule.__file__)
import pathlib
import jurigged
mydir = str(pathlib.Path(mymodule.__file__).parent)
jurigged.watch(mydir)
And if so would it make sense to add jurigged.watch(mymodule)
as syntactic sugar?
That should work, yes. I haven't paid much heed to the jurigged.watch
interface since I rarely use it, but I like your suggestion, it is good sugar. I would only use the .parent
if the module's filename is __init__.py
, though.