You can use the tool through a single pythoscope command. To prepare your project for use with Pythoscope, type:

$ pythoscope --init path/to/your/project/

It's only doing static analysis, and doesn't import your modules or execute your code in any way, so you're perfectly safe to run it on anything you want. After that, a directory named .pythoscope will be created in the current directory. To generate test stubs based on your project, select files you want to generate tests for:

$ pythoscope path/to/your/project/specific/ path/to/your/project/other/*.py

Test files will be saved to your test directory, if you have one, or into a new tests/ directory otherwise. Test cases are aggregated into TestCase classes. Currently each production class and each production function gets its own TestCase class.

Some of the classes and functions are ignored by the generator - all which name begins with an underscore, exception classes, and some others.

Generator itself is configurable to some extent, see:

$ pythoscope --help

for more information on available options.

Editor Integration


We put out an elisp script that integrates Pythoscope into Emacs. The file is in the the misc/ directory of the source distribution. You can also look at the file on Launchpad. Usage and installation instructions are in the comments at the top of the file.


There is interest in Vim integration and someone is working on it but we have nothing for you right now.


There was much discussion of Leo on the mail list editor integration thread.


All Pythoscope source code is licensed under an MIT license.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License