This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

About

python-monkey-business is a package that provides a decorator for monkey-patching python functions at runtime.

Installation

Using pip:

pip install python-monkey-business

Or, to install from source:

pip install -e git+https://github.com/theatlantic/python-monkey-business.git#egg=python-monkey-business

If the source is already checked out, use setuptools:

python setup.py develop

Usage

To use python-monkey-business to swap out a function in a class or module at runtime:

import monkeybiz

from foomodule import FooClass
import barmodule


# This replaces FooClass.bar with our method
@monkeybiz.patch(FooClass)
def bar(original_fn, *args, **kwargs):
    print "Patched!"
    return original_fn(*args, **kwargs)

# This replaces barmodule.baz with our function
@monkeybiz.patch(barmodule)
def baz(original_fn, *args, **kwargs):
    #...

The first argument to monkeybiz.patch can be either a module, a class, or a list of modules and/or classes. The decorator also takes optional name and avoid_doublewrap keyword arguments. If name is omitted, the name of the function being patched will be the name of the function being decorated. If avoid_doublewrap is True (the default), then functions and methods can only be patched once using this function.

Use monkeybiz.unpatch() to revert a monkey-patched function to its original.

License

This code is licensed under the Simplified BSD License. View the LICENSE file under the root directory for complete license and copyright information.

Release History

Release History

1.0.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
python_monkey_business-1.0.0-py2.py3-none-any.whl (5.5 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Mar 22, 2016
python-monkey-business-1.0.0.tar.gz (4.0 kB) Copy SHA256 Checksum SHA256 Source Mar 22, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting