Skip to content

Commit 66bd94e

Browse files
committed
release 5.4
1 parent f0d3adb commit 66bd94e

9 files changed

+29
-14
lines changed

Pyro5/serializers.py

+11-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@
1616
import marshal
1717
import json
1818
import serpent
19-
import msgpack
19+
try:
20+
import msgpack
21+
if msgpack.version < (0, 5, 2):
22+
raise RuntimeError("requires msgpack 0.5.2 or better")
23+
except ImportError:
24+
msgpack = None
2025
from . import errors
2126

2227
__all__ = ["SerializerBase", "SerpentSerializer", "JsonSerializer", "MarshalSerializer", "MsgpackSerializer",
@@ -33,9 +38,6 @@
3338
if ver < (1, 27):
3439
raise RuntimeError("requires serpent 1.27 or better")
3540

36-
if msgpack.version < (0, 5, 2):
37-
raise RuntimeError("requires msgpack 0.5.2 or better")
38-
3941

4042
all_exceptions = {}
4143
for name, t in vars(builtins).items():
@@ -494,9 +496,12 @@ def register_type_replacement(cls, object_type, replacement_function):
494496
serializers = {
495497
"serpent": SerpentSerializer(),
496498
"marshal": MarshalSerializer(),
497-
"json": JsonSerializer(),
498-
"msgpack": MsgpackSerializer()
499+
"json": JsonSerializer()
499500
}
500501

502+
if msgpack:
503+
serializers["msgpack"] = MsgpackSerializer()
504+
505+
501506
"""The available serializers by their internal id"""
502507
serializers_by_id = {ser.serializer_id: ser for ser in serializers.values()}

docs/source/changelog.rst

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
Change Log
33
**********
44

5+
**Pyro 5.5**
6+
7+
- made msgpack serializer optional
8+
9+
510
**Pyro 5.4**
611

712
- made the decision that Pyro5 will require Python 3.5 or newer, and won't support Python 2.7 (which will be EOL in january 2020)

docs/source/config.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ SOCK_REUSE bool True Should SO_REUSEADDR be
100100
PREFER_IP_VERSION int 4 The IP address type that is preferred (4=ipv4, 6=ipv6, 0=let OS decide).
101101
THREADPOOL_SIZE int 40 For the thread pool server: maximum number of threads running
102102
THREADPOOL_SIZE_MIN int 4 For the thread pool server: minimum number of threads running
103-
SERIALIZER str serpent The wire protocol serializer to use for clients/proxies (one of: serpent, json, marshal, msgpack, pickle, cloudpickle, dill)
103+
SERIALIZER str serpent The wire protocol serializer to use for clients/proxies (one of: serpent, json, marshal, msgpack)
104104
SERIALIZERS_ACCEPTED set json,marshal,serpent The wire protocol serializers accepted in the server/daemon. In your code it should be a set of strings,
105105
use a comma separated string instead when setting the shell environment variable.
106106
PICKLE_PROTOCOL_VERSION int highest possible The pickle protocol version to use, if pickle is selected as serializer. Defaults to pickle.HIGHEST_PROTOCOL

docs/source/install.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ Third party libraries that Pyro5 uses
4747
`serpent <https://pypi.python.org/pypi/serpent>`_ - required, 1.27 or newer
4848
Should be installed automatically when you install Pyro.
4949

50-
`msgpack <https://pypi.python.org/pypi/msgpack>`_ - required (for now, may become optional), 0.5.2 or newer
50+
`msgpack <https://pypi.python.org/pypi/msgpack>`_ - optional, 0.5.2 or newer
5151
Install this to use the msgpack serializer.
52-
Right now it is required, and should be installed automatically when you install Pyro.
5352

5453

5554
Stuff you get extra in the source distribution archive and not with packaged versions

requirements.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
serpent>=1.27
2-
msgpack>=0.5.2

setup.cfg

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ include_package_data = False
3232
packages = Pyro5, Pyro5.utils, Pyro5.compatibility
3333
install_requires =
3434
serpent>=1.27
35-
msgpack>=0.5.2
3635
setup_requires =
3736
pytest-runner
3837
test_require =

test-requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
serpent>=1.27
2+
msgpack>=0.5.2

tests/test_serialize.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,11 @@ class TestJsonSerializer(TestSerpentSerializer):
9292
serializer = Pyro5.serializers.serializers["json"]
9393

9494

95-
class TestMsgpackSerializer(TestSerpentSerializer):
96-
serializer = Pyro5.serializers.serializers["msgpack"]
95+
try:
96+
import msgpack
97+
98+
class TestMsgpackSerializer(TestSerpentSerializer):
99+
serializer = Pyro5.serializers.serializers["msgpack"]
100+
101+
except ImportError:
102+
pass

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ envlist=py35,py36,py37,py38,pypy3
33

44
[testenv]
55
deps=
6-
-rrequirements.txt
6+
-rtest-requirements.txt
77
pytest
88
setenv=
99
PYTHONPATH={toxinidir}

0 commit comments

Comments
 (0)