diff --git a/doc/source/install.rst b/doc/source/install.rst index b3b5945cc515e..98443ede2e965 100644 --- a/doc/source/install.rst +++ b/doc/source/install.rst @@ -281,7 +281,6 @@ Optional Dependencies `qtpy `__ (requires PyQt or PySide), `PyQt5 `__, `PyQt4 `__, - `pygtk `__, `xsel `__, or `xclip `__: necessary to use :func:`~pandas.read_clipboard`. Most package managers on Linux distributions will have ``xclip`` and/or ``xsel`` immediately available for installation. diff --git a/doc/source/user_guide/io.rst b/doc/source/user_guide/io.rst index 88d8ccbbe036e..4aacb6fa1e278 100644 --- a/doc/source/user_guide/io.rst +++ b/doc/source/user_guide/io.rst @@ -3272,7 +3272,7 @@ We can see that we got the same content back, which we had earlier written to th .. note:: - You may need to install xclip or xsel (with gtk, PyQt5, PyQt4 or qtpy) on Linux to use these methods. + You may need to install xclip or xsel (with PyQt5, PyQt4 or qtpy) on Linux to use these methods. .. _io.pickle: diff --git a/doc/source/whatsnew/v0.25.0.rst b/doc/source/whatsnew/v0.25.0.rst index 89a9da4a73b35..65ef332b4122c 100644 --- a/doc/source/whatsnew/v0.25.0.rst +++ b/doc/source/whatsnew/v0.25.0.rst @@ -334,6 +334,7 @@ Other API Changes - The ``arg`` argument in :meth:`pandas.core.groupby.DataFrameGroupBy.agg` has been renamed to ``func`` (:issue:`26089`) - The ``arg`` argument in :meth:`pandas.core.window._Window.aggregate` has been renamed to ``func`` (:issue:`26372`) - Most Pandas classes had a ``__bytes__`` method, which was used for getting a python2-style bytestring representation of the object. This method has been removed as a part of dropping Python2 (:issue:`26447`) +- Removed support of gtk package for clipboards (:issue:`26563`) .. _whatsnew_0250.deprecations: diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 87db069d94893..9c671b2d3bb34 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -2679,7 +2679,7 @@ def to_clipboard(self, excel=True, sep=None, **kwargs): ----- Requirements for your platform. - - Linux : `xclip`, or `xsel` (with `gtk` or `PyQt4` modules) + - Linux : `xclip`, or `xsel` (with `PyQt4` modules) - Windows : none - OS X : none diff --git a/pandas/io/clipboard/__init__.py b/pandas/io/clipboard/__init__.py index b76a843e3e7f2..2063978c76c5a 100644 --- a/pandas/io/clipboard/__init__.py +++ b/pandas/io/clipboard/__init__.py @@ -18,21 +18,19 @@ On Linux, install xclip or xsel via package manager. For example, in Debian: sudo apt-get install xclip -Otherwise on Linux, you will need the gtk, qtpy or PyQt modules installed. +Otherwise on Linux, you will need the qtpy or PyQt modules installed. qtpy also requires a python-qt-bindings module: PyQt4, PyQt5, PySide, PySide2 -gtk and PyQt4 modules are not available for Python 3, -and this module does not work with PyGObject yet. +This module does not work with PyGObject yet. """ __version__ = '1.5.27' import platform import os import subprocess -from .clipboards import (init_osx_clipboard, - init_gtk_clipboard, init_qt_clipboard, - init_xclip_clipboard, init_xsel_clipboard, - init_klipper_clipboard, init_no_clipboard) +from .clipboards import ( + init_osx_clipboard, init_qt_clipboard, init_xclip_clipboard, + init_xsel_clipboard, init_klipper_clipboard, init_no_clipboard) from .windows import init_windows_clipboard # `import qtpy` sys.exit()s if DISPLAY is not in the environment. @@ -60,14 +58,6 @@ def determine_clipboard(): return init_osx_clipboard() if HAS_DISPLAY: # Determine which command/module is installed, if any. - try: - # Check if gtk is installed - import gtk # noqa - except ImportError: - pass - else: - return init_gtk_clipboard() - try: # qtpy is a small abstraction layer that lets you write # applications using a single api call to either PyQt or PySide @@ -104,7 +94,6 @@ def set_clipboard(clipboard): global copy, paste clipboard_types = {'osx': init_osx_clipboard, - 'gtk': init_gtk_clipboard, 'qt': init_qt_clipboard, 'xclip': init_xclip_clipboard, 'xsel': init_xsel_clipboard, diff --git a/pandas/io/clipboard/clipboards.py b/pandas/io/clipboard/clipboards.py index 66e2e35bf0c59..52abdeafb5ecc 100644 --- a/pandas/io/clipboard/clipboards.py +++ b/pandas/io/clipboard/clipboards.py @@ -22,22 +22,6 @@ def paste_osx(): return copy_osx, paste_osx -def init_gtk_clipboard(): - import gtk - - def copy_gtk(text): - global cb - cb = gtk.Clipboard() - cb.set_text(text) - cb.store() - - def paste_gtk(): - clipboardContents = gtk.Clipboard().wait_for_text() - return clipboardContents - - return copy_gtk, paste_gtk - - def init_qt_clipboard(): # $DISPLAY should exist diff --git a/pandas/io/clipboards.py b/pandas/io/clipboards.py index be1256edf7afe..dc30285895dd5 100644 --- a/pandas/io/clipboards.py +++ b/pandas/io/clipboards.py @@ -91,7 +91,7 @@ def to_clipboard(obj, excel=True, sep=None, **kwargs): # pragma: no cover Notes ----- Requirements for your platform - - Linux: xclip, or xsel (with gtk or PyQt4 modules) + - Linux: xclip, or xsel (with PyQt4 modules) - Windows: - OS X: """