![PYRO](/file/21159/EnigmaAmiga106CD.iso/www/python-amiga/img/pyro.jpg) |
P
y t h o n R e m o t e O b j e c t s |
Pyro is an acronym for PYthon Remote Objects. It is a basic Distributed
Object Technology system written entirely in Python, and for use in Python only. With
this, it closely resembles Java's Remote Method Invocation (RMI). It has
less similarity to CORBA - which is a
system- and language independent Distributed Object Technology and has much more to offer
than Pyro or RMI. But Pyro is small, simple and free!
However, read the disclaimer and copyright notice.
- Contents:
- Features
Pieces of Pyro
Download
Related Technology
What features does Pyro have?
- Written in 100% pure Python. It is small, simple and extremely portable
- it runs everywhere Python runs, and - at least for now - the socket
module is available.
- Naming Service which keeps record of the location of objects. The
location of the NS can be discovered by use of a broadcast mechanism,
if need be.
- Support for Python types only restricted by those that the standard
'pickle' module handles (all builtin types, and user created classes)
Objects as arguments are also supported when the code for those user
defined classes is also available on the server side. But see below,
about mobile objects.
- All arguments have pass by value semantics. There is no pass
by reference.
- Support for all Python argument types (variable argument lists and
keyword arguments,
*args and **keywords ).
- Exceptions that occur in the remote object will actually be raised
too on the client, just as if the error occured locally. Pyro's exception
transportation mechanism makes this possible.
- Potential support for different protocols, without having to change
your code. Currently however only one protocol is implemented: PYRO
(which runs on top of TCP/IP).
- Proxy compiler which automates the task of creating wrapper (proxy)
classes.
- Dynamic Proxies if you don't like to have pregenerated proxies!
What is planned for the future?
- Persistent Naming Service. The NS will save its database to disk,
to survive shutdowns.
- Mobile objects. Clients will be able to use objects in method calls
- even when the server has never known them before.
- Object Activation. The server will activate (and destroy?) objects
on demand, instead of keeping them running all the time and in advance.
Optionally, the object reads its persistent state back.
- More efficient network usage (multiplexed connections over one keep-alive
socket).
- Multiple separated server objects which connect to one shared Pyro
daemon (currently, all server objects and the Pyro daemon should be
part of the same Python process).
To get an idea how things work, here is a scenario:
- The programmer writes a module 'test' containing a class 'testclass', which will be
accessed remotely.
- Using PyroC the client proxy code is generated for 'testclass'. It is written to the
'test_proxy' module.
- The server creates one or more instances of the 'testclass', and registers them with the
Pyro Naming Service.
- The client queries the Naming Service for the location of those objects. It gets a Pyro
URI for them.
- The client creates proxies for the remote objects by creating 'test_proxy.testclass'
instances for the given URI.
- As the proxy appears just like the real 'testclass', the client can now invoke methods
on the remote objects.
The Pyro system consists of several pieces. It is distributed as a Python package, with
a few additional files.
Pyro Component |
Description |
Core Library |
This is the body of Pyro: it contains all code for Pyro URI's (see
below), protocols, exceptions, the server object base class, and the Pyro Daemon.
Pyro will support multiple wire protocols. Currently only the PYRO protocol is
implemented. For each protocol there is a Protocol Adapter. Code can remain unchanged when
you switch to another protocol: the code will just use another Protocol Adapter. |
Naming Service |
The Naming Service is an entity which registers [name, location]
pairs. In Pyro, each object has an identifier. The server which provides Pyro objects
registers those with the Naming Service, together with the location. Clients seek out the
Naming Service (possibly by a broadcast mechanism), and query the location of the objects
they need. Once known, they can obtain a reference to the object.
Pyro works with URIs (Universal Resource Identifiers) to locate
objects; they look like WWW URLs. |
Proxy Compiler |
The proxy compiler (PyroC) is used to process the Python module
files which you would like to access remotely. It generates so-called proxy classes which
the client uses in stead of the 'real' classes. Those proxies look exactly like their
'real' counterparts but they only pass information between the client invoking a method
and the 'real' object somewere else.
PyroC works by analyzing the imported modules for classes. Each class is processed
and a corresponding proxy class is written to the output file. Clients must use this
generated proxy code in stead of the original file.
In the current version, no 'skeleton' code has to be generated for the
server. |
Util |
Various utility functions (parsing arguments, object UUID
generator...) |
Additional files |
Scripts to start the Naming Service, the NS Control tool, and the
Proxy Compiler are provided, and a demo as well. |
...
Pyro is ©1999 Irmen de Jong. Disclaimer and copyright.
Download Pyro including manual and example (the current version is 0.6):
Tar GZ format - ZIP
format.
The manual is also seperately available.
- Java Remote Method Invocation (RMI)
- Common Object Request Broker Architecture (CORBA)
- Fnorb - a CORBA
implementation in Python
- Daniel Larsson's RemoteCall
package
|