-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update clipboard Qt-bindings for flexiblity and Python3 compatibility #17723
Conversation
…r the clipboard. This should prevent any conflicts with other qt-bindings packages when embedding pandas in a Qt-based gui and should also provide compatibility with Python3 since PyQt4 may not be available for the latest releases.
Codecov Report
@@ Coverage Diff @@
## master #17723 +/- ##
==========================================
- Coverage 91.35% 91.29% -0.06%
==========================================
Files 163 164 +1
Lines 49695 49747 +52
==========================================
+ Hits 45401 45419 +18
- Misses 4294 4328 +34
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll also want to update doc/source/install.rst
under Optional Dependencies
pandas/io/clipboard/__init__.py
Outdated
# Check if PyQt4 is installed | ||
import PyQt4 # noqa | ||
# Check if qtpy is installed | ||
import qtpy # noqa |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this fall back to PyQt4
if qtpy
isn't available? I'm Ok with making qtpy
the default, but we don't want to break a user's install that just has PyQt4.
Should update |
I will make all these updates within a couple of days |
pandas/io/clipboard/clipboards.py
Outdated
|
||
def copy_qt(text): | ||
cb = app.clipboard() | ||
cb.setText(text) | ||
|
||
def paste_qt(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you remove this?
@asweigart just pushed some commits to pyperclip, more than I was tackling here, but I reverted the code to his latest commits regarding this issue. Behavior now is to import qtpy, then PyQt5 if that fails, then PyQt4 if that fails. Should not break for anyone who was using this functionality previously. Documentation was also updated as requested. I am waiting for CI checks to pass, and will check back to make sure that they do |
switched to vim key-binding recently, getting used to it, but it throws me
off once in awhile. I added it back
…On Mon, Oct 30, 2017 at 7:50 AM, Jeff Reback ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In pandas/io/clipboard/clipboards.py
<#17723 (comment)>:
>
def copy_qt(text):
cb = app.clipboard()
cb.setText(text)
- def paste_qt():
why did you remove this?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#17723 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJaj13JjJSeVHQUuXG77-5w_ne_G-GCzks5sxcX8gaJpZM4PpDks>
.
|
it appears I violated style standards with 2 greater than 80 character lines. I should have read the contribution documentation more carefully. Apologies, I will review that, fix the lines, and update. |
…import statements
ideally would like to enhance 1 or more of our CI builds to use qtpy. Some of them are already testing via xsel/python-gtk2. they are a bit flaky though. can you add in pyqt to a couple of builds (that don't otherwise add the x selections). the clipboard tests themselves exercise this. |
@jreback, I've never done that, but in the spirit of learning I will try, but will be careful before making any changes. On a second note, the last round of tests failed because ModuleNotFoundError was not recognized as a valid exception. Why is that? I changed the exception to be ImportError instead, which is valid and should work, but I was wondering why the error with ModuleNotFoundError. |
|
I'm coming here from spyder-ide/spyder#5795. This problem is also generating odd errors for us in Spyder, so I want to chime in to see when this is going to be merged and if there's something I can do to help with. @jreback and @TomAugspurger, I think Pandas should depend directly on Besides, it would be easier to handle future renames or changes in Qt by depending on |
Thanks. I don't think adding qtpy as a dependency is worthwhile, since @dvincentwest could you add a release note? I think in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to add qtpy to the ci/requirements-3.6_BUILD_TEST.sh
@@ -251,7 +251,8 @@ Optional Dependencies | |||
* `Jinja2 <http://jinja.pocoo.org/>`__: Template engine for conditional HTML formatting. | |||
* `s3fs <http://s3fs.readthedocs.io/>`__: necessary for Amazon S3 access (s3fs >= 0.0.7). | |||
* `blosc <https://pypi.python.org/pypi/blosc>`__: for msgpack compression using ``blosc`` | |||
* One of `PyQt4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can list qtpy here as well
doc/source/whatsnew/v0.22.0.txt
Outdated
@@ -127,6 +127,7 @@ I/O | |||
- Bug in :func:`read_msgpack` with a non existent file is passed in Python 2 (:issue:`15296`) | |||
- Bug in :func:`read_csv` where a ``MultiIndex`` with duplicate columns was not being mangled appropriately (:issue:`18062`) | |||
- Bug in :func:`read_sas` where a file with 0 variables gave an ``AttributeError`` incorrectly. Now it gives an ``EmptyDataError`` (:issue:`18184`) | |||
- :func:`pandas.read_clipboard` updated to use qtpy, falling back to PyQt5 and then PyQt4, adding compatibility with Python3 and multiple python-qt bindings (:issue:`17722`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move to other enhancements
does installing |
No, qtpy is only a compatibility later so that you can write bindings agnostic applications. It still requires either Pyqt(4 or 5) or Pyside(1 or 2) |
ok can you make that clear in the install.rst instructions. also do add to one of the ci builds. |
yes, I will try to get this done tomorrow... |
@jreback @TomAugspurger , the Python 2.7 appveyor build appears to have gone over the 1 hour time-limit. I am not sure why, and I don't really know what to do about that next. I did add pyqt (conda label for PyQt5) and qtpy to the |
thanks @dvincentwest |
And my thanks to you guys for maintaining the project |
This should prevent any conflicts with other qt-bindings packages when embedding pandas in a Qt-based gui and should also provide compatibility with Python3 since PyQt4 may not be available for the latest releases.