Creating applications that allow objects to talk with one another over the network can be a pain, but Pyro 4 not only makes this possible, but does so with minimal programming. Written in "100% pure Python," Pyro4 is compatible with Python 2.x, Python 3.x, IronPython, Jython, and Pypy.
You can just use normal Python method calls, with almost every possible parameter and return value type, and Pyro takes care of locating the right object on the right computer to execute the method. It is designed to be very easy to use, and to generally stay out of your way. But it also provides a set of powerful features that enables you to build distributed applications rapidly and effortlessly.
FeaturesSince its initial release in 2010, Pyro4 has experienced some hefty improvements and additional features. The change log is available online, but here are some of the key features:
- support for all Python data types that are pickleable.
- works between systems on different architectures and operating systems (64-bit, 32-bit, Intel, PowerPC…)
- name server that keeps track of your object's actual locations so you can move them around transparently.
- support of automatic reconnection to servers in case of interruptions.
- one-way invocations for enhanced performance.
- large amount of unit tests and high test coverage.
- built upon more than 10 years of existing Pyro history.
- can use IPv4 and Unix domain sockets (IPv6 is not yet supported but it is being developed)
There is a complete manual that has all the information you will need to get Pyro4 up and running, and a few simple examples are included in the download as well.
Performance"Pyro4 is really fast at what it does." And here are some stats to prove it:
2000 connections in 1.139 sec = 1756 conn/sec
2000 new proxy calls in 1.451 sec = 1378 calls/sec
10000 calls in 1.058 sec = 9452 calls/sec
It took 0.48 seconds to transfer 51269 kilobyte.
That is 106148 k/sec. = 103.7 mb/sec.
Batched remote calls...
processing the results...
total time taken 0.29 seconds (136500 calls/sec)
batched calls were 14.1 times faster than normal remote calls
More stats are available here.
SecurityIf you're considering using Pyro4, be sure to heed this Security Warning:
Pyro uses the pickle module to serialize objects and sends them over the network. It is well known that using pickle for this purpose is a security risk (The main problem is that allowing your program to unpickle arbitrary data can cause arbitrary code execution and may wreck or compromise your system). However, Pyro has some security measures in place to deal with this. They are described in the Security chapter. It is strongly advised to read it.
While pickle does pose a threat to security, Pyro provides a few facilities to help, including:
- Network Interface Binding
- Running Pyro Servers with Different Credentials/User ID
- Protocol Encryption
- Dotted Names (Object Traversal)
- Environment Variables Overriding Config Items
- Preventing Arbitrary Connections: HMAC Signature
Pyro4 seems like a great tool for Python developers and is continually being improved upon by a dedicated development team. Stay tuned for more updates and releases sure to be on the way.