pylib scripts

The pylib installs several scripts to support testing and (python) development. If working from a checkout you may also add bin to your PATH environment variable which makes the scripts available on your shell prompt.

py.test and py.test-$VERSION

The py.test executable is the main tool that the py lib offers; in fact most code in the py lib is geared towards supporting the testing process. See the py.test documentation for extensive documentation. The py.test-$VERSION is the same script with an interpreter specific suffix appended to make several versions of py.test for using specific interpreters accessible:

  • CPython2.4: py.test-2.4
  • CPython2.5: py.test-2.5
  • ...
  • CPython3.1: py.test-3.1
  • Jython-2.5.1: py.test-jython
  • pypy-$SUFFIX: py.test-pypy-$SUFFIX

py.which and py.which-$VERSION

Usage: py.which modulename

Print the __file__ of the module that is imported via import modulename. The version-suffix is the same as with py.test above.

py.cleanup

Usage: py.cleanup [PATH]

Delete pyc file recursively, starting from PATH (which defaults to the current working directory). Don't follow links and don't recurse into directories with a ".".

py.countloc

Usage: py.countloc [PATHS]

Count (non-empty) lines of python code and number of python files recursively starting from a PATHS given on the command line (starting from the current working directory). Distinguish between test files and normal ones and report them separately.

py.lookup

Usage: py.lookup SEARCH_STRING [options]

Looks recursively at Python files for a SEARCH_STRING, starting from the present working directory. Prints the line, with the filename and line-number prepended.