Skip to main content

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.

Release files for ipython-reload 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ipython-reload 0.0.1
File Size Uploaded
ipython-reload-0.0.1.tar.gz 5.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ipython-reload 0.0.1
File Interpreter ABI Platform
ipython_reload-0.0.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 11.1 kB

Release files / ipython-reload-0.0.1.tar.gz

Download URL ipython-reload-0.0.1.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b1d4f713f74a576ef17f06a3751c4887d18c93c80adc43f5a1611773b9d9e1e6
BLAKE2b-256 checksum
How to use checksums
e4fc8c1ece3c94477b8ae574d5f265a15e3fee116e9ee9641c0e2e7060f1d09e
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / ipython_reload-0.0.1-py2.py3-none-any.whl

Download URL ipython_reload-0.0.1-py2.py3-none-any.whl
Size 5.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
c848e841984736b53b318f372e20f0b0376183323a9fe306adad9fff5c14ec9e
BLAKE2b-256 checksum
How to use checksums
ce2ca15d58ed8c76957c61ba03761ea5737b954bc1bd8ba992f80b13db96706f
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page