Coder Social home page Coder Social logo

showme's Introduction

ShowMe -- Quick and easy debugging for Python

ShowMe is a simple set of extremely useful function decorators for Python. It allows you to view trace information, execution time, cputime, and function documentation.

Installation

To use showme, simply:

pip install showme

or, if you must:

easy_install showme

Usage

Print passed-in arguments and function calls.

@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}

Print function execution time.

@showme.time
def some_function(a):
    ...

>>> some_function()
Execution speed of __main__.some_function:
0.000688076019287 seconds

Print function cpu-execution time.

 @showme.cputime
 def complex_function(a, b, c):
     ...

 >>> complex_function()
 CPU time for __main__.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}

Pretty print function documentation.

@showme.docs
def complex_function():
    """Example Documentation for complex_function."""
    ...

>>> complex_function()
Documentation for __main__.complex_function:
Example Documentation for complex_function.

showme's People

Contributors

navdeep-g avatar kennethreitz avatar jonashaag avatar fryuni avatar rajat404 avatar

Stargazers

 avatar  avatar Jaimish Trivedi avatar Victoria Fox avatar Réverti Ivanov avatar Tom-- avatar MrFlou avatar Jeff Cook avatar  avatar Perttu Salonen avatar  avatar Matt Cooper avatar Rajendra Agrawal avatar Carlos V avatar Ryan Benmalek avatar Liam Whittle avatar Irving Kcam avatar Mr Keuz avatar Bernardo Chrispim Baron avatar Majid avatar Pedro Batista avatar Michael avatar Melanie avatar Rishabh jindal avatar GAURAV avatar Isaac A. Dettman avatar Victor Mariano Leite avatar JerodG avatar Joker_ avatar HylaruCoder avatar Robert Chin avatar jasonto avatar Eyad Sibai avatar  avatar  avatar Josh avatar zhihan avatar Adequin Renaud avatar LambertWu avatar Ichsan Haryadi avatar Cleotilde Schulist avatar Alice1017 avatar Mathieu Deous avatar Andrey Bogoyavlenskiy avatar Jonathan McHugh avatar David Alexander avatar Cosmo Borsky avatar skywind avatar Joshua Görner avatar LiPidong avatar Steven Brien avatar  avatar  avatar Allan L. R. Hansen avatar David Gidwani avatar Andrey avatar Alexander Smirnov avatar Nicky van Meurs avatar Moshe Immerman avatar Syed Hasan raza avatar Ramkumar Velmurugan avatar RandomOS avatar Matthias Rebel avatar Swapnil Joshi avatar André Luiz Guimarães de Souza Leite avatar Johnson Chetty avatar 曹文忠 avatar Mark E. Madsen avatar Joshua Moldenhauer avatar Paul Miu avatar Frederick Wagner avatar  avatar Jialong Shen avatar James Liu avatar axiaoxin avatar wong2 avatar Geoffrey Guéret avatar Tom Hensel avatar David Morgan avatar mohammad avatar flowing_water avatar linhao avatar Mosab Ibrahim avatar hrrschr avatar John Owen Nixon avatar Volodymyr Boldovskyy avatar Ludovic Delauné avatar Damien Garaud avatar Joe Letts avatar Gabriel Lima avatar Phil Adams avatar Gabi Davar avatar Denis Costa avatar Chester Liu avatar Yoav Ram avatar  avatar Marcelo Fonseca Tambalo avatar Samuel Bishop avatar Paweł Romanowski avatar Rakan Al-Huneiti avatar

Watchers

Lin Xianyi avatar Hooshmand avatar James Cloos avatar Kondal Rao Komaragiri avatar  avatar Mohit Sethi avatar Sydney Weidman avatar Samuel Bishop avatar Claudia Scholz avatar Michael Drozdovsky avatar Eee...ha avatar jasonto avatar  avatar buğra avatar  avatar Anurag Verma avatar Siyuan Wang avatar  avatar

showme's Issues

Fails in Python 3.5.2: " ImportError: No module named 'core' "

I think this screen dump from the terminal says it all:

Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul  2 2016, 17:52:12)
Type "copyright", "credits" or "license" for more information.

IPython 5.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import showme
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-bf8da9429a6f> in <module>()
----> 1 import showme

/Users/allan/homeInstalled/miniconda3/envs/py35/lib/python3.5/site-packages/showme/__init__.py in <module>()
----> 1 from core import *

ImportError: No module named 'core'

In [2]:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.