From 0986e716cfc6714251028f482d2bb1fb6a34364e 2012-10-14 20:56:23 From: Sean Vig Date: 2012-10-14 20:56:23 Subject: [PATCH] Add deprecation warnings for sympyprinting The sympyprinting extension has been moved to SymPy as of version 0.7.2. For versions containing the new extension, print a deprecation warning and load the extension from SymPy. --- diff --git a/IPython/extensions/sympyprinting.py b/IPython/extensions/sympyprinting.py index 409ebd7..5a2087f 100644 --- a/IPython/extensions/sympyprinting.py +++ b/IPython/extensions/sympyprinting.py @@ -9,6 +9,11 @@ Usage Once the extension is loaded, Sympy Basic objects are automatically pretty-printed. +As of SymPy 0.7.2, maintenance of this extension has moved to SymPy under +sympy.interactive.ipythonprinting, any modifications to account for changes to +SymPy should be submitted to SymPy rather than changed here. This module is +maintained here for backwards compatablitiy with old SymPy versions. + """ #----------------------------------------------------------------------------- # Copyright (C) 2008 The IPython Development Team @@ -30,6 +35,8 @@ try: except ImportError: pass +import warnings + #----------------------------------------------------------------------------- # Definitions of special display functions for use with IPython #----------------------------------------------------------------------------- @@ -101,6 +108,19 @@ _loaded = False def load_ipython_extension(ip): """Load the extension in IPython.""" import sympy + + # sympyprinting extension has been moved to SymPy as of 0.7.2, if it + # exists there, warn the user and import it + try: + import sympy.interactive.ipythonprinting + except ImportError: + pass + else: + warnings.warn("The sympyprinting extension in IPython is deprecated, " + "use sympy.interactive.ipythonprinting") + ip.extension_manager.load_extension('sympy.interactive.ipythonprinting') + return + global _loaded if not _loaded: plaintext_formatter = ip.display_formatter.formatters['text/plain']