Automagically import missing modules in IPython.
Project description
Automagically import missing modules in IPython: instead of
In [1]: plt.plot([1, 2], [3, 4]) --------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-1-994ba2bf13c0> in <module>() ----> 1 plt.plot([1, 2], [3, 4]) NameError: name 'plt' is not defined In [2]: from matplotlib import pyplot as plt In [3]: plt.plot([1, 2], [3, 4]) Out[3]: [<matplotlib.lines.Line2D at 0x7f73f0179198>]
do what I mean:
In [1]: plt.plot([1, 2], [3, 4]) Autoimport: from matplotlib import pyplot as plt Out[1]: [<matplotlib.lines.Line2D at 0x7f7e253552b0>]
Inspired from @OrangeFlash81’s version, with many improvements:
Does not rely on re-execution, but instead hooks the user namespace; thus, safe even in the presence of side effects, and works with magics too.
Learns your preferred aliases (from the history).
Suppresses irrelevant chained tracebacks.
Auto-imports submodules.
pip-installable.
Installation
Pick one among:
$ pip install ipython-autoimport # from PyPI
$ pip install git+https://github.com/anntzer/ipython-autoimport # from Github
then append the output of python -mipython_autoimport to the output of ipython profile locate (typically ~/.ipython/profile_default/ipython_config.py).
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for ipython_autoimport-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2bec34f753516f2b1d5db86b109fae107b85b31d64399aff9e399e64caf7f7c |
|
MD5 | 3cfd6f206f697a8f61770772b931224f |
|
BLAKE2b-256 | c09ac557ab5552524b727f0ae9a09e2d82a86e788e721bcc582c1fd5b3cc72cb |