PyChecker is a python source code checking tool to help you find common bugs. It is meant to find problems that are typically caught by a compiler. Because of the dynamic nature of python, some warnings may be incorrect; however, spurious warnings should be fairly infrequent.

PyChecker works in a combination of ways. First, it imports each module. If there is an import error, the module cannot be processed. The import provides some basic information about the module. For each function, class, and method, the code within the function is checked for possible problems.

Types of problems that can be found include:

  • No doc strings in modules, classes, functions, and methods
  • self not the first parameter to a method
  • Wrong number of parameters passed to functions/methods
  • No global found (e.g., using a module without importing it)
  • Global not used (module or variable)
  • Local variable not used

To use PyChecker, pass the python source files you want to check on the command line:

	python $PY_CHECKER_HOME/checker.py file1.py file2.py ...

If there are import dependencies in your source files, you should import those files first on the command line in order to get as many files checked as possible.

PyChecker should work with Python 1.5.2 and 2.0.

To look at a little example, you can use the test files included:

	python checker.py test_input/*.py

The current version of PyChecker can be found on SourceForge or downloaded here. Known problems are here.

The COPYRIGHT is based on BSD.

Good Luck! As always, feedback is greatly appreciated.

Neal

pychecker@metaslash.com