#50 Provide ipython debug entry point in the cli
Merged 3 years ago by frantisekz. Opened 3 years ago by frantisekz.

file modified
+17 -1
@@ -18,6 +18,7 @@ 

  #    Josef Skladanka <jskladan@redhat.com>

  

  import os

+ import sys

  from argparse import ArgumentParser

  

  from alembic.config import Config
@@ -77,10 +78,25 @@ 

      for r in CACHE._refreshers:

          CACHE._refresh(r)

  

+ def debug():

+     print("Launching oraculum in debug mode...")

+     import oraculum

+     oraculum.main.register_cache_providers()

+     try:

+         from IPython import embed

+         from traitlets.config import get_config

+     except ImportError:

+         print("Make sure you have IPython installed for debug mode to work...")

+         sys.exit(1)

+ 

+     c = get_config()

+     c.InteractiveShellEmbed.colors = "Linux"

+     c.InteractiveShell.pdb = True

+     embed(config=c)

  

  def main():

      parser = ArgumentParser()

-     parser.add_argument("command", choices=['init_db', 'upgrade_db', 'sync'], help='Available commands')

+     parser.add_argument("command", choices=['init_db', 'upgrade_db', 'sync', 'debug'], help='Available commands')

      args = parser.parse_args()

      globals()[args.command]()

  

no initial comment

Pull-Request has been merged by frantisekz

3 years ago
Metadata