python的无痛调试和检查
showme的Python项目详细描述
showme–快速简单地调试python
showme是一组非常有用的python函数装饰器。 它允许您查看跟踪信息、执行时间、cputime和函数 文档。
安装
要使用showme,只需:
pip install showme
或者,如果您必须这样做:
easy_install showme
使用量
打印传入的参数和函数调用。
@showme.trace def complex_function(a, b, c, **kwargs): >>> complex_function('alpha', 'beta', False, debug=True) calling haystack.submodule.complex_function() with args: ({'a': 'alpha', 'b': 'beta', 'c': False},) kwargs: {'debug': True}
打印功能执行时间。
@showme.cputime def complex_function(a, b, c): >>> complex_function() 3 function calls in 0.013 CPU seconds ncalls tottime percall cumtime percall filename:lineno(function) 1 0.013 0.013 0.013 0.013 test_time.py:6(test) 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects} 1 0.000 0.000 0.000 0.000 {range}
漂亮的打印功能文档。
@showme.docs def complex_function(): """Example Documentation for complex_function""" pass >>> complex_function() Example Documentation for complex_function
历史记录
1.0.0(2010-09-05)
- 功能集完成
- 向PYPI公开发布Showme
- 项目清理(删除全局/局部)
0.0.5(2010-09-05)
- @showme.time支持(简单但大的功能)
- 添加颜色输出(通过自动提供的Colorama)
0.0.4(2010-09-04)
- epic@showme.trace decorator已写入
- @showme.docs支持
0.0.3(2010-09-01)
- 常规配置就位
- @showme.cputime支持
- 装饰装修商的自动售货