2424__all__ = [
2525 'DocstringDict' , 'first_item' , 'common_ancestor' , 'paths_common_ancestor' ,
2626 'vivification' , 'vivified_to_dict' , 'message_box' , 'is_colour_installed' ,
27- 'is_networkx_installed ' , 'is_opencolorio_installed ' ,
28- 'REQUIREMENTS_TO_CALLABLE ' , 'required ' , 'is_string' , 'is_iterable ' ,
29- 'git_describe'
27+ 'is_jsonpickle_installed ' , 'is_networkx_installed ' ,
28+ 'is_opencolorio_installed ' , 'REQUIREMENTS_TO_CALLABLE ' , 'required ' ,
29+ 'is_string' , 'is_iterable' , ' git_describe'
3030]
3131
3232
@@ -285,6 +285,38 @@ def is_colour_installed(raise_exception=False):
285285 return False
286286
287287
288+ def is_jsonpickle_installed (raise_exception = False ):
289+ """
290+ Returns if *jsonpickle* is installed and available.
291+
292+ Parameters
293+ ----------
294+ raise_exception : bool
295+ Raise exception if *jsonpickle* is unavailable.
296+
297+ Returns
298+ -------
299+ bool
300+ Is *jsonpickle* installed.
301+
302+ Raises
303+ ------
304+ ImportError
305+ If *jsonpickle* is not installed.
306+ """
307+
308+ try : # pragma: no cover
309+ import jsonpickle # noqa
310+
311+ return True
312+ except ImportError as error : # pragma: no cover
313+ if raise_exception :
314+ raise ImportError (
315+ ('"jsonpickle" related API features, e.g. serialization, '
316+ 'are not available: "{0}".' ).format (error ))
317+ return False
318+
319+
288320def is_networkx_installed (raise_exception = False ):
289321 """
290322 Returns if *NetworkX* is installed and available.
@@ -351,6 +383,8 @@ def is_opencolorio_installed(raise_exception=False):
351383REQUIREMENTS_TO_CALLABLE = DocstringDict ({
352384 'Colour' :
353385 is_colour_installed ,
386+ 'jsonpickle' :
387+ is_jsonpickle_installed ,
354388 'NetworkX' :
355389 is_networkx_installed ,
356390 'OpenColorIO' :
@@ -360,7 +394,7 @@ def is_opencolorio_installed(raise_exception=False):
360394Mapping of requirements to their respective callables.
361395
362396_REQUIREMENTS_TO_CALLABLE : CaseInsensitiveMapping
363- **{'Colour', 'NetworkX', 'OpenImageIO'}**
397+ **{'Colour', 'jsonpickle', ' NetworkX', 'OpenImageIO'}**
364398"""
365399
366400
0 commit comments