Skip to content

pyperclip upgrade #28471

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

Merged
merged 8 commits into from
Nov 7, 2019
Merged

pyperclip upgrade #28471

merged 8 commits into from
Nov 7, 2019

Conversation

krey
Copy link
Contributor

@krey krey commented Sep 16, 2019

@jbrockmendel
Copy link
Member

are there any tests to go with this?

@krey
Copy link
Contributor Author

krey commented Sep 16, 2019

are there any tests to go with this?

We could add pyperclip's tests to pandas'.

I'm not sure of a specific way to test #22707

@jbrockmendel
Copy link
Member

Looks like CI is failing because an Exception subclass was removed from pandas.io.clipboard.exceptions import PyperclipException

@krey krey force-pushed the master branch 3 times, most recently from 971200b to 3acd9df Compare September 17, 2019 00:00
@WillAyd
Copy link
Member

WillAyd commented Sep 17, 2019

What's the reasoning behind moving everything out of submodules into one __init__? Also can you explain the PR you are undoing from the OP? Is that a revived package now?

@krey
Copy link
Contributor Author

krey commented Sep 17, 2019

What's the reasoning behind moving everything out of submodules into one __init__?

I don't know why they changed pyperclip that way.

Also can you explain the PR you are undoing from the OP?

I don't mind doing a manual merge if needed, but I wasn't sure if it mattered.

Is that a revived package now?

Not to my knowledge.

@krey
Copy link
Contributor Author

krey commented Sep 17, 2019

Honestly I'm not even sure why __init__.py isn't just

from pyperclip import copy, paste
clipboard_get = paste
clipboard_set = copy

or something to that effect.

Is it to reduce the number of dependencies?

Or purely historical reasons?

@WillAyd
Copy link
Member

WillAyd commented Sep 17, 2019

Have to excuse my ignorance on this part of the codebase - I wasn't even aware we vendored this :-) OK I think I'm on board with this, since it's just an update to 1.7.0.

Can you check if this also solves #11720 ? cc @datapythonista as well for #26887

@WillAyd WillAyd added the IO Data IO issues that don't fit into a more specific label label Sep 17, 2019
@WillAyd WillAyd added this to the 1.0 milestone Sep 17, 2019
Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add a whatsnew for v1.0.0?

@datapythonista
Copy link
Member

I'm not sure if the clipboard tests are running in the CI, so we need to be very careful here. I fixed it in #26949, but it made the tests be much slower, and the PR wasn't finally merged. Not sure if anyone else worked on it, but it may be that tests for the clipboard are not running at all, so we can't merge this without fixing that or proper "manual" testing.

Also, I guess there was a reason to copy the dependency to pandas, but may be things changed and now we can simply have it as a dependency?

@krey
Copy link
Contributor Author

krey commented Sep 17, 2019

If there's no opposition to changing pyperclip to a dependency, I will close this PR and open a new one.

@WillAyd I don't have access to a Windows machine (re #11720)

@WillAyd
Copy link
Member

WillAyd commented Sep 17, 2019

If there's no opposition to changing pyperclip to a dependency

I don't think we should do that. If starting from scratch might make sense but I don't see the churn being worth it. These aren't a huge burden to keep included

@datapythonista
Copy link
Member

I see the advantage of getting updates automatically, not a risky PR like this for every new version of pyperclip. And I don't see a disadvantage, I don't think a PR to make it a dependency is a big change, is it?

@krey
Copy link
Contributor Author

krey commented Sep 17, 2019

@datapythonista Agreed.

The change is literally #28471 (comment) (and changing some imports in the tests)

@TomAugspurger
Copy link
Contributor

TomAugspurger commented Sep 17, 2019 via email

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is fine to vendor and update to current; we don't want to add actual required dependencies (and making this optional is actually somewhat non-trivial).

pls add a whatsnew note on the issue resolution. do we need a test for this issue?

Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I found out the problem that made tests very slow when trying to restore the clipboard tests (afaik they are not yet working).

Once #28482 is merged, I'll give it a try. Probably worth waiting here until we have the clipboard tests back, to make sure this upgrade is not breaking anything.

@WillAyd
Copy link
Member

WillAyd commented Sep 19, 2019

@krey looks like the above fix is in. Can you merge master and address comments around the whatsnew / test?

@krey krey force-pushed the master branch 2 times, most recently from dec0f6c to 9c519bd Compare September 24, 2019 01:54
@krey
Copy link
Contributor Author

krey commented Sep 24, 2019

@WillAyd
Copy link
Member

WillAyd commented Sep 24, 2019

I think that makes sense to include as part of this

@WillAyd
Copy link
Member

WillAyd commented Oct 10, 2019

@krey can you fix merge conflicts and pull in the tests?

random.seed(42) # Make the "random" tests reproducible.


class _TestClipboard(unittest.TestCase):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm we don't use unittest so would need to change these - can you see how much effort it is to convert to pytest idiom?

Trying to balance asking a lot here versus getting this to work; unfortunately our current tests for this are suspect

@datapythonista
Copy link
Member

Do we want to run pyperclip tests? I understand that we don't want to add pyperclip as a hard dependency, and it's too complex to have it as an optional dependency for now. But I think we just want to have it as a vendored dependency, trusting that they run their own tests, and I don't see which value adds to pandas to run their tests (or include them in the project).

What are we going to do if tests fail in our CI? I don't think we want to touch our copy of their source, do we?

Am I missing something?

@WillAyd
Copy link
Member

WillAyd commented Oct 22, 2019

I'm not tied to it. I guess I'm unclear as to how we are currently validating / testing these though. Is this back up and running in CI? Or something we need to do as a pre-cursor?

Just hesitant to blanket vendor these changes without some kind of CI validation

@jreback
Copy link
Contributor

jreback commented Oct 22, 2019

we don’t need the tests; straight vendor is enough

@datapythonista
Copy link
Member

pyperclip itself should be tested. And we should have tests for our functions that use it, so if the new version breaks something in our code, the CI should be failing. So I'm with Jeff, we don't need the tests.

@WillAyd
Copy link
Member

WillAyd commented Oct 22, 2019

OK reverted just reverted that for @krey let's see

@jreback jreback added the Output-Formatting __repr__ of pandas objects, to_string label Nov 6, 2019
@jreback
Copy link
Contributor

jreback commented Nov 6, 2019

@krey this looks good. can you merge master and I think have a linting issue in the whatsnew. ping on green.

@krey
Copy link
Contributor Author

krey commented Nov 7, 2019

@jreback It's mostly green...

@WillAyd
Copy link
Member

WillAyd commented Nov 7, 2019

codecov is sometimes wonky so no worries there; rest lgtm as well

@WillAyd WillAyd merged commit f590cea into pandas-dev:master Nov 7, 2019
@WillAyd
Copy link
Member

WillAyd commented Nov 7, 2019

Thanks @krey

if not isinstance(text, acceptedTypes):
raise PyperclipException(
"only str, int, float, and bool values"
"can be copied to the clipboard, not".format(text.__class__.__name__)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mypy error: Not all arguments converted during string formatting [str-format]

Reksbril pushed a commit to Reksbril/pandas that referenced this pull request Nov 18, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO Data IO issues that don't fit into a more specific label Output-Formatting __repr__ of pandas objects, to_string
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants