Skip to main content

Get suggestions on misspelled names, and do system wide symbol searching.

Project description

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

From pypi:

pip install ipython-suggestions

Or directly from source:

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

then append the output of ipython -m ipython_suggestions 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 Distribution

ipython_suggestions-1.0.1.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ipython_suggestions-1.0.1-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file ipython_suggestions-1.0.1.tar.gz.

File metadata

  • Download URL: ipython_suggestions-1.0.1.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for ipython_suggestions-1.0.1.tar.gz
Algorithm Hash digest
SHA256 d72017066f810fc89ad4831754c7913ec2ce80d349b491792a81dcdf6d3e8af1
MD5 0cda651f9f5613175c690d158c9a27a7
BLAKE2b-256 3f4e85028d3d7b8246aed4c6a6265a2b918e1db308c380c410699620a73a214f

See more details on using hashes here.

File details

Details for the file ipython_suggestions-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ipython_suggestions-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9612719fd42aac7e7f6d710508584c8cc1ee2b22c9965b170c5835b1ad225ccc
MD5 60ff495dc2bc888a7158205bca853dd8
BLAKE2b-256 cc5327d6d2ca75d71ad107e8025b9c470ed4fa1929a07f6320f96eeae347018d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page