Skip to content

Commit f8e199d

Browse files
committed
started converting manual
1 parent df0f6c8 commit f8e199d

18 files changed

+265
-362
lines changed

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2016 Irmen de Jong
3+
Copyright (c) Irmen de Jong
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

docs/source/api.rst

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2+
3+
**@TODO: UPDATE THIS MANUAL CHAPTER FROM Pyro4 TO Pyro5**
4+
5+
16
*****************
27
Pyro5 library API
38
*****************

docs/source/changelog.rst

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Change Log
99
- the 4 custom class (un)register methods on the SerializerBase class are now also directly available in the api module
1010

1111

12+
1213
**Pyro 5.9.2**
1314

1415
- fixed a silent error in the server when doing error handling (avoid calling getpeername() which may fail)

docs/source/clientcode.rst

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2+
3+
**@TODO: UPDATE THIS MANUAL CHAPTER FROM Pyro4 TO Pyro5**
4+
5+
16
.. index:: client code, calling remote objects
27

38
*******************************

docs/source/commandline.rst

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2+
3+
**@TODO: UPDATE THIS MANUAL CHAPTER FROM Pyro4 TO Pyro5**
4+
5+
16
.. index:: command line tools
27

38
.. _command-line:

docs/source/config.rst

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2+
3+
**@TODO: UPDATE THIS MANUAL CHAPTER FROM Pyro4 TO Pyro5**
4+
5+
16
.. index:: configuration
27

38
****************

docs/source/errors.rst

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2+
3+
**@TODO: UPDATE THIS MANUAL CHAPTER FROM Pyro4 TO Pyro5**
4+
5+
16
.. index:: exceptions, remote traceback
27

38
********************************

docs/source/index.rst

+6-12
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,22 @@ Pyro - Python Remote Objects - |version|
77
:alt: PYRO logo
88

99

10-
**@TODO: THIS MANUAL IS STILL BEING UPDATED FROM Pyro4 TO Pyro5**
11-
12-
1310
.. index:: what is Pyro
1411

1512
What is Pyro?
1613
-------------
17-
It is a library that enables you to build applications in which
14+
A library that enables you to build applications in which
1815
objects can talk to each other over the network, with minimal programming effort.
19-
You can just use normal Python method calls to call objects on other machines.
16+
You can just use normal Python method calls to call objects running on other machines.
2017
Pyro is a pure Python library and runs on many different platforms and Python versions.
2118

2219
Pyro is copyright © Irmen de Jong ([email protected] | http://www.razorvine.net). Please read :doc:`license`.
2320

24-
Pyro can be found on Pypi as `Pyro5 <http://pypi.python.org/pypi/Pyro5/>`_. Source on Github: https://github.com/irmen/Pyro5
25-
26-
Pyro5 is the new major version of Pyro, and this is where new features and changes will appear.
27-
Even though the API is pretty mature and extensible, there is no guarantee that no breaking API changes
28-
will occur in new versions to support possible new features or improvements.
21+
Pyro can be found on Pypi as `Pyro5 <http://pypi.python.org/pypi/Pyro5/>`_. Source is on Github: https://github.com/irmen/Pyro5
2922

30-
If you absolutely require a stable API, consider using `Pyro4 <http://pypi.python.org/pypi/Pyro4/>`_ for production code for now.
31-
Pyro4 is in maintenance mode and only gets important bug fixes and security fixes, and no new features or other changes.
23+
Pyro5 is the current version of Pyro. `Pyro4 <https://pyro4.readthedocs.io/>`_ is the predecessor
24+
that only gets important bugfixes and security fixes, but is otherwise no longer being improved.
25+
New code should use Pyro5 if at all possible.
3226

3327

3428
.. toctree::

docs/source/install.rst

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2+
3+
**@TODO: UPDATE THIS MANUAL CHAPTER FROM Pyro4 TO Pyro5**
4+
5+
16
.. index:: installing Pyro
27

38
***************

docs/source/intro.rst

+44-72
Original file line numberDiff line numberDiff line change
@@ -8,39 +8,39 @@ Intro and Example
88
This chapter contains a little overview of Pyro's features and a simple example to show how it looks like.
99

1010

11-
Pyro5? Pyro4?
12-
=============
11+
Coming from Pyro4
12+
=================
1313

14-
Pyro5 is the next major version after `Pyro4 <http://pypi.python.org/pypi/Pyro4/>`_.
15-
It borrows most of the concepts of Pyro4, but includes some major improvements.
16-
Using it should be very familiar to current Pyro4 users, but Pyro5 is not compatible with Pyro4 and vice versa.
14+
Pyro5 is the current version. It is based on most of the concepts of Pyro4, but includes some major improvements.
15+
Using it should be very familiar to current Pyro4 users, however Pyro5 is not compatible with Pyro4 and vice versa.
1716
To allow graceful upgrading, both versions can co-exist due to the new package name
18-
(this happened years ago as well when I upgraded Pyro 3 to Pyro4).
17+
(the same happened years ago when Pyro 3 was upgraded to Pyro4).
1918

20-
Pyro5 is the new major version of Pyro, and this is where new features and changes will appear.
21-
Even though the API is pretty mature and extensible, there is no guarantee that no breaking API changes
22-
will occur in new versions to support possible new features or improvements.
19+
Pyro5 requires Python 3.5 or newer. If you're using an onder version of Python, you'll have to stick to Pyro4.
2320

24-
If you absolutely require a stable API, consider using `Pyro4 <http://pypi.python.org/pypi/Pyro4/>`_ for production code for now.
25-
Pyro4 is in maintenance mode and only gets important bug fixes and security fixes, and no new features or other changes.
26-
27-
**Python 2.7:**
28-
Also, if you're still using Python 2.7, you can't use Pyro5 because it requires Python 3.5 or newer.
29-
In this case use Pyro4 as well (or better: upgrade to Python 3.x because 2.7 will be End Of Life after january 2020)
21+
Pyro5 provides a basic backward-compatibility module so much of existing Pyro4 code doesn't have to
22+
change (apart from adding a single import statement).
23+
This only works for code that imported Pyro4 symbols from the Pyro4 module
24+
directly, instead of from one of Pyro4's sub modules. So, for instance:
25+
``from Pyro4 import Proxy`` instead of: ``from Pyro4.core import Proxy``.
26+
*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::
3030

31+
from Pyro5.compatibility import Pyro4
3132

3233

3334
.. index:: features
3435

3536
About Pyro: feature overview
3637
============================
3738

38-
Pyro is a library that enables you to build applications in which
39+
Pyro enables you to build applications in which
3940
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
4242
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
4444
enables you to build distributed applications rapidly and effortlessly.
4545
Pyro is a pure Python library and runs on many different platforms and Python versions.
4646

@@ -63,35 +63,15 @@ Here's a quick overview of Pyro's features:
6363
- batched invocations for greatly enhanced performance of many calls on the same object.
6464
- remote iterator on-demand item streaming avoids having to create large collections upfront and transfer them as a whole.
6565
- 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.
6766
- remote exceptions will be raised in the caller, as if they were local. You can extract detailed remote traceback information.
6867
- 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.
7069
- 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.
7271
- three different possible instance modes for your remote objects (singleton, one per session, one per call).
7372
- many simple examples included to show various features and techniques.
7473
- 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.
9575

9676

9777
.. index:: usage
@@ -144,34 +124,34 @@ Here, we're making a simple greeting service that will return a personalized gre
144124
First let's see the server code::
145125

146126
# saved as greeting-server.py
147-
import Pyro4
127+
import Pyro5.api
148128

149-
@Pyro4.expose
129+
@Pyro5.api.expose
150130
class GreetingMaker(object):
151131
def get_fortune(self, name):
152132
return "Hello, {0}. Here is your fortune message:\n" \
153133
"Behold the warranty -- the bold print giveth and the fine print taketh away.".format(name)
154134

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
157137

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
160140

161141
Open a console window and start the greeting server::
162142

163143
$ python greeting-server.py
164-
Ready. Object uri = PYRO:obj_edb9e53007ce4713b371d0dc6a177955@localhost:51681
144+
Ready. Object uri = PYRO:obj_fbfd1d6f83e44728b4bf89b9466965d5@localhost:35845
165145

166146
Great, our server is running. Let's see the client code that invokes the server::
167147

168148
# saved as greeting-client.py
169-
import Pyro4
149+
import Pyro5.api
170150

171151
uri = input("What is the Pyro uri of the greeting object? ").strip()
172152
name = input("What is your name? ").strip()
173153

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
175155
print(greeting_maker.get_fortune(name)) # call method normally
176156

177157
Start this client program (from a different console window)::
@@ -196,16 +176,16 @@ corresponding uri.
196176
We'll have to modify a few lines in :file:`greeting-server.py` to make it register the object in the name server::
197177

198178
# saved as greeting-server.py
199-
import Pyro4
179+
import Pyro5.api
200180

201-
@Pyro4.expose
181+
@Pyro5.api.expose
202182
class GreetingMaker(object):
203183
def get_fortune(self, name):
204184
return "Hello, {0}. Here is your fortune message:\n" \
205185
"Tomorrow's lucky number is 12345678.".format(name)
206186

207-
daemon = Pyro4.Daemon() # make a Pyro daemon
208-
ns = Pyro4.locateNS() # find the name server
187+
daemon = Pyro5.server.Daemon() # make a Pyro daemon
188+
ns = Pyro5.api.locate_ns() # find the name server
209189
uri = daemon.register(GreetingMaker) # register the greeting maker as a Pyro object
210190
ns.register("example.greeting", uri) # register the object with a name in the name server
211191

@@ -215,26 +195,27 @@ We'll have to modify a few lines in :file:`greeting-server.py` to make it regist
215195
The :file:`greeting-client.py` is actually simpler now because we can use the name server to find the object::
216196

217197
# saved as greeting-client.py
218-
import Pyro4
198+
import Pyro5.api
219199

220200
name = input("What is your name? ").strip()
221201

222-
greeting_maker = Pyro4.Proxy("PYRONAME:example.greeting") # use name server object lookup uri shortcut
202+
greeting_maker = Pyro5.api.Proxy("PYRONAME:example.greeting") # use name server object lookup uri shortcut
223203
print(greeting_maker.get_fortune(name))
224204

225205
The program now needs a Pyro name server that is running. You can start one by typing the
226-
following command: :command:`python -m Pyro4.naming` (or simply: :command:`pyro4-ns`) in a separate console window
206+
following command: :command:`python -m Pyro5.nameserver` (or simply: :command:`pyro5-ns`) in a separate console window
227207
(usually there is just *one* name server running in your network).
228208
After that, start the server and client as before.
229209
There's no need to copy-paste the object uri in the client any longer, it will 'discover'
230210
the server automatically, based on the object name (:kbd:`example.greeting`).
231211
If you want you can check that this name is indeed known in the name server, by typing
232-
the command :command:`python -m Pyro4.nsc list` (or simply: :command:`pyro4-nsc list`), which will produce::
212+
the command :command:`python -m Pyro5.nsc list` (or simply: :command:`pyro5-nsc list`), which will produce::
233213

234-
$ pyro4-nsc list
214+
$ pyro5-nsc list
235215
--------START LIST
236216
Pyro.NameServer --> PYRO:Pyro.NameServer@localhost:9090
237-
example.greeting --> PYRO:obj_663a31d2dde54b00bfe52ec2557d4f4f@localhost:51707
217+
metadata: {'class:Pyro5.nameserver.NameServer'}
218+
example.greeting --> PYRO:obj_198af10aa51f4fa8ab54062e65fad96a@localhost:44687
238219
--------END LIST
239220

240221
(Once again the uri for our object will be random)
@@ -258,21 +239,12 @@ and the server code details: :ref:`publish-objects`. The use of the name server
258239

259240
Performance
260241
===========
261-
Pyro4 is pretty fast. On a typical networked system you can expect:
262-
263-
- a few hundred new proxy connections per second to one server
264-
- similarly, a few hundred initial remote calls per second to one server
265-
- a few thousand remote method calls per second on a single proxy
266-
- tens of thousands batched or oneway remote calls per second
267-
- 10-100 Mb/sec data transfer
268-
269-
Results do vary depending on many factors such as:
242+
Pyro is pretty fast, but speed depends largely on many external factors:
270243

271-
- network speed
244+
- network connection speed
272245
- machine and operating system
273246
- I/O or CPU bound workload
274247
- contents and size of the pyro call request and response messages
275248
- the serializer being used
276-
- python version being used
277249

278250
Experiment with the ``benchmark``, ``batchedcalls`` and ``hugetransfer`` examples to see what results you get on your own setup.

docs/source/license.rst

+18-21
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,32 @@
1+
12
.. index:: software license, license, disclaimer
23

34
*******************************
45
Software License and Disclaimer
56
*******************************
67

7-
Pyro - Python Remote Objects - version 5.x
8-
9-
Pyro is Copyright (c) by Irmen de Jong ([email protected]).
10-
11-
Permission is hereby granted, free of charge, to any person obtaining a copy
12-
of this software and associated documentation files (the "Software"), to deal
13-
in the Software without restriction, including without limitation the rights
14-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15-
copies of the Software, and to permit persons to whom the Software is
16-
furnished to do so, subject to the following conditions:
8+
Pyro - Python Remote Objects - version 5.x - Copyright (c) by Irmen de Jong ([email protected]).
179

18-
The above copyright notice and this permission notice shall be included in
19-
all copies or substantial portions of the Software.
10+
Pyro is licensed under the `MIT Software License <http://www.opensource.org/licenses/mit-license.php>`_:
2011

21-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27-
SOFTWARE.
2812

13+
Permission is hereby granted, free of charge, to any person obtaining a copy
14+
of this software and associated documentation files (the "Software"), to deal
15+
in the Software without restriction, including without limitation the rights
16+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17+
copies of the Software, and to permit persons to whom the Software is
18+
furnished to do so, subject to the following conditions:
2919

30-
This is the `MIT Software License <http://www.opensource.org/licenses/mit-license.php>`_
31-
which is OSI-certified, and GPL-compatible.
20+
The above copyright notice and this permission notice shall be included in all
21+
copies or substantial portions of the Software.
3222

23+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29+
SOFTWARE.
3330

3431

3532
.. figure:: _static/tf_pyrotaunt.png

0 commit comments

Comments
 (0)