def load_ipython_extension(ipython):

    # first, load the sql magic if it isn't already loaded
    if not ipython.find_line_magic('sql'):
        ipython.run_line_magic('load_ext', 'sql')

    # register our own magic
    ipython.register_magic_function(pgcli_line_magic, 'line', 'pgcli')
This is called via the ipython command '%load_ext pgcli.magic'
dataset/ETHPy150Open dbcli/pgcli/pgcli/magic.py/load_ipython_extension