You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*some* submodules are more or less emulated such as ``Pyro4.errors``, ``Pyro4.socketutil``.
27
+
So you may first have to convert your old code to use the importing scheme to
28
+
only import the Pyro4 module and not from its submodules, and then you should
29
+
insert this at the top to enable the compatibility layer::
30
30
31
+
from Pyro5.compatibility import Pyro4
31
32
32
33
33
34
.. index:: features
34
35
35
36
About Pyro: feature overview
36
37
============================
37
38
38
-
Pyro is a library that enables you to build applications in which
39
+
Pyro enables you to build applications in which
39
40
objects can talk to each other over the network, with minimal programming effort.
40
-
You can just use normal Python method calls, with almost every possible parameter
41
-
and return value type, and Pyro takes care of locating the right object on the right
41
+
You can just use normal Python method calls, and Pyro takes care of locating the right object on the right
42
42
computer to execute the method. It is designed to be very easy to use, and to
43
-
generally stay out of your way. But it also provides a set of powerful features that
43
+
stay out of your way. But it also provides a set of powerful features that
44
44
enables you to build distributed applications rapidly and effortlessly.
45
45
Pyro is a pure Python library and runs on many different platforms and Python versions.
46
46
@@ -63,35 +63,15 @@ Here's a quick overview of Pyro's features:
63
63
- batched invocations for greatly enhanced performance of many calls on the same object.
64
64
- remote iterator on-demand item streaming avoids having to create large collections upfront and transfer them as a whole.
65
65
- you can define timeouts on network communications to prevent a call blocking forever if there's something wrong.
66
-
- 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.
67
66
- remote exceptions will be raised in the caller, as if they were local. You can extract detailed remote traceback information.
68
67
- http gateway available for clients wanting to use http+json (such as browser scripts).
69
-
- stable network communication code that works reliably on many platforms.
68
+
- stable network communication code that has worked reliably on many platforms for over a decade.
70
69
- can hook onto existing sockets created for instance with socketpair() to communicate efficiently between threads or sub-processes.
71
-
- possibility to use Pyro's own event loop, or integrate it into your own (or third party) event loop.
70
+
- possibility to integrate Pyro's event loop into your own (or third party) event loop.
72
71
- three different possible instance modes for your remote objects (singleton, one per session, one per call).
73
72
- many simple examples included to show various features and techniques.
74
73
- large amount of unit tests and high test coverage.
75
-
- reliable and established: built upon more than 15 years of existing Pyro history, with ongoing support and development.
76
-
77
-
78
-
.. index:: history
79
-
80
-
Pyro's history
81
-
^^^^^^^^^^^^^^
82
-
I started working on the first Pyro version in 1998, when remote method invocation technology such as Java's RMI
83
-
and CORBA were quite popular. I wanted something like that in Python and there was nothing available, so I decided
84
-
to write my own. Over the years it slowly gained features till it reached version 3.10 or so.
85
-
At that point it was clear that the code base had become quite ancient and couldn't reliably support any new features,
86
-
so Pyro4 was born in early 2010, written from scratch.
87
-
88
-
``Pyro`` is the package name of the old and no longer supported 3.x version of Pyro.
89
-
``Pyro4`` is the package name of the current version. Its concepts are similar to Pyro 3.x but it is not
90
-
backwards compatible. To avoid conflicts, this version has a different package name.
91
-
92
-
If you're somehow still interested in the old version, here is `its git repo <https://github.com/irmen/Pyro3>`_
93
-
and it is also still `available on PyPi <http://pypi.python.org/pypi/Pyro/>`_ -- but don't use it unless
94
-
you really have to.
74
+
- reliable and established: built upon more than 20 years of existing Pyro history, with ongoing support and development.
95
75
96
76
97
77
.. index:: usage
@@ -144,34 +124,34 @@ Here, we're making a simple greeting service that will return a personalized gre
144
124
First let's see the server code::
145
125
146
126
# saved as greeting-server.py
147
-
import Pyro4
127
+
import Pyro5.api
148
128
149
-
@Pyro4.expose
129
+
@Pyro5.api.expose
150
130
class GreetingMaker(object):
151
131
def get_fortune(self, name):
152
132
return "Hello, {0}. Here is your fortune message:\n" \
153
133
"Behold the warranty -- the bold print giveth and the fine print taketh away.".format(name)
154
134
155
-
daemon = Pyro4.Daemon() # make a Pyro daemon
156
-
uri = daemon.register(GreetingMaker) # register the greeting maker as a Pyro object
135
+
daemon = Pyro5.api.Daemon() # make a Pyro daemon
136
+
uri = daemon.register(GreetingMaker) # register the greeting maker as a Pyro object
157
137
158
-
print("Ready. Object uri =", uri) # print the uri so we can use it in the client later
159
-
daemon.requestLoop() # start the event loop of the server to wait for calls
138
+
print("Ready. Object uri =", uri) # print the uri so we can use it in the client later
139
+
daemon.requestLoop() # start the event loop of the server to wait for calls
160
140
161
141
Open a console window and start the greeting server::
162
142
163
143
$ python greeting-server.py
164
-
Ready. Object uri = PYRO:obj_edb9e53007ce4713b371d0dc6a177955@localhost:51681
144
+
Ready. Object uri = PYRO:obj_fbfd1d6f83e44728b4bf89b9466965d5@localhost:35845
165
145
166
146
Great, our server is running. Let's see the client code that invokes the server::
167
147
168
148
# saved as greeting-client.py
169
-
import Pyro4
149
+
import Pyro5.api
170
150
171
151
uri = input("What is the Pyro uri of the greeting object? ").strip()
172
152
name = input("What is your name? ").strip()
173
153
174
-
greeting_maker = Pyro4.Proxy(uri) # get a Pyro proxy to the greeting object
154
+
greeting_maker = Pyro5.api.Proxy(uri) # get a Pyro proxy to the greeting object
0 commit comments