diff --git a/conftest.py b/conftest.py index 121d2023c5..adbed5d872 100644 --- a/conftest.py +++ b/conftest.py @@ -1,7 +1,7 @@ import pytest # This file lists files which should be ignored by pytest -collect_ignore = ["setup.py", "sopel.py", "sopel/modules/ipython.py"] +collect_ignore = ["setup.py", "sopel.py"] def pytest_addoption(parser): diff --git a/contrib/suppress-warnings.py b/contrib/suppress-warnings.py deleted file mode 100644 index 61484fb84c..0000000000 --- a/contrib/suppress-warnings.py +++ /dev/null @@ -1,5 +0,0 @@ -# coding=utf-8 -# suppress-warnings.py -# Suppress iPython's DeprecationWarnings on Sopel start -import warnings -warnings.filterwarnings('ignore') diff --git a/requirements.txt b/requirements.txt index 58e64805e6..1dc6fefea1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,9 +5,6 @@ geoip2 aspell-python-py2; python_version < '3' aspell-python-py3; python_version >= '3' ipaddress<2.0; python_version < '3.3' -ipython<6.0; python_version < '3.3' -ipython>=6.0,<7.0; python_version >= '3.3' and python_version < '3.5' -ipython>=7.0,<8.0; python_version >= '3.5' requests>=2.0.0,<3.0.0 dnspython<2.0; python_version >= '2.7' and python_version < '3.0' dnspython<1.16.0; python_version == '3.3' diff --git a/sopel/modules/ipython.py b/sopel/modules/ipython.py deleted file mode 100644 index 51fb266c2f..0000000000 --- a/sopel/modules/ipython.py +++ /dev/null @@ -1,79 +0,0 @@ -# coding=utf-8 -""" -ipython.py - Sopel IPython Console Module -Copyright © 2014, Elad Alfassa -Licensed under the Eiffel Forum License 2. - -https://sopel.chat -""" -from __future__ import unicode_literals, absolute_import, print_function, division - -import sys - -import sopel -import sopel.module - -if sys.version_info.major >= 3: - # Backup stderr/stdout wrappers - old_stdout = sys.stdout - old_stderr = sys.stderr - - # IPython wants actual stderr and stdout. In Python 2, it only needed that - # when actually starting the console, but in Python 3 it seems to need that - # on import as well - sys.stdout = sys.__stdout__ - sys.stderr = sys.__stderr__ -try: - import IPython - if hasattr(IPython, 'terminal'): - from IPython.terminal.embed import InteractiveShellEmbed - else: - from IPython.frontend.terminal.embed import InteractiveShellEmbed -finally: - if sys.version_info.major >= 3: - # Restore stderr/stdout wrappers - sys.stdout = old_stdout - sys.stderr = old_stderr - - -console = None - - -@sopel.module.commands('console') -@sopel.module.require_admin('Only admins can start the interactive console') -def interactive_shell(bot, trigger): - """Starts an interactive IPython console""" - global console - if bot.memory.get('iconsole_running', False): - bot.say('Console already running') - return - if not sys.__stdout__.isatty(): - bot.say('A tty is required to start the console') - return - if bot._daemon: - bot.say('Can\'t start console when running as a daemon') - return - - # Backup stderr/stdout wrappers - old_stdout = sys.stdout - old_stderr = sys.stderr - - # IPython wants actual stderr and stdout - sys.stdout = sys.__stdout__ - sys.stderr = sys.__stderr__ - - banner1 = 'Sopel interactive shell (embedded IPython)' - banner2 = '`bot` and `trigger` are available. To exit, type exit' - exitmsg = 'Interactive shell closed' - - console = InteractiveShellEmbed(banner1=banner1, banner2=banner2, - exit_msg=exitmsg) - - bot.memory['iconsole_running'] = True - bot.say('console started') - console() - bot.memory['iconsole_running'] = False - - # Restore stderr/stdout wrappers - sys.stdout = old_stdout - sys.stderr = old_stderr