项目作者: nikitakit

项目描述 :
Interactive live coding in Python
高级语言: Python
项目地址: git://github.com/nikitakit/xdbg.git
创建时间: 2016-06-20T09:32:36Z
项目社区:https://github.com/nikitakit/xdbg

开源协议:

下载


xdbg

xdbg is an IPython extension that brings debugger features to the live coding environment. Works well with the IPython console, notebooks, and IPython-enabled text editors.

  1. In [1]: %load_ext xdbg
  2. In [2]: def greeting():
  3. ...: message = "Hello, world!"
  4. ...: return msg
  5. ...:
  6. In [3]: val = greeting()
  7. ---------------------------------------------------------------------------
  8. NameError Traceback (most recent call last)
  9. <ipython-input-3-3eb1da36ee89> in <module>()
  10. ----> 1 val = greeting()
  11. <ipython-input-2-4f6ba759b8d0> in greeting()
  12. 1 def greeting():
  13. 2 message = "Hello, world!"
  14. ----> 3 return msg
  15. NameError: name 'msg' is not defined
  16. In [4]: %break greeting ?
  17. 1 def greeting():
  18. 2 message = "Hello, world!"
  19. 3 return msg
  20. In [5]: %break greeting 3
  21. New breakpoint 0
  22. In [6]: val = greeting()
  23. [xdbg] Entered: <__main__>.greeting
  24. In [7]: message
  25. Out[7]: 'Hello, world!'
  26. In [8]: return message
  27. [xdbg] Exited: <__main__>.greeting
  28. In [10]: val
  29. Out[10]: 'Hello, world!'

Features

  • Set breakpoints and use the IPython REPL inside a function’s scope
  • Move the REPL’s scope into any imported module
  • Hotfix functions being debugged by specifying the correct behavior, instead of just watching them fail
  • Works well with text editor integration such as the hydrogen package
    for the Atom text editor

See http://kitaev.io/xdbg for more details.

Installation

Dependencies

  • Python 3.5 or 3.6
  • IPython

Note that older versions of Python are not supported.

To Install

Run pip install git+https://github.com/nikitakit/xdbg (or clone the repository and use setup.py)

You can activate xdbg inside an IPython kernel by running %load_ext xdbg. To load it automatically,
list it in your IPython configuration file, e.g.

  1. c.InteractiveShellApp.extensions = ['xdbg']

The configuration file is usually located at ~/.ipython/profile_default/ipython_config.py, and can be
generated by running ipython profile create.

Documentation

For more details, see http://kitaev.io/xdbg