-
Notifications
You must be signed in to change notification settings - Fork 0
mnp: Mininet Packaging Tools Docs
mnp
, available here, is a command-line tool developed during Google Summer of Code 2013 with these purposes:
- Help Mininet users download a Mininet modules from a sharing website, including the dependencies with as few commands as possible.
- Help Mininet developers package, upload, and share their Mininet modules on a sharing website.
The sharing website, based on djangopypi2
, is also developed on Google Summer of Code 2013 and documented in a separate page.
Mininet packaging format is just a plain old Python packaging format based on setuptools
and distutils
.
-
download
: Download specified packages -
upload
: Package and upload the package from the current directory -
list
: List all available packages -
search
: Search for packages -
docs
: Retrieve the documentation of a package -
info
: Print the essential information (author, version, summary etc.) of a package
- GitHub Authentication support for
upload
command
The commands supported by mnp are implemented internally by reusing existing tools as much as possible.
Implemented by calling pip
from the command line.
Implemented by calling setup.py
from the command line which in turn calls setuptools
.
Implemented by making an XML-RPC request to the sharing website.
Implementing the support for GitHub authentication is the most technically challenging part of the development of mnp
.
After trying out several approaches, I arrived at the conclusion that the most elegant way to implement GitHub authentication is by implementing additional commands to setup.py
by creating additional cmdclass
.
By reading through the source code of both setuptools
and distutils
for both register
and upload
commands, I managed to find the proper methods to override in order to read in users' specified GitHub username from .pypirc
. If the GitHub password is not specified in .pypirc
, then the user will be asked for it when the command is executed.
Implementing it this way, however, means that users who wanted to use GitHub account to submit their packages must always import and specify the cmdclass
-es in their setup.py
files. This is very inconvenient as the setup.py
files are quite complex enough as it is, so I decided to monkey-patch the setup.py
to patch the setup()
function to automatically include the cmdclass
-es written to support GitHub authentication. This monkey-patch mechanism can be easily activated simply by writing import mnp.patch
at the top of the setup.py
files.