Skip to main content

Distributed component model for Python.

Project description

PyCOM is simple and easy-to-use distributed component model written in Python. PyCOM makes different parts of your network application isolated and independent, while allowing easy and straightforward interaction between them.

Highlights:

  • Non-intrusive design without black magic and lots of auto-generated code

  • Effective, easy-to-implement and portable protocol by default

  • Pluggable protocol support (default is JSON over ZeroMQ aka zerojson)

  • Support for binary attachments of any size

  • Support for stateful services via HTTP-alike sessions

  • Easily extensible core library

  • Low level enough to build your own frameworks

  • … and still simple enough to be used as is

  • Python 2 and Python 3 support out-of-box

  • Comprehensive test suite and documentation

  • Free software (new BSD license)

There is ongoing effort to create a C++ client library for PyCOM: https://bitbucket.org/divius/libpycom

Main concepts

With PyCOM you build your application as a number of services, each running in it’s own process (or even on it’s own computer). You maintain a PyCOM nameserver for finding services by their names (by the way, nameserver itself is a service).

Services provide interfaces, i.e. a named way of interacting with service. They are somewhat similar to interfaces in e.g. Java, but note that PyCOM does not perform any checks on interfaces. Interface usually has some amount of methods.

Services are identified by path with parts separated by slashes, e.g. /com/foo/group/service.

Interfaces are identified by name with parts separated by dots, e.g. com.foo.my-interface.

Examples

Service example (module service1.module1):

import pycom

@pycom.interface("com.foo.example")
class Query(object):

    @pycom.method("create")
    def method_create(self, request):
        return {"field1" : request.args}

pycom.main()

Example command line for running this service (provided nameserver is running on 192.168.10.1:2012):

python -m pycom -a tcp://192.168.10.2:2013 -n tcp://192.168.10.1:2012 service1.module1

Example client code for this service:

import pycom

pycom.configure(nameserver="192.168.10.1:2012")

query = pycom.locate("com.foo.example")
print query.invoke("create", 42)
# Prints {"field1" : 42}

Quick start

To test (logs will be saved in test.log):

$ python test.py

To build HTML documentation (requires Sphinx):

$ python setup.py build_sphinx
$ <your-browser> build/sphinx/html/index.html

To install:

$ python setup.py install

or via pip:

$ pip install pycom

Do not forget to read about known issues in the current version: http://packages.python.org/pycom/status.html#known-issues

Support

PyCOM repository and issue tracker are hosted on BitBucket.

Latest source code: https://bitbucket.org/divius/pycom/overview

Report bugs: https://bitbucket.org/divius/pycom/issues

Read documentation: http://packages.python.org/pycom

Enjoy =)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pycom-0.4.0.tar.gz (32.2 kB view details)

Uploaded Source

File details

Details for the file pycom-0.4.0.tar.gz.

File metadata

  • Download URL: pycom-0.4.0.tar.gz
  • Upload date:
  • Size: 32.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pycom-0.4.0.tar.gz
Algorithm Hash digest
SHA256 868238e12df7b0eeba153e7394e2e7706cb7d8edf184974b245ba70a4e14906f
MD5 029288d61f0523b14dd5c1db8d1af74b
BLAKE2b-256 825998ffe42ee54ea37b6b30cac4a957298cdf22260b7792170d78786bcef2a4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page