[IPython-User] Hide/disable magic commands

matt.clarke@stfc.... matt.clarke@stfc....
Fri Sep 9 08:19:44 CDT 2011

Thanks Thomas.

I have found a simple way of eliminating magic commands from tab complete but still allow the commands to be used by editing completer.py.

        # All active matcher routines for completion
        self.matchers = [self.python_matches,
                         self.magic_matches, <- delete this


From: Thomas Kluyver [mailto:takowl@gmail.com]
Sent: 05 September 2011 21:11
To: Clarke, Matt (STFC,RAL,ISIS)
Cc: ipython-user@scipy.net
Subject: Re: [IPython-User] Hide/disable magic commands

On 2 September 2011 08:27, <matt.clarke@stfc.ac.uk<mailto:matt.clarke@stfc.ac.uk>> wrote:
Is there a way to disable magic commands or at least hide them (i.e. they don't show up on tab complete)?

I am planning to use IPython as a command line for controlling experiments and do not want to give the users access to the power of magic commands as it would only result in trouble!

I don't know of anything official, but I think it should be possible to disable them altogether:

ip = get_ipython()
del ip.magic_whatever

Note that this may not be future-proof, because at some point magic functions will likely be moved to a separate object.

On a broader note, do think carefully about what you're removing - some users might find certain magic commands quite useful, e.g.%run. Keeping them hidden from tab completion seems like a better solution, but I don't know if there's an easy way to do that.


Scanned by iCritical.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20110909/c7e26d09/attachment-0001.html 

More information about the IPython-User mailing list