ipython style tab complete with ipdb for imported modules

218 views Asked by At

I'm trying to get ipython style table complete with pdb by using ipdb.

On a clean ubuntu 14.04 install (new aws instance) I run.

sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install python-setuptools
sudo easy_install pip

sudo pip install ipython
sudo pip install ipdb
sudo pip install boto

Then boot up ipython, and try.

ubuntu@ip-10-0-0-244:~$ ipython
Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
Type "copyright", "credits" or "license" for more information.

IPython 2.3.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import ipdb

In [2]: import boto

In [3]: ipdb.set_trace()
--Call--
> /usr/local/lib/python2.7/dist-packages/IPython/core/displayhook.py(234)__call__()
    233 
--> 234     def __call__(self, result=None):
    235         """Printing with history cache management.

ipdb> str.
str.capitalize  str.encode      str.format      str.isdigit     str.isupper     str.lstrip      str.rfind       str.rsplit      str.startswith  str.translate   
str.center      str.endswith    str.index       str.islower     str.join        str.mro         str.rindex      str.rstrip      str.strip       str.upper       
str.count       str.expandtabs  str.isalnum     str.isspace     str.ljust       str.partition   str.rjust       str.split       str.swapcase    str.zfill       
str.decode      str.find        str.isalpha     str.istitle     str.lower       str.replace     str.rpartition  str.splitlines  str.title       
ipdb> boto.

boto.[tab] just sits there. If I'm reading the docs right this should work, but maybe I have miss-understood something.

If I define a simple script test.py

import boto

print(boto.__version__)

Then call:

ubuntu@ip-10-0-0-244:~$ python -m ipdb test.py 
> /home/ubuntu/test.py(1)<module>()
----> 1 import boto
      2 
      3 print(boto.__version__)

ipdb> n
> /home/ubuntu/test.py(3)<module>()
      1 import boto
      2 
----> 3 print(boto.__version__)

ipdb> boto.
boto.BUCKET_NAME_RE             boto.connect_autoscale          boto.connect_emr                boto.connect_s3                 boto.os
boto.BotoConfigLocations        boto.connect_beanstalk          boto.connect_euca               boto.connect_sdb                boto.perflog
boto.BucketStorageUri           boto.connect_cloudformation     boto.connect_fps                boto.connect_ses                boto.platform
boto.Config                     boto.connect_cloudfront         boto.connect_glacier            boto.connect_sns                boto.plugin
boto.ENDPOINTS_PATH             boto.connect_cloudsearch        boto.connect_gs                 boto.connect_sqs                boto.pyami
boto.FileStorageUri             boto.connect_cloudsearch2       boto.connect_ia                 boto.connect_sts                boto.re
boto.GENERATION_RE              boto.connect_cloudtrail         boto.connect_iam                boto.connect_support            boto.regioninfo
boto.InvalidUriError            boto.connect_cloudwatch         boto.connect_kinesis            boto.connect_swf                boto.resultset
boto.NullHandler                boto.connect_cognito_identity   boto.connect_logs               boto.connect_vpc                boto.s3
boto.TOO_LONG_DNS_NAME_COMP     boto.connect_cognito_sync       boto.connect_mturk              boto.connect_walrus             boto.set_file_logger
boto.UserAgent                  boto.connect_directconnect      boto.connect_opsworks           boto.datetime                   boto.set_stream_logger
boto.VERSION_RE                 boto.connect_dynamodb           boto.connect_rds                boto.exception                  boto.storage_uri
boto.Version                    boto.connect_ec2                boto.connect_rds2               boto.handler                    boto.storage_uri_for_key
boto.boto                       boto.connect_ec2_endpoint       boto.connect_redshift           boto.init_logging               boto.sys
boto.compat                     boto.connect_elastictranscoder  boto.connect_route53            boto.log                        boto.urlparse
boto.config                     boto.connect_elb                boto.connect_route53domains     boto.logging                    boto.vendored

I get the behavior I'd like.

Does anyone know how to make the tab complete functionality work for the set_trace() work case?

-Thanks

0

There are 0 answers