First Steps

Requirements

Pyvhist should work well with Python 2.6 and 2.7. Python 2.5 or below does not work at the moment, since we require some Python features from newer Python versions (e.g. the json module). We might fix this problem in the future. We do not support Python 3, yet.

Pyvhist has no external dependencies and is completely self-contained.

Download pyvhist

You can find pyvhist at http://www.nf.mpg.de/vhist in the downloads section.

Install pyvhist

At the moment, pyvhist comes as a plain zip archive. To install pyvhist, unpack the archive and make sure that the package pyvhist (which is a sub-directory of the unzipped directory) is in your Python path. You could, for example, add the pyvhist package as a subfolder of your current project.

Note: we will probably add an ordinary setup.py in the near future.

Hello World

Once pyvhist is installed correctly, you should be able to import modules from the pyvhist package, such as:

from pyvhist import vhistsection

A hello world in pyvhist looks like this:

from pyvhist import vhistblock

VHISTFILE = 'output.vhist'

with vhistblock.VhistBlock(VHISTFILE) as vb:
    vb.section.title = "Executing my Program"
    # do some work
    compute(23)

this snippet of code will create a vhist file output.vhist with one section titled “Executing my Program” and stores the date and time of execution, the name of the computer and user, as well as the commandline arguments supplied to Python and the Python version as metadata in the VHIST document. Pyvhist will also monitor stdout and stderr, record any exceptions thrown by compute(), and measure the time required by the code block. You can find a version of the generated vhist file here (right-click on the link and press save as).

Table Of Contents

Previous topic

Welcome to pyvhist’s documentation!

Next topic

Tutorial

This Page