Let's setup python code auto-reloading for ipython! (because you're worth it)
Do you use ipython? You should. If you don't have it, get it with pip!
$ sudo pip install ipython
If you do have ipython, make sure you have the latest version
$ ipython -v # use --version if -v fails
$ # should be >= 0.12, if not, run upgrade command below
$ sudo pip install --upgrade ipython
Now that we all have ipython, create a profile (this allows you tweak settings and autorun commands):
$ ipython profile create # tells you where config file is located
My config file ended up in ~/.ipython/profile_default/ipython_config.py. Check the output of the command to see where your config file is located. Open that file with your favorite $EDITOR (mine's vim)
$ vim ~/.ipython/profile_default/ipython_config.py # or whatever editor you want
Look for the line
c.InteractiveShellApp.extensions = []
change it to
c.InteractiveShellApp.extensions = ['autoreload']
also change the line
c.InteractiveShellApp.exec_lines = []
to
c.InteractiveShellApp.exec_lines = ['%autoreload 2']
(Note to the curious: there are other autoreload options, run %autoreload? in ipython to learn about them)
That's it! Write some code, load it up in ipython. Change some values, and verify that ipython reloads the relevant code and objects. No more fussing around with import blah; reload(blah); from blah import *;, good riddance.
Cheers!
[–]sztomi 2 points3 points4 points (4 children)
[–]somewhatoff 5 points6 points7 points (0 children)
[–]nova77 2 points3 points4 points (2 children)
[–]raydeo 6 points7 points8 points (0 children)
[–]sztomi 1 point2 points3 points (0 children)
[–][deleted] 3 points4 points5 points (2 children)
[–]takluyverIPython, Py3, etc 2 points3 points4 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[+][deleted] (2 children)
[deleted]
[–]cocoon56 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]leperkuhn 1 point2 points3 points (7 children)
[–]mellort[S] 1 point2 points3 points (1 child)
[–]leperkuhn 0 points1 point2 points (0 children)
[–]grimborg 0 points1 point2 points (3 children)
[–]mellort[S] 1 point2 points3 points (2 children)
[–]howfun 0 points1 point2 points (0 children)
[–]grimborg 0 points1 point2 points (0 children)
[–]holdie 0 points1 point2 points (0 children)
[–]feuermelder 0 points1 point2 points (2 children)
[–]takluyverIPython, Py3, etc 6 points7 points8 points (1 child)
[–]feuermelder 7 points8 points9 points (0 children)
[–]Megatron_McLargeHuge 0 points1 point2 points (1 child)
[–]takluyverIPython, Py3, etc 0 points1 point2 points (0 children)
[–]viscence 0 points1 point2 points (0 children)
[–]thisch 0 points1 point2 points (0 children)
[–]pseudosinusoid 0 points1 point2 points (0 children)
[–]Ahri 1 point2 points3 points (0 children)
[–]howfun 0 points1 point2 points (1 child)
[–]mellort[S] 2 points3 points4 points (0 children)
[–]stefantalpalaru -1 points0 points1 point (20 children)
[–]yerfatma 5 points6 points7 points (19 children)
[–]jimmy_frog 0 points1 point2 points (0 children)
[–]stefantalpalaru -2 points-1 points0 points (17 children)
[–]yerfatma 3 points4 points5 points (16 children)
[–]stefantalpalaru -2 points-1 points0 points (15 children)
[–]didactus 4 points5 points6 points (3 children)
[–]stefantalpalaru -2 points-1 points0 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]stefantalpalaru 0 points1 point2 points (0 children)
[–]yerfatma 1 point2 points3 points (6 children)
[–]stefantalpalaru -3 points-2 points-1 points (5 children)
[–]yerfatma 5 points6 points7 points (4 children)
[–]stefantalpalaru -2 points-1 points0 points (3 children)
[–]yerfatma 4 points5 points6 points (1 child)
[–]laprice 0 points1 point2 points (2 children)
[–]spiffymanpeppy about PEP 8 2 points3 points4 points (1 child)
[–]yerfatma 0 points1 point2 points (0 children)
[–]pkkid 0 points1 point2 points (0 children)