Archive for June, 2007

Python Call Graph 0.4.0

I’ve just released pycallgraph 0.4.0. It has several major new features including a command line interface and measuring accumulative time per function.

The 0.4.0 pycallgraph CLI supports function filtering, timing filtering, maximum stack level and a few more settings. For example, to do a simple call graph on “myfile.py”:

pycallgraph-dot.py myfile.py mygraph.png

Here’s an example that doesn’t include the class Foo and outputs to a SVG file format:

pycallgraph-dot.py –exclude=”*.Foo.*” –image-format=svg myfile.py myfile.svg

Turns out far easier than modifying your source code to create a call graph.

Here’s one of the graphs from the source code examples colours.py:

Orange Green Example

As you can see it has green and orange gradients. One end of the gradient is green because of the number of calls is high and the other is orange because the function calls are taking the longest. All that with a function that looks like this:

def orange_green(calls, total_time):
    """Make a higher total time have an orange colour and a higher number
    of calls have a green colour using RGB.
    """
    return '#%02X%02X%02X' % (
        0x30 + total_time * 0xc0,
        0x30 + calls * 0xc0 + total_time * 0x70,
        0x30,
    )

I hope it’s useful to you!

  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • description
  • Reddit
  • StumbleUpon

SQLAlchemy Cheat Sheet

I’ve made a small quick reference guide to SQLAlchemy if anyone is interested. I’ll update it as often as I have to look up something in the official documentation.

  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • description
  • Reddit
  • StumbleUpon

Releases and Projects

For the lack of updates, here is an update:

  • Just released pycallgraph 0.3.1 which fixes a few bugs.
  • This week hopefully releasing a pre-alpha of c80 which is an AJAX IRC client.
  • Development of VirtuShare, a transparent peer-to-peer networking service, is still in progress.
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • description
  • Reddit
  • StumbleUpon