pyperclip upgrade
State: closed

- [x] closes https://github.com/pandas-dev/pandas/issues/22707
- [x] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

Labels:
name: IO Data
description: IO issues that don't fit into a more specific label
name: Output-Formatting
description: __repr__ of pandas objects, to_string

Comments:
are there any tests to go with this?
> 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 https://github.com/pandas-dev/pandas/issues/22707
Looks like CI is failing because an Exception subclass was removed `from pandas.io.clipboard.exceptions import PyperclipException`
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?
> 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.
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?
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
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?
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 https://github.com/pandas-dev/pandas/issues/11720)

> 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
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?
@datapythonista Agreed.

The change is literally https://github.com/pandas-dev/pandas/pull/28471#issuecomment-532017034 (and changing some imports in the tests)
Like Will, I'd prefer to keep vendoring it. I don't think it's worth adding
as a dependency.

On Tue, Sep 17, 2019 at 9:53 AM krey <notifications@github.com> wrote:

> @datapythonista <https://github.com/datapythonista> Agreed.
>
> The change is literally #28471 (comment)
> <https://github.com/pandas-dev/pandas/pull/28471#issuecomment-532017034>
> (and changing some imports in the tests)
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/28471?email_source=notifications&email_token=AAKAOIWQCHZKV74OZ3DZAYDQKDVOTA5CNFSM4IXHUSOKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD64ZVOA#issuecomment-532257464>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAKAOIQEIXW2M5SFMNJY4A3QKDVOTANCNFSM4IXHUSOA>
> .
>

@krey looks like the above fix is in. Can you merge master and address comments around the whatsnew / test?
Shall we add pyperclip's tests?https://github.com/asweigart/pyperclip/blob/master/tests/test_pyperclip.py
I think that makes sense to include as part of this
@krey can you fix merge conflicts and pull in the tests?
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?
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
we don’t need the tests; straight vendor is enough
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.
OK reverted just reverted that for @krey let's see
@krey this looks good. can you merge master and I think have a linting issue in the whatsnew. ping on green.
@jreback It's mostly green...
codecov is sometimes wonky so no worries there; rest lgtm as well
Thanks @krey