puppetry

puppetry with objects


Keywords
socketserver, socket, pickle, serializer
License
MIT
Install
pip install puppetry==0.0.1

Documentation

puppetry

Gitter Twitter

Remote objects, like puppet.

For a small project I need to communicate between two process. In one process I have a class which create an object. The other process should access the functions and variables of this object. The process play with the object like an puppetry.

Install

pip install puppetry

Basic usage

Example class:

class HelloWorld(object):

    def __init__(self, name=''):
        self.name = name

    def hello(self, name=None):
        if name: return 'Hello ' + name
        return 'Hello ' + self.name

Server:

from puppetry import RemoteServer

server = RemoteServer((HOST, PORT), obj=HelloWorld('world'))
server.start()

Client:

from puppetry import RemoteClient

client = RemoteClient((HOST, PORT))
print(client.hello())

client.name = 'puppetry'
print(client.hello())

See more examples in the example folder.

Development

Clone repo:

git clone https://github.com/axju/puppetry.git

Create virtual environment and update dev-tools:

python3 -m venv venv
source venv/bin/activate
pip install --upgrade wheel pip setuptools twine tox

Install local:

pip install -e .

Publish the packages:

python setup.py sdist bdist_wheel
twine upload dist/*

Run some tests:

tox
python setup.py test