Skip to content

Fix matplotlib converter registering warning #26770

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 9 commits into from
Jun 21, 2019

Conversation

TomAugspurger
Copy link
Contributor

@TomAugspurger TomAugspurger commented Jun 10, 2019

Closes #26760

Tests were being skipped, because the module name changed in https://github.com/pandas-dev/pandas/pull/18307/files.

Closes pandas-dev#26760

Tests were being skipped, because the module name changed.
@codecov
Copy link

codecov bot commented Jun 10, 2019

Codecov Report

Merging #26770 into master will increase coverage by 0.09%.
The diff coverage is 85.71%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #26770      +/-   ##
==========================================
+ Coverage   91.71%   91.81%   +0.09%     
==========================================
  Files         178      178              
  Lines       50755    50762       +7     
==========================================
+ Hits        46552    46606      +54     
+ Misses       4203     4156      -47
Flag Coverage Δ
#multiple 90.4% <85.71%> (+0.1%) ⬆️
#single 41.91% <28.57%> (+0.6%) ⬆️
Impacted Files Coverage Δ
pandas/plotting/_matplotlib/core.py 88.13% <100%> (+0.01%) ⬆️
pandas/plotting/_matplotlib/boxplot.py 75.46% <100%> (+0.34%) ⬆️
pandas/plotting/_matplotlib/hist.py 76.82% <66.66%> (-0.19%) ⬇️
pandas/io/gbq.py 78.94% <0%> (-10.53%) ⬇️
pandas/core/frame.py 96.88% <0%> (-0.12%) ⬇️
pandas/core/config_init.py 96.85% <0%> (+3.93%) ⬆️
pandas/plotting/_misc.py 64.55% <0%> (+5.06%) ⬆️
pandas/plotting/_matplotlib/converter.py 63.66% <0%> (+5.23%) ⬆️
pandas/tseries/converter.py 100% <0%> (+100%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 959e799...fb694da. Read the comment docs.

@codecov
Copy link

codecov bot commented Jun 10, 2019

Codecov Report

Merging #26770 into master will increase coverage by 0.08%.
The diff coverage is 71.87%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #26770      +/-   ##
==========================================
+ Coverage   91.87%   91.95%   +0.08%     
==========================================
  Files         180      180              
  Lines       50712    50727      +15     
==========================================
+ Hits        46590    46645      +55     
+ Misses       4122     4082      -40
Flag Coverage Δ
#multiple 90.54% <71.87%> (+0.08%) ⬆️
#single 41.81% <25%> (+0.63%) ⬆️
Impacted Files Coverage Δ
pandas/plotting/_matplotlib/boxplot.py 76.05% <100%> (+0.45%) ⬆️
pandas/plotting/_matplotlib/tools.py 78.53% <100%> (+0.12%) ⬆️
pandas/plotting/_matplotlib/timeseries.py 66.32% <100%> (ø) ⬆️
pandas/plotting/_matplotlib/style.py 85.96% <100%> (ø) ⬆️
pandas/plotting/_matplotlib/__init__.py 100% <100%> (ø) ⬆️
pandas/util/_test_decorators.py 93.22% <100%> (ø) ⬆️
pandas/plotting/_matplotlib/misc.py 38.2% <16.66%> (-0.73%) ⬇️
pandas/plotting/_core.py 88.2% <50%> (-0.75%) ⬇️
pandas/plotting/_matplotlib/hist.py 76.82% <75%> (-0.19%) ⬇️
pandas/plotting/_matplotlib/core.py 88.02% <75%> (-0.09%) ⬇️
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update baa77c3...28aaecf. Read the comment docs.

@jreback jreback added this to the 0.25.0 milestone Jun 10, 2019
@jreback jreback added the Visualization plotting label Jun 10, 2019
@jreback
Copy link
Contributor

jreback commented Jun 10, 2019

is there any way to actually test this? can run a subprocess tests and check for warnings in the output?

@jorisvandenbossche jorisvandenbossche changed the title Fixed converter warning. Fix matplotlib converter registering warning Jun 11, 2019
@jorisvandenbossche
Copy link
Member

is there any way to actually test this?

@TomAugspurger actually proposed a way to test this in #24964, but you were against adding it (the test was called separately from ci/run_tests.sh. Although that indeed adds complexity to the CI testing code, this is only temporary and in a place (run_tests.sh) that does not need to be touched often. So personally, I would just add it like in the original version of that PR.

@jreback
Copy link
Contributor

jreback commented Jun 11, 2019

is there any way to actually test this?

@TomAugspurger actually proposed a way to test this in #24964, but you were against adding it (the test was called separately from ci/run_tests.sh. Although that indeed adds complexity to the CI testing code, this is only temporary and in a place (run_tests.sh) that does not need to be touched often. So personally, I would just add it like in the original version of that PR.

re-looking that's a good idea actually. @TomAugspurger can you re-add something like that?

@TomAugspurger
Copy link
Contributor Author

TomAugspurger commented Jun 11, 2019 via email

@TomAugspurger
Copy link
Contributor Author

Subprocess seems to work pretty well here.

@jorisvandenbossche
Copy link
Member

cc @datapythonista

@jorisvandenbossche
Copy link
Member

The failures seem related (as they are about plotting), but not sure what change in this PR caused those

@TomAugspurger
Copy link
Contributor Author

TomAugspurger commented Jun 17, 2019

For posterity, my current hypothesis is that

  1. import pandas imports matplotlib.pyplot by default again
  2. This likely happens before we every call td.skip_if_no_mpl()
  3. Which means we've imported matplotlib.pyplot before calling matplotlib.use(), which is bad.

d03a41d may have a warning in the log.

Not sure how to fix yet. Possibly, import pandas would only import matplotlib (not matplotlib.pyplot). Not sure if that's feasible.

@jorisvandenbossche
Copy link
Member

import pandas imports matplotlib.pyplot by default again

But this is something we can fix? I suppose this was introduced in the PR with the matplotlib split

@TomAugspurger
Copy link
Contributor Author

Yep. 28aaecf got them all I think.

@TomAugspurger
Copy link
Contributor Author

The warning was being emitted by matplotlib: https://travis-ci.org/pandas-dev/pandas/jobs/546786281#L2428 (that's before 28aaecf)

@TomAugspurger
Copy link
Contributor Author

OK, all green if you have another chance to look @jorisvandenbossche.

Basically, we can / need to have import pandas do import matplotlib. But it can't do import matplotlib.pyplot. Those need to be delayed. I've added that to our code checks.

And again, this is all going away in a release or so.

In my debugging, I've compat code like https://github.com/pandas-dev/pandas/pull/26770/files#diff-53e8fd9a1f847dd40d9aba697909409fL524, which no longer seem to be tested, and https://github.com/pandas-dev/pandas/pull/26770/files#diff-53e8fd9a1f847dd40d9aba697909409fL1096, which isn't needed for any recent matplotlib version.

@jreback jreback merged commit 4850b28 into pandas-dev:master Jun 21, 2019
@jreback
Copy link
Contributor

jreback commented Jun 21, 2019

thanks @TomAugspurger

merged, so @datapythonista can rebase the backend PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix implicitly registered converter warning
3 participants