How IPython Magic Works

ipthon-sql is an extension of ipython, I first install it with the pip install ipython-sql command

the project is here: https://github.com/catherinedevlin/ipython-sql

and my problem is:

when I enter% load_ext sql and press SHIFT + ENTER, what detailed procedure does IPython execute this magic sentence? thank...

enter image description here

+4
source share
1 answer

When you run any code on a laptop, it is execute_requestsent through the laptop server to the "core", the process that executes your code.

​​ , . , , :

get_ipython().magic('load_ext sql')

, %hist -t.

.magic() load_ext . , :

get_ipython().magics_manager.magics['line']

( IPython)

IPython.core.magics.extension.ExtensionMagics.load_ext, . .

sql sql.load_ipython_extension(ip), . , - .

+6

All Articles