Posts Tagged ‘pynocle’

Pynocle update

New pynocle uploaded to google code (not PyPI yet). In this is a much better dependency graph rendering, module filename resolution, optimizations (such as only calculating dependency data and filename resolutions once), replacing imports with AST, and other improvements. However I took out the ability to run pynocle over more than just a single directory :( Hopefully this can be added back in. I really need to refactor and test some of this code, though, since it’s becoming quite hairy. The python import machinery is the first thing I’ve truly hated about python.

Next up is probably a substantial refactor of the entire system to work from a relational DB (or maybe even a python mapping pickle), rather than the ad-hoc method it uses right now.  This should allow richer metrics and more flexibility in their use.

The big backend problems right now are exactly that lack of relational data (which I can hopefully solve with a rewrite), and the difficulty in testing the module import mechanisms.  Trying to test it thoroughly meaning practically rewriting and testing all of python’s module import resolution, and then creating a sample of test data that can replicate all of the hundreds of edge-cases (paths with mixed slashes, relative paths, absolute paths with relative pieces, builtin modules with no files, modules not available on the test machine, modules in god knows where in the sys path, etc.).  I’ve done myself a disservice by not building enough tests where I can build them, though (post about this in a few days).  Anyway, I’ll update when I can.

See current metrics here: http://pynocle.googlecode.com/hg/exampleoutput/index.html

Dependency graph here:
http://pynocle.googlecode.com/hg/exampleoutput/depgraph.png

pynocle 0.10 released

My first useful open source project, pynocle, is finally ready for me to talk about.

Get the code via Hg/GoogleCode here: http://code.google.com/p/pynocle/
Browser the pynocle-generated metrics for pynocle here: http://pynocle.googlecode.com/hg/exampleoutput/index.html

pynocle is a series of modules designed to provide the most comprehensive code analysis of python available from a single source.  It is designed to be as dead simple to use as possible- create/configure a pynocle.Monocle object, and run it.  You can get by quite well only knowing 2 methods on a single object.

Right now, pynocle has support for:

  1. Cyclomatic Complexity
  2. Coupling (afferent and efferent)
  3. Google PageRank-like algorithm for measuring coupling (requires numpy)
  4. Source lines of code
  5. Dependency diagrams (requires GraphViz Dot)
  6. Coverage (requires coverage module)
It is intended to run out-of-the-box with minimal work.  Over the coming months, I’m going to add:
  1. More configuration support.  Right now this is truly just an API, which I prefer, but it may make it easier if it can be configured through text.
  2. Runnable from commandline.  I plan to make the whole thing runnable, as well as individual components.
  3. Python easy_install/PyPI support.  Right now, you do it all by hand.
  4. Get it running on Linux.  I am catching a WindowsError in a few places and also am missing the filetype indicator at the top of the files.  I’m not a *nix guy, so if you can help with this, I’d love it (should be simple).
  5. Improve rendering of reports.  Right now, most are in plain text (except dependency images, and coverage html report).  I’d like to make them all some form of HTML.
  6. Add more metrics.  Believe it or not, I’m pretty happy with the current metrics, but I’ll be adding more as time goes on and I get ideas or people ask.
My end goal is to have something comparable to NDepend, but much more limited in scope (both because of the amount of work, and python’s dynamic nature making static analysis more restrictive).
This is my first potentially cool open source project.  If you would like to contribute, great!  Please email me.  If you have any advice for me, I’d love that to!  What’s involved in ensuring this project is successful and adopted?
Return top
 

Switch to our mobile site