Pyro Documentation

Pyro Documentation

Release 4.82 Irmen de Jong

Dec 25, 2021

Contents of this manual:

1 What is Pyro?

3

1.1 Intro and Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.2 Installing Pyro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

1.3 Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

1.4 Command line tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

1.5 Clients: Calling remote objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

1.6 Servers: hosting Pyro objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

1.7 Name Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

1.8 Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

1.9 Exceptions and remote tracebacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

1.10 Flame: Foreign Location Automatic Module Exposer . . . . . . . . . . . . . . . . . . . . . . . . . . 64

1.11 Tips & Tricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

1.12 Configuring Pyro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

1.13 Pyro4 library API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82

1.14 Running on alternative Python implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

1.15 Pyrolite - client library for Java and .NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

1.16 Change Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99

1.17 Software License and Disclaimer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

1.18 Indices and tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105

Python Module Index

107

Index

109

i

ii

Pyro Documentation, Release 4.82

Contents of this manual:

1

Pyro Documentation, Release 4.82

2

Contents of this manual:

1 CHAPTER

What is Pyro?

It is a library that enables you to build applications in which objects can talk to each other over the network, with minimal programming effort. You can just use normal Python method calls to call objects on other machines. Pyro is a pure Python library and runs on many different platforms and Python versions. Pyro is copyright ? Irmen de Jong (irmen@ | ). Please read Software License and Disclaimer. It's on Pypi as Pyro4. Source on Github: and version 5 as Pyro5 (Source)

Pyro4 is considered feature complete and new development is frozen. Only very important bug fixes (such as security issues) will still be made to Pyro4. New development, improvements and new features will only be available in its successor Pyro5 . New code should use Pyro5 unless a feature of Pyro4 is strictly required. Older code should consider migrating to Pyro5. It provides a (simple) backwards compatibility api layer to make the porting easier.

1.1 Intro and Example

This chapter contains a little overview of Pyro's features and a simple example to show how it looks like. 3

Pyro Documentation, Release 4.82

1.1.1 About Pyro: feature overview

Pyro is a library that enables you to build applications in which objects can talk to each other over the network, with minimal programming effort. 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. Pyro is a pure Python library and runs on many different platforms and Python versions. Here's a quick overview of Pyro's features:

? written in 100% Python so extremely portable, runs on Python 2.7, Python 3.5 and newer, IronPython, Pypy 2 and 3.

? works between different system architectures and operating systems. ? able to communicate between different Python versions transparently. ? defaults to a safe serializer (serpent) that supports many Python data types. ? supports different serializers (serpent, json, marshal, msgpack, pickle, cloudpickle, dill). ? support for all Python data types that are serializable when using the `pickle', `cloudpickle' or `dill' serializers1. ? can use IPv4, IPv6 and Unix domain sockets. ? optional secure connections via SSL/TLS (encryption, authentication and integrity), including certificate vali-

dation on both ends (2-way ssl). ? lightweight client library available for .NET and Java native code (`Pyrolite', provided separately). ? designed to be very easy to use and get out of your way as much as possible, but still provide a lot of flexibility

when you do need it. ? name server that keeps track of your object's actual locations so you can move them around transparently. ? yellow-pages type lookups possible, based on metadata tags on registrations in the name server. ? support for automatic reconnection to servers in case of interruptions. ? automatic proxy-ing of Pyro objects which means you can return references to remote objects just as if it were

normal objects. ? one-way invocations for enhanced performance. ? batched invocations for greatly enhanced performance of many calls on the same object. ? remote iterator on-demand item streaming avoids having to create large collections upfront and transfer them as

a whole. ? you can define timeouts on network communications to prevent a call blocking forever if there's something

wrong. ? asynchronous invocations if you want to get the results `at some later moment in time'. Pyro will take care of

gathering the result values in the background. ? remote exceptions will be raised in the caller, as if they were local. You can extract detailed remote traceback

information. ? http gateway available for clients wanting to use http+json (such as browser scripts).

1 When configured to use the pickle, cloudpickle or dill serializer, your system may be vulnerable because of the security risks of these serialization protocols (possibility of arbitrary code execution). Pyro does have some security measures in place to mitigate this risk somewhat. They are described in the Security chapter. It is strongly advised to read it. By default, Pyro is configured to use the safe serpent serializer, so you won't have to deal with these issues unless you configure it explicitly to use one of the other serializers.

4

Chapter 1. What is Pyro?

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download