Skip to content
This repository has been archived by the owner on Apr 10, 2023. It is now read-only.

Commit

Permalink
Use 'simplejson' package if available (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
rossmacarthur authored Jan 22, 2019
1 parent fd12e4a commit 2cb982b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
13 changes: 13 additions & 0 deletions RELEASES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
Releases
========

0.4.1
-----

*Unreleased*

- Use 'simplejson' package if available. (`#60`_, `#63`_)
- Fix a bug where Choice Field didn't call super().validate(). (`#62`_)

.. _#63: /~https://github.com/rossmacarthur/serde/pull/63
.. _#62: /~https://github.com/rossmacarthur/serde/pull/62

.. _#60: /~https://github.com/rossmacarthur/serde/issues/60

0.4.0
-----

Expand Down
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ def get_metadata():
'six >=1.0.0, <2.0.0',
'validators >=0.12.0, <0.13.0'
]
json_requires = [
'simplejson >=3.0.0, <4.0.0'
]
toml_requires = [
'toml >=0.10.0, <0.11.0'
]
Expand Down Expand Up @@ -67,6 +70,7 @@ def get_metadata():
# Options
install_requires=install_requires,
extras_require={
'json': json_requires,
'toml': toml_requires,
'yaml': yaml_requires,
'dev.lint': lint_requires,
Expand Down
6 changes: 5 additions & 1 deletion src/serde/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
"""

import json
from collections import OrderedDict
from contextlib import contextmanager
from functools import wraps
Expand All @@ -84,6 +83,11 @@
from serde.utils import dict_partition, try_import, zip_until_right


try:
import simplejson as json
except ImportError:
import json

toml = try_import('toml')
yaml = try_import('ruamel.yaml')

Expand Down

0 comments on commit 2cb982b

Please sign in to comment.