From 6e3d797be3fa0a746fb5b1b7c7fea78eb926c208 Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Mon, 22 Apr 2019 12:05:42 +0300 Subject: [PATCH] Remove tests package, add docstsring --- pysnooper/pysnooper.py | 27 +++++++++++++++++++++++++++ setup.py | 7 +++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/pysnooper/pysnooper.py b/pysnooper/pysnooper.py index 39e8a85..8d0c6a7 100644 --- a/pysnooper/pysnooper.py +++ b/pysnooper/pysnooper.py @@ -35,6 +35,33 @@ def get_write_function(output): def snoop(output=None, variables=(), depth=1, prefix=''): + ''' + Snoop on the function, writing everything it's doing to stderr. + + This is useful for debugging. + + When you decorate a function with `@pysnooper.snoop()`, you'll get a log of + every line that ran in the function and a play-by-play of every local + variable that changed. + + If stderr is not easily accessible for you, you can redirect the output to + a file:: + + @pysnooper.snoop('/my/log/file.log') + + See values of some variables that aren't local variables:: + + @pysnooper.snoop(variables=('foo.bar', 'self.whatever')) + + Show snoop lines for functions that your function calls:: + + @pysnooper.snoop(depth=2) + + Start all snoop lines with a prefix, to grep for them easily:: + + @pysnooper.snoop(prefix='ZZZ ') + + ''' write = get_write_function(output) @decorator.decorator def decorate(function, *args, **kwargs): diff --git a/setup.py b/setup.py index 790b45f..52b1206 100644 --- a/setup.py +++ b/setup.py @@ -4,16 +4,19 @@ import setuptools +packages = [package for package in setuptools.find_packages() + if package != 'tests'] + setuptools.setup( name='PySnooper', - version='0.0.5', + version='0.0.6', author='Ram Rachum', author_email='ram@rachum.com', description="A poor man's debugger for Python.", long_description=open('README.md', 'r').read(), long_description_content_type='text/markdown', url='https://github.com/cool-RR/PySnooper', - packages=setuptools.find_packages(), + packages=packages, install_requires=open('requirements.txt', 'r').read().split('\n'), tests_require=open('test_requirements.txt', 'r').read().split('\n'), classifiers=[