This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Easily find and view a Python module's source code

Project Description

Vsrc is a developer tool that finds and displays a module’s Python source file by searching the Module Search Path, which means the list of directories given by sys.path, the current directory, PYTHONPATH, and the installation- dependent default path. Therefore, Vsrc can find standard modules (like ‘string’ and ‘os.path’), 3rd-party modules (like pygame), and user-defined modules. Vsrc works from both the command-line and from inside of Python’s interactive mode.

Note that not all modules include Python source, for example, ‘sys’ is a C Built-in. If a .py file for the module is found, it’s displayed after first checking the value of the optional environment variable VSRC_VIEWER. If VSRC_VIEWER isn’t set, then Vsrc will attempt to use the “less” pager (if it exists in the system PATH), otherwise it uses “more”.

The value of VSRC_VIEWER can be any viewer you like, such as a normal text editor like vim or notepad, or a pager program like less or more.

Vsrc is platform-independent.

Since Vsrc 0.1 (which was created July 16th, 2003) Vsrc has been rewritten as of July 30th, 2009 and includes some changes…

It now uses VSRC_VIEWER as an environment variable, instead of PAGER.

It now will work in Windows using cmd.exe. The default viewer it uses is less.exe, if you have it in your path, otherwise it uses more.exe (which comes with Windows) but you can also create a VSRC_VIEWER environment variable to use another viewer, such as notepad. To get less.exe, visit If you get the setup program it will install less.exe into C:Program FilesGnuWin32bin. Make sure you add this directory to your Windows %PATH%.


The preferred way is to use install it from pypi using pip:

$ pip install vsrc

this way you can install it into any virtualenv’s you might have. Or into your main python installation (by running: sudo pip install vsrc). And you’ll also be able to uninstall it with:

$ pip uninstall vsrc

If you want to run it manually from source code, you can download the tarball from pypi or clone from and run:

$ sudo python install

this will install the command-line script ‘vsrc’ in your bin directory and it will install the module into your dist-packages directory.


Typical usage looks like this:

Command-line: $ vsrc <module>

Interactive mode:  >>> import vsrc
                   >>> vsrc.vsrc('<module>')


To see the “socket” module’s corresponding source file, type:

$ vsrc socket

or from within Python’s interactive-mode, type:

>>> import vsrc
>>> vsrc.vsrc('socket')

and vsrc will automatically find–which, if you use Linux, would be something like /usr/lib/python/– and load in your viewer.

To seek out and view Pygame’s sprite module’s source code, type:

$ vsrc pygame.sprite


>>> from vsrc import vsrc
>>> vsrc('pygame.sprite')

To view a Python source file from the current directory, do:

>>> vsrc('foo')

as long as you have a file called ‘’ in the current dir.

Release History

Release History

This version
History Node


History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
vsrc-1.1.1.tar.gz (5.0 kB) Copy SHA256 Checksum SHA256 Source Jan 7, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting