Giter VIP home page Giter VIP logo

coffea's Introduction

Coffea

Coffea is a command line tool and Python library for analyzing static dependences in Java bytecode. Features:

  • Class processing handled entirely in Python (i.e. no JVM dependency and no class loader issues)
  • Recursive processing of directories (e.g. exploded deployments) and basic archive formats (jar, war and ear)
  • Package or class based dependency models
  • Node weight based on actual code size (i.e. bytecode size)
  • Node filters and mappers for basic noise reduction (eg. removing certain packages from the model or folding several packages into one node)
  • Basic graph visualisation using matplotlib
  • Exporting to common graph formats using standard networkx facilities (eg. dot, gml or graphml)

Usage

Run the command-line tool (use coffea -h for a complete list of options):

$ coffea -i <directory|jar|war|ear|class>

Example

Modelling JBoss AS 7.x internal dependency structure:

$ coffea -p -i /opt/jboss-7.2.0.GA/modules/ -Ip org.jboss. -Mrp org.jboss. -Mep 0 -El logging

Interactive mode equivalent:

>>> from coffea.builder import Builder
>>> from coffea.analyzer import Plotter
>>> from coffea.model import NodeIdFilter, NodeIdMapper
>>> b = Builder()
>>> b.model.node_filters.append(NodeIdFilter(lambda it: it.startswith('org.jboss.')))
>>> b.model.node_filters.append(NodeIdMapper(lambda it: it.replace('org.jboss.', '')))
>>> b.model.node_filters.append(NodeIdMapper(lambda it: it.split('.')[0]))
>>> b.model.node_filters.append(NodeIdFilter(lambda it: it not in ['logging']))
>>> b.append('/opt/jboss-7.2.0.GA/modules/')
No handlers could be found for logger "scanner"
>>> print len(b.model.nodes)
48
>>> p = Plotter(b.model)
>>> p.plot()

[Displays an interactive view of the dependency model]

>>> p.plot(filename='/tmp/jboss7_module_dependencies.png')

Output:

JBoss 7.x internal dependencies

Unit testing

You can run the test suite directly from the command line:

$ python -m unittest discover

coffea's People

Contributors

sjednac avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.