-
-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
CLN/DEPR: Final panel removal #27101
Conversation
That looked easy ;) |
https://travis-ci.org/pandas-dev/pandas/jobs/551916327 xarray is explicity referencing Panel. not sure if if this is actually failing on the current one though. |
So we will need to keep something like
in core/panel.py and still import that in the main pandas namespace to avoid breaking released version of statsmodels and xarray. |
Brief glance at the xarray source this is used for introspection so not sure a dummy class is that useful. Perhaps something more cleanly handled downstream? cc @shoyer |
statsmodels is doing the same type of checking ? |
Yes. Opened statsmodels/statsmodels#5892 to remove it. |
I can fix this prior to the next xarray bug fix release
…On Fri, Jun 28, 2019 at 2:46 PM jbrockmendel ***@***.***> wrote:
statsmodels is doing the same type of checking ?
Yes. Opened statsmodels/statsmodels#5892
<statsmodels/statsmodels#5892> to remove it.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#27101?email_source=notifications&email_token=AAJJFVTTGYVMVBEINENYJQLP42BBXA5CNFSM4H4HN7FKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODY3HTBI#issuecomment-506886533>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJJFVXFKORSKIFQSMW6WBDP42BBXANCNFSM4H4HN7FA>
.
|
For what it's worth, this is probably an indication that the deprecation notice for Panel was not entirely effective, because it could still be used only for type checks without an error. In the future it would probably make sense to use module level |
It's being removed in the next pandas 0.25 release (see pandas-dev/pandas#27101).
@shoyer well that's very hard with < 3.7 (we did actually have some machinery to do this but blew it away a while back as it was complex) and not worth the effort IMHO. |
I would "be nice" for now and don't knowingly break other projects. As @shoyer said, it is hard to catch this as the specific use case does not result in a warning message (so there will probably be other projects as well). If we want to release a RC next week, I think it is better if that RC does not break importing statsmodels or xarray. Or, @shoyer, do you plan to do a xarray bugfix release soonish? Keeping a dummy class is not that hard (only a couple of lines of code). For Python 3.7 we could maybe actually use the getattribute trick (if it is possible to do that depending on the python version) |
Something like this seems to work (at least on Python 3.7): diff --git a/pandas/__init__.py b/pandas/__init__.py
index eafb89c52..d1d4cf678 100644
--- a/pandas/__init__.py
+++ b/pandas/__init__.py
@@ -158,3 +158,18 @@ Here are just a few of the things that pandas does well:
conversion, moving window statistics, moving window linear regressions,
date shifting and lagging, etc.
"""
+
+if pandas.compat.PY37:
+ def __getattr__(name):
+ if name == 'Panel':
+ import warnings
+ warnings.warn(
+ "The Panel class is removed from pandas. Accessing it from the "
+ "top-level namespace will also be removed in the next version",
+ FutureWarning, stacklevel=2)
+ return None
+ raise AttributeError(
+ "module 'pandas' has no attribute {}".format(name))
+else:
+ class Panel:
+ pass |
It's being removed in the next pandas 0.25 release (see pandas-dev/pandas#27101).
@WillAyd In order to get this merged, are you ok with adding something like the above? (#27101 (comment)) |
I would prefer not to add something like that since we have been targeting removal on 0.25 for a while and we still then wouldn't be removing it. |
To be clear, I don't propose to keep the 1000+ lines of panel code. We are removing the actual Panel class. I only propose to add a few lines to give a more gracious deprecation for a use case we have not been raising a warning for. |
Agreed. Especially if it is mainly xarray and statsmodels we're worried about, we can help them get quick bugfix releases out and have this over Once And For All. |
I think a compatibility shim like #27101 (comment) is good to have for a bit. @WillAyd do you have time to do that? If not, do you mind if I do it sometime tonight? |
Even if xarray issues a bug fix release in the next week (which is quite
likely), there are still going to be combinations of pandas with
statsmodels/xarray that don't even import. This sort of strict version
compatibility requirements is best avoided if possible, and in this case it
looks like it would be pretty easy/painless to avoid.
…On Tue, Jul 2, 2019 at 1:14 PM Tom Augspurger ***@***.***> wrote:
I think a compatibility shim like #27101 (comment)
<#27101 (comment)>
is good to have for a bit.
@WillAyd <https://github.com/WillAyd> do you have time to do that? If
not, do you mind if I do it sometime tonight?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#27101?email_source=notifications&email_token=AAJJFVRXWJVPGS4ORMCELQ3P5OZJ5A5CNFSM4H4HN7FKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZCNMPY#issuecomment-507827775>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJJFVUI3ZLLGGHMMWHVFQDP5OZJ5ANCNFSM4H4HN7FA>
.
|
yeah i think we need this shim. |
Sure will probably get to this tonight
…Sent from my iPhone
On Jul 2, 2019, at 4:54 PM, Jeff Reback ***@***.***> wrote:
yeah i think we need this shim.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@WillAyd I pushed some compat code; let's see. |
@jreback I think we should do the getattr check on Python 3.7 as I showed above in #27101 (comment). |
@jorisvandenbossche ok sure |
Thanks Jeff! Traveling back west today so feel free to move forward on this without me if a blocker. Otherwise can pick up later this evening |
@TomAugspurger I think this needs a conditional in pandas/tests/api/tests_api.py where if < py37 then add to the class list (deprecated), otherwise its not there. I can do later today unless you want to push a patch. |
I can take care of it.
…On Wed, Jul 3, 2019 at 6:35 AM Jeff Reback ***@***.***> wrote:
@TomAugspurger <https://github.com/TomAugspurger> I think this needs a
condition in pandas/tests/api/tests_api.py where if < py37 then add to the
class list (deprecated), otherwise its not there. I can do later today
unless you want to push a patch.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#27101?email_source=notifications&email_token=AAKAOIWNQP4AEA4O7ZSD433P5SFILA5CNFSM4H4HN7FKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZEFF6A#issuecomment-508056312>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAKAOIRJCVNFZ4CEPNMLVCTP5SFILANCNFSM4H4HN7FA>
.
|
|
Fixing now. |
pandas/__init__.py
Outdated
"from the top-level namespace will also be removed in " | ||
"the next version", | ||
FutureWarning, stacklevel=2) | ||
return None |
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.
Downstream are expecting this to be a type so they can do isinstance(thing, pd.Panel)
. Will make another dummy class Panel
here (not outside the getattr, so that we don't pollute the namespace on py37+).
@jreback the CI failure is unrelated (the categorical ASV we fixed in the other PR). Should be good to go. |
git diff upstream/master -u -- "*.py" | flake8 --diff