Git Product home page Git Product logo

ipython-suggestions's Introduction

IPython Extension: ipython-suggestions

(i) Number one feature: system wide symbol searching! When ipython is loaded, suggestions module will scan your python paths for symbols and will create a cache. On the author's old 2008 computer (this readme is from 2017), 50000 symbols load in 10 seconds. But then you get a very easy way to import any symbol, without typing or remembering the entrine import path. First example:

In [1]: %findsymbol DecisionTreeClasifir # two typos here on purpose Out[1]: 0 (C) from sklearn.tree import DecisionTreeClassifier

In [2]: %suggestion 0 from sklearn.tree import DecisionTreeClassifier # it's now imported!

%findsymbol searches string up to two character edits (deletion, substitution, transpose and insertion).

Second example:

In [1]: %findsymbol pypl  # now hit tab!
[this completes to:]
In [1]: %findsymbol pyplot...matplotlib  # press enter now.
from matplotlib import pyplot
[pyplot is now imported]

Even better example:

In [1]: %findsymbol pypl  # now hit tab!
[this completes to:]
In [1]: %findsymbol pyplot...matplotlib
[now add -as parameter]
In [1]: %findsymbol pyplot...matplotlib -as plt
from matplotlib import pyplot as plt
[pyplot is now imported as plt]

The completions offered by pressing tab in a %findsymbol line are all the symbols that begin with what you wrote. Note that this is case-sensitive.

This also works in jupyter :)

(ii) Get suggestions on misspelled names:

In [1]: my_awesome_variable = 10

In [2]: 10 * my_awsome_variable ** 3

NameError Traceback (most recent call last) in () ----> 1 10 * my_awsome_variable ** 3

NameError: name 'my_awsome_variable' is not defined Did you mean: 0 my_awesome_variable

In [3]: %suggestion 0 [ipython automatically fills the next line] In [4]: 10 * my_awesome_variable ** 3

Auto-filling of corrected code currently only works inside the shell and not in jupyter.

Installation

Run:

pip install git+https://github.com/drorspei/ipython-suggestions # from Github

then append the output of ipython -m ipython_suggestions to the output of ipython profile locate (typically ~/.ipython/profile_default/ipython_config.py).

ipython-suggestions's People

Contributors

drorspei avatar shugybugy-assaf avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.