Skip to content

Commit f9dcad7

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
1 parent dd368eb commit f9dcad7

Some content is hidden

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

46 files changed

+213
-140
lines changed

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/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: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,24 @@ New Behavior:
446446
In [11]: index.memory_usage(deep=True)
447447
Out[11]: 260
448448

449+
.. _whatsnew_0200.api_breaking.extensions:
450+
451+
Extension Modules Moving
452+
^^^^^^^^^^^^^^^^^^^^^^^^
453+
454+
Some formerly public extension modules have been moved and/or renamed. These are all removed from the public API.
455+
If indicated, a deprecation warning will be issued if you reference that module. (:issue:`12588`)
456+
457+
.. csv-table::
458+
:header: "Previous Location", "New Location", "Deprecated"
459+
:widths: 30, 30, 4
460+
461+
"pandas.json", "pandas.io.json.libjson", "X"
462+
"pandas.parser", "pandas.io.libparsers", "X"
463+
"pandas.io.sas.saslib", "pandas.io.sas.libsas", ""
464+
"pandas.msgpack", "pandas.io.msgpack", ""
465+
466+
449467
.. _whatsnew_0200.api_breaking.groupby_describe:
450468

451469
Groupby Describe Formatting

pandas/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,15 @@
5353
from pandas.tools.util import to_numeric
5454
from pandas.core.reshape import melt
5555
from pandas.util.print_versions import show_versions
56-
5756
from pandas.io.api import *
58-
5957
from pandas.util._tester import test
6058

59+
# extension module deprecations
60+
from pandas.util.depr_module import _DeprecatedModule
61+
62+
json = _DeprecatedModule(deprmod='pandas.json', deprmodto='pandas.io.json.libjson')
63+
parser = _DeprecatedModule(deprmod='pandas.parser', deprmodto='pandas.io.libparsers')
64+
6165
# use the closest tagged version if possible
6266
from ._version import get_versions
6367
v = get_versions()

pandas/io/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from pandas.io.json import read_json
1212
from pandas.io.html import read_html
1313
from pandas.io.sql import read_sql, read_sql_table, read_sql_query
14-
from pandas.io.sas.sasreader import read_sas
14+
from pandas.io.sas import read_sas
1515
from pandas.io.feather_format import read_feather
1616
from pandas.io.stata import read_stata
1717
from pandas.io.pickle import read_pickle, to_pickle

pandas/io/excel.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
EmptyDataError, get_filepath_or_buffer,
2020
_NA_VALUES)
2121
from pandas.tseries.period import Period
22-
from pandas import json
22+
from pandas.io.json import libjson
2323
from pandas.compat import (map, zip, reduce, range, lrange, u, add_metaclass,
2424
string_types, OrderedDict)
2525
from pandas.core import config
@@ -1434,7 +1434,7 @@ def write_cells(self, cells, sheet_name=None, startrow=0, startcol=0,
14341434
elif isinstance(cell.val, date):
14351435
num_format_str = self.date_format
14361436

1437-
stylekey = json.dumps(cell.style)
1437+
stylekey = libjson.dumps(cell.style)
14381438
if num_format_str:
14391439
stylekey += num_format_str
14401440

@@ -1562,7 +1562,7 @@ def write_cells(self, cells, sheet_name=None, startrow=0, startcol=0,
15621562
elif isinstance(cell.val, date):
15631563
num_format_str = self.date_format
15641564

1565-
stylekey = json.dumps(cell.style)
1565+
stylekey = libjson.dumps(cell.style)
15661566
if num_format_str:
15671567
stylekey += num_format_str
15681568

pandas/io/json/json.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import os
44
import numpy as np
55

6-
import pandas.json as _json
6+
from pandas.io.json import libjson
77
from pandas.tslib import iNaT
88
from pandas.compat import StringIO, long, u
99
from pandas import compat, isnull
@@ -13,8 +13,8 @@
1313
from pandas.formats.printing import pprint_thing
1414
from .normalize import _convert_to_line_delimits
1515

16-
loads = _json.loads
17-
dumps = _json.dumps
16+
loads = libjson.loads
17+
dumps = libjson.dumps
1818

1919

2020
# interface to/from

pandas/msgpack/__init__.py renamed to pandas/io/msgpack/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
from collections import namedtuple
44

5-
from pandas.msgpack.exceptions import * # noqa
6-
from pandas.msgpack._version import version # noqa
5+
from pandas.io.msgpack.exceptions import * # noqa
6+
from pandas.io.msgpack._version import version # noqa
77

88

99
class ExtType(namedtuple('ExtType', 'code data')):
@@ -19,8 +19,8 @@ def __new__(cls, code, data):
1919

2020
import os # noqa
2121

22-
from pandas.msgpack._packer import Packer # noqa
23-
from pandas.msgpack._unpacker import unpack, unpackb, Unpacker # noqa
22+
from pandas.io.msgpack._packer import Packer # noqa
23+
from pandas.io.msgpack._unpacker import unpack, unpackb, Unpacker # noqa
2424

2525

2626
def pack(o, stream, **kwargs):

pandas/msgpack/_packer.pyx renamed to pandas/io/msgpack/_packer.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ from libc.stdlib cimport *
66
from libc.string cimport *
77
from libc.limits cimport *
88

9-
from pandas.msgpack.exceptions import PackValueError
10-
from pandas.msgpack import ExtType
9+
from pandas.io.msgpack.exceptions import PackValueError
10+
from pandas.io.msgpack import ExtType
1111

1212

13-
cdef extern from "../src/msgpack/pack.h":
13+
cdef extern from "../../src/msgpack/pack.h":
1414
struct msgpack_packer:
1515
char* buf
1616
size_t length

pandas/msgpack/_unpacker.pyx renamed to pandas/io/msgpack/_unpacker.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ from libc.stdlib cimport *
1111
from libc.string cimport *
1212
from libc.limits cimport *
1313

14-
from pandas.msgpack.exceptions import (BufferFull, OutOfData,
15-
UnpackValueError, ExtraData)
16-
from pandas.msgpack import ExtType
14+
from pandas.io.msgpack.exceptions import (BufferFull, OutOfData,
15+
UnpackValueError, ExtraData)
16+
from pandas.io.msgpack import ExtType
1717

1818

19-
cdef extern from "../src/msgpack/unpack.h":
19+
cdef extern from "../../src/msgpack/unpack.h":
2020
ctypedef struct msgpack_user:
2121
bint use_list
2222
PyObject* object_hook

0 commit comments

Comments
 (0)