How to contribute to mptcpanalyzer ?

There are several things you can do:

Develop an mptcpanalyzer plugin

mptcpanalyzer can load plugins following stevedore’s plugin, i.e. mptcpanalyzer will look for specific disttools entry points in order to find and load plugins.

To add a plugin, just mimic what is done for existing plugins, see stevedore’s plugin documentation plus check our setup.py:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
            'mptcpanalyzer.plots': [
                'attr = mptcpanalyzer.plots.dsn:PerSubflowTimeVsAttribute',
                'interarrival = mptcpanalyzer.plots.dsn:InterArrivalTimes',
                'xinterarrival = mptcpanalyzer.plots.dsn:CrossSubflowInterArrival',
                'dss_len = mptcpanalyzer.plots.dsn:DssLengthHistogram',
                'dss = mptcpanalyzer.plots.dsn:DSSOverTime',
                'owd = mptcpanalyzer.plots.owd:OneWayDelay',
                'ns3 = mptcpanalyzer.plots.ns3:PlotTraceSources',
                ],
            # namespace for plugins that monkey patch the main Cmd class
            'mptcpanalyzer.cmds': [
                'stats = mptcpanalyzer.command_example:CommandExample',
              ]

mptcpanalyzer will load all plugins residing in these two namespaces:

  • mptcpanalyzer.plots
  • mptcpanalyzer.cmds

regardless of which python package they belong

In order to test while modifying mptcpanalyzer, you can install it like this:

$ python3.5 setup.py develop --user

Note

Add –uninstall to remove the installation.

Develop a new plot

You must create a new class that inherits from mptcpanalyzer.plot.Plot (or one of its children). Then you most likely need to override.

Develop a command plugin

Just follow the example in:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from .command import Command

import logging


"""
While in mptcpanalyzer sources, one can do getLogger(__name__) to retrieve a
(sub)logger, your plugin can be in another package and as such, you have to name
the logger explicitly with mptcpanalyzer.**
"""
log = logging.getLogger("mptcpanalyzer")

class CommandExample(Command):
    """
    This is just an example of how to write a plugin that will be automatically
    loaded by mptcpanalyzer.

    """
    def do(self, data):
        """
        :param data: This is the line passed by the user to the interpreter
        """
        print("You wrote: %s" % data)

    def help(self):
        """
        Message printed when the author writes
        """
        print("Prints 'Hello world !' followed by the user message")

    def complete(self, text, line, begidx, endidx):
        """
        To provide autocompletion
        """
        pass

How to upload it to pypy (for the forgetful maintainer)

$ python3.5 setup.py sdist upload

(test first the package locally pip install /path/toarchive.gz)