mirror of https://github.com/cool-RR/PySnooper.git
Remove tests package, add docstsring
This commit is contained in:
parent
d29ff78637
commit
6e3d797be3
|
@ -35,6 +35,33 @@ def get_write_function(output):
|
||||||
|
|
||||||
|
|
||||||
def snoop(output=None, variables=(), depth=1, prefix=''):
|
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)
|
write = get_write_function(output)
|
||||||
@decorator.decorator
|
@decorator.decorator
|
||||||
def decorate(function, *args, **kwargs):
|
def decorate(function, *args, **kwargs):
|
||||||
|
|
7
setup.py
7
setup.py
|
@ -4,16 +4,19 @@
|
||||||
import setuptools
|
import setuptools
|
||||||
|
|
||||||
|
|
||||||
|
packages = [package for package in setuptools.find_packages()
|
||||||
|
if package != 'tests']
|
||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name='PySnooper',
|
name='PySnooper',
|
||||||
version='0.0.5',
|
version='0.0.6',
|
||||||
author='Ram Rachum',
|
author='Ram Rachum',
|
||||||
author_email='ram@rachum.com',
|
author_email='ram@rachum.com',
|
||||||
description="A poor man's debugger for Python.",
|
description="A poor man's debugger for Python.",
|
||||||
long_description=open('README.md', 'r').read(),
|
long_description=open('README.md', 'r').read(),
|
||||||
long_description_content_type='text/markdown',
|
long_description_content_type='text/markdown',
|
||||||
url='https://github.com/cool-RR/PySnooper',
|
url='https://github.com/cool-RR/PySnooper',
|
||||||
packages=setuptools.find_packages(),
|
packages=packages,
|
||||||
install_requires=open('requirements.txt', 'r').read().split('\n'),
|
install_requires=open('requirements.txt', 'r').read().split('\n'),
|
||||||
tests_require=open('test_requirements.txt', 'r').read().split('\n'),
|
tests_require=open('test_requirements.txt', 'r').read().split('\n'),
|
||||||
classifiers=[
|
classifiers=[
|
||||||
|
|
Loading…
Reference in New Issue