Skip to content

Instantly share code, notes, and snippets.

@j-faria
Last active October 7, 2020 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save j-faria/67c0cc038d5993dccaaf4b7c244651ce to your computer and use it in GitHub Desktop.
Save j-faria/67c0cc038d5993dccaaf4b7c244651ce to your computer and use it in GitHub Desktop.
Auto-reload modules in IPython
  1. Create a file ~/.pythonrc.py
  2. Add
try:
    from IPython import get_ipython
    get_ipython().run_line_magic('load_ext', 'autoreload')
    get_ipython().run_line_magic('autoreload', '2')
except AttributeError:
    pass
  1. Export the environment variable (add this to ~/.bashrc or ~/.zshrc) export PYTHONSTARTUP="/home/jfaria/.pythonrc.py"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment