Skip to content
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

Add shim modules with deprecation warnings to ensure backward compat #16140

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pandas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
from pandas.io.api import *
from pandas.util._tester import test
import pandas.testing
from . import computation # TODO: Remove when deprecated shim module is removed
Copy link
Member

Choose a reason for hiding this comment

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

this will trigger the deprecation warning already (so showing it on just importing pandas), so we have to have a workaround this

Copy link
Member

Choose a reason for hiding this comment

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

This can possibly be solved by using the _DeprecatedModule some lines below


# extension module deprecations
from pandas.util.depr_module import _DeprecatedModule
Expand Down
14 changes: 14 additions & 0 deletions pandas/computation/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import warnings


warnings.warn(
"The pandas.computation module is deprecated and will be removed in a future "
"version. Please import from the pandas.core.computation module instead.",
Copy link
Member

Choose a reason for hiding this comment

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

So the "Please import from the pandas.core.computation module instead." should be removed IMO.

FutureWarning, stacklevel=2
)


from . import (
align, api, common, engines, eval,
expr, expressions, ops, pytables, scope
)
1 change: 1 addition & 0 deletions pandas/computation/align.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from pandas.core.computation.align import *
1 change: 1 addition & 0 deletions pandas/computation/api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from pandas.core.computation.api import *
1 change: 1 addition & 0 deletions pandas/computation/common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from pandas.core.computation.common import *
1 change: 1 addition & 0 deletions pandas/computation/engines.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from pandas.core.computation.engines import *
1 change: 1 addition & 0 deletions pandas/computation/eval.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from pandas.core.computation.eval import *
1 change: 1 addition & 0 deletions pandas/computation/expr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from pandas.core.computation.expr import *
1 change: 1 addition & 0 deletions pandas/computation/expressions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from pandas.core.computation.expressions import *
1 change: 1 addition & 0 deletions pandas/computation/ops.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from pandas.core.computation.ops import *
1 change: 1 addition & 0 deletions pandas/computation/pytables.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from pandas.core.computation.pytables import *
1 change: 1 addition & 0 deletions pandas/computation/scope.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from pandas.core.computation.scope import *
10 changes: 10 additions & 0 deletions pandas/tools/hashing/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import warnings


warnings.warn(
"The pandas.tools.hashimg module is deprecated and will be removed in a "
"future version. Please import from the pandas.util.hashing module instead.",
FutureWarning, stacklevel=2
)

from pandas.util.hashing import *
8 changes: 8 additions & 0 deletions pandas/types/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import warnings


warnings.warn(
"The pandas.types module is deprecated and will be removed in a future "
"version. Please import from the pandas.core.dtypes module instead.",
Copy link
Member

Choose a reason for hiding this comment

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

Here as well, the "Please import from the pandas.core.dtypes module instead." should be removed.

There is part of these functions available in pandas.api.types, but not everything. But maybe we can point to that in general?

FutureWarning, stacklevel=2
)
1 change: 1 addition & 0 deletions pandas/types/api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from pandas.core.dtypes.api import *
1 change: 1 addition & 0 deletions pandas/types/cast.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from pandas.core.dtypes.cast import *
1 change: 1 addition & 0 deletions pandas/types/common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from pandas.core.dtypes.common import *
1 change: 1 addition & 0 deletions pandas/types/concat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from pandas.core.dtypes.concat import *
1 change: 1 addition & 0 deletions pandas/types/dtypes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from pandas.core.dtypes.dtypes import *
1 change: 1 addition & 0 deletions pandas/types/generic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from pandas.core.dtypes.generic import *
1 change: 1 addition & 0 deletions pandas/types/inference.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from pandas.core.dtypes.inference import *
1 change: 1 addition & 0 deletions pandas/types/missing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from pandas.core.dtypes.missing import *