Skip to content

Commit 00a7751

Browse files
committed
BLD: rename / move some extensions
xref #12588 pandas.parser -> io/libparsers.pyx pandas.json -> pandas.io.json.libjson pandas.io.sas.saslib -> libsas pandas.msgpack -> pandas.io.msgpack pandas._testing -> pandas.util.libtesting pandas._sparse -> pandas.sparse.libsparse pandas._hash -> pandas.tools.libhash pandas.tslib -> pandas.libs.tslib pandas.index -> pandas.libs.index pandas.algos -> pandas.libs.algos pandas.lib -> pandas.libs.lib pandas.hashtable -> pandas.libs.hashtable pandas._window -> pandas.core.libwindow pandas._join -> pandas.libs.join move algos*.in, index*.in, hashtable*.in to libs pandas._period -> pandas.libs.period
1 parent 0b07b07 commit 00a7751

File tree

241 files changed

+877
-765
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

241 files changed

+877
-765
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
tseries: pandas/lib.pyx pandas/tslib.pyx pandas/hashtable.pyx
1+
tseries: pandas/libs/lib.pyx pandas/libs/tslib.pyx pandas/libs/hashtable.pyx
22
python setup.py build_ext --inplace
33

44
.PHONY : develop build clean clean_pyc tseries doc

asv_bench/benchmarks/binary_ops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,4 @@ def setup(self):
107107
self.s = Series(date_range('20010101', periods=self.N, freq='T', tz='US/Eastern'))
108108
self.ts = self.s[self.halfway]
109109

110-
self.s2 = Series(date_range('20010101', periods=self.N, freq='s', tz='US/Eastern'))
110+
self.s2 = Series(date_range('20010101', periods=self.N, freq='s', tz='US/Eastern'))

asv_bench/benchmarks/pandas_vb_common.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,22 @@
88
import random
99
import numpy as np
1010
import threading
11+
from importlib import import_module
12+
1113
try:
1214
from pandas.compat import range
1315
except ImportError:
1416
pass
1517

1618
np.random.seed(1234)
17-
try:
18-
import pandas._tseries as lib
19-
except:
20-
import pandas.lib as lib
19+
20+
# try em until it works!
21+
for imp in ['pandas_tseries', 'pandas.lib', 'pandas.libs.lib']:
22+
try:
23+
lib = import_module(imp)
24+
break
25+
except:
26+
pass
2127

2228
try:
2329
Panel = Panel

asv_bench/benchmarks/panel_methods.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ def time_shift(self):
2121
self.panel.shift(1)
2222

2323
def time_shift_minor(self):
24-
self.panel.shift(1, axis='minor')
24+
self.panel.shift(1, axis='minor')

doc/source/whatsnew/v0.20.0.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,35 @@ New Behavior:
448448
In [11]: index.memory_usage(deep=True)
449449
Out[11]: 260
450450

451+
.. _whatsnew_0200.api_breaking.extensions:
452+
453+
Extension Modules Moved
454+
^^^^^^^^^^^^^^^^^^^^^^^
455+
456+
Some formerly public c/c++/cython extension modules have been moved and/or renamed. These are all removed from the public API.
457+
If indicated, a deprecation warning will be issued if you reference that module. (:issue:`12588`)
458+
459+
.. csv-table::
460+
:header: "Previous Location", "New Location", "Deprecated"
461+
:widths: 30, 30, 4
462+
463+
"pandas.json", "pandas.io.json.libjson", "X"
464+
"pandas.parser", "pandas.io.libparsers", "X"
465+
"pandas.lib", "pandas.libs.lib", "X"
466+
"pandas.tslib", "pandas.libs.tslib", "X"
467+
"pandas.io.sas.saslib", "pandas.io.sas.libsas", ""
468+
"pandas.msgpack", "pandas.io.msgpack", ""
469+
"pandas.index", "pandas.libs.index", ""
470+
"pandas.algos", "pandas.libs.algos", ""
471+
"pandas.hashtable", "pandas.libs.hashtable", ""
472+
"pandas._testing", "pandas.util.libtesting", ""
473+
"pandas._sparse", "pandas.sparse.libsparse", ""
474+
"pandas._hash", "pandas.tools.libhash", ""
475+
"pandas._window", "pandas.core.libwindow", ""
476+
"pandas._join", "pandas.libs.join", ""
477+
"pandas._period", "pandas.libs.period", ""
478+
479+
451480
.. _whatsnew_0200.api_breaking.groupby_describe:
452481

453482
Groupby Describe Formatting

pandas/__init__.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
from pandas.compat.numpy import *
2424

2525
try:
26-
from pandas import hashtable, tslib, lib
26+
from pandas.libs import (hashtable as _hashtable,
27+
lib as _lib,
28+
tslib as _tslib)
2729
except ImportError as e: # pragma: no cover
2830
# hack but overkill to use re
2931
module = str(e).lstrip('cannot import name ')
@@ -52,11 +54,17 @@
5254
from pandas.tools.util import to_numeric
5355
from pandas.core.reshape import melt
5456
from pandas.util.print_versions import show_versions
55-
5657
from pandas.io.api import *
57-
5858
from pandas.util._tester import test
5959

60+
# extension module deprecations
61+
from pandas.util.depr_module import _DeprecatedModule
62+
63+
json = _DeprecatedModule(deprmod='pandas.json', deprmodto='pandas.io.json.libjson')
64+
parser = _DeprecatedModule(deprmod='pandas.parser', deprmodto='pandas.io.libparsers')
65+
lib = _DeprecatedModule(deprmod='pandas.lib', deprmodto='pandas.libs.lib')
66+
tslib = _DeprecatedModule(deprmod='pandas.tslib', deprmodto='pandas.libs.tslib')
67+
6068
# use the closest tagged version if possible
6169
from ._version import get_versions
6270
v = get_versions()

pandas/compat/pickle_compat.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,13 @@ def load_reduce(self):
6161
('pandas.core.base', 'FrozenList'): ('pandas.indexes.frozen', 'FrozenList'),
6262

6363
# 10890
64-
('pandas.core.series', 'TimeSeries'): ('pandas.core.series', 'Series')
64+
('pandas.core.series', 'TimeSeries'): ('pandas.core.series', 'Series'),
65+
66+
# 12588, extensions moving
67+
('pandas._sparse', 'BlockIndex'): ('pandas.sparse.libsparse', 'BlockIndex'),
68+
('pandas.tslib', 'Timestamp'): ('pandas.libs.tslib', 'Timestamp'),
69+
('pandas.tslib', '__nat_unpickle'): ('pandas.libs.tslib', '__nat_unpickle'),
70+
('pandas._period', 'Period'): ('pandas.libs.period', 'Period')
6571
}
6672

6773

pandas/computation/scope.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def _raw_hex_id(obj):
4646

4747

4848
_DEFAULT_GLOBALS = {
49-
'Timestamp': pd.lib.Timestamp,
49+
'Timestamp': pd.libs.lib.Timestamp,
5050
'datetime': datetime.datetime,
5151
'True': True,
5252
'False': False,

pandas/core/algorithms.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from warnings import warn
77
import numpy as np
88

9-
from pandas import compat, lib, tslib, _np_version_under1p8
9+
from pandas import compat, _np_version_under1p8
1010
from pandas.types.cast import _maybe_promote
1111
from pandas.types.generic import ABCSeries, ABCIndex
1212
from pandas.types.common import (is_unsigned_integer_dtype,
@@ -34,10 +34,9 @@
3434
from pandas.types.missing import isnull
3535

3636
import pandas.core.common as com
37-
import pandas.algos as algos
38-
import pandas.hashtable as htable
3937
from pandas.compat import string_types
40-
from pandas.tslib import iNaT
38+
from pandas.libs import algos, lib, hashtable as htable
39+
from pandas.libs.tslib import iNaT
4140

4241

4342
# --------------- #
@@ -1412,7 +1411,7 @@ def diff(arr, n, axis=0):
14121411
if needs_i8_conversion(arr):
14131412
dtype = np.float64
14141413
arr = arr.view('i8')
1415-
na = tslib.iNaT
1414+
na = iNaT
14161415
is_timedelta = True
14171416
elif issubclass(dtype.type, np.integer):
14181417
dtype = np.float64

pandas/core/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from pandas.core import common as com
1414
import pandas.core.nanops as nanops
15-
import pandas.lib as lib
15+
import pandas.libs.lib as lib
1616
from pandas.compat.numpy import function as nv
1717
from pandas.util.decorators import (Appender, cache_readonly,
1818
deprecate_kwarg, Substitution)

0 commit comments

Comments
 (0)