IPython magic command to reload modules on demand
Project description
ipython-reload
IPython magic command to reload modules on demand
Install
pip install ipython-reload
Use
In [1]: %load_ext ipython_reload
In [2]: from foo import some_function
In [3]: some_function()
Out[3]: 42
In [4]: # open foo.py in an editor and change some_function to return 43
In [5]: %reload some_function
In [6]: some_function()
Out[6]: 43
The %reload
magic can reload modules not directly imported, imported modules
in the local namespace, and imported variables.
Reloading imported variables may produce unexpected results if the name is
generic, such as in the case of __version__
. Python does not track the source
of where a variable was defined, so this code loops all imported modules, and
looks for a matching name, that is the same type as the variable you want to
reload. If you have imported a variable using from foo import bar as baz
this functionality will not work.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ipython-reload-0.0.1.tar.gz
.
File metadata
- Download URL: ipython-reload-0.0.1.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1d4f713f74a576ef17f06a3751c4887d18c93c80adc43f5a1611773b9d9e1e6 |
|
MD5 | 92198786995653cec0c8d68be8db5cfd |
|
BLAKE2b-256 | e4fc8c1ece3c94477b8ae574d5f265a15e3fee116e9ee9641c0e2e7060f1d09e |
File details
Details for the file ipython_reload-0.0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: ipython_reload-0.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c848e841984736b53b318f372e20f0b0376183323a9fe306adad9fff5c14ec9e |
|
MD5 | f918b701620ef83dabdadde1372b3986 |
|
BLAKE2b-256 | ce2ca15d58ed8c76957c61ba03761ea5737b954bc1bd8ba992f80b13db96706f |