xonsh / xontrib-template

Full-featured template for building extension (xontrib) for the xonsh shell.
MIT License
42 stars 12 forks source link

Idea: `%autoreload` like functionality for rapid prototyping #44

Open naefl opened 3 years ago

naefl commented 3 years ago

Thanks for the fantastic work.

It's very likely that I'm just not good enough in searching issues here/missing the correct keywords so apologies if that's the case in advance.

The one feature that keeps me from switching to xonsh from ipython is the availability of a %autoreload like functionality when using it as a REPL when developing, that recursively imports the modules and its dependencies.

Is there such a function available/in planning?

Thanks!

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

gforsyth commented 3 years ago

Hey @naefl -- thanks for raising this. We don't currently have an autoreload, although it should be possible to grab it from IPython and package it up as a xontrib.

In the interim, you can do

import importlib
importlib.reload(module_name)

for some of that kind of functionality (although not "auto")

scopatz commented 3 years ago

PRs welcome! I think this would make a nice built-in xontrib

naefl commented 3 years ago

Thanks for the pointers @scopatz / @gforsyth I'll have a look at it

gforsyth commented 3 years ago

Awesome! Let us know if you have any questions (and please feel free to open "half-finished" PRs if you need pointers)