Skip to content

Commit e99f56e

Browse files
authored
CLN: make submodules of pandas.util private (#16223)
* CLN: make submodules of pandas.util private xref #13634 CLN: move pandas.util.* validators, depr_module, decorators, print_versions to _ leading * CLN: move remaning extensions to _libs * pandas.tools.hashing FutureWarning -> DeprecationWarning
1 parent 1f5ecc9 commit e99f56e

Some content is hidden

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

94 files changed

+217
-170
lines changed

asv_bench/benchmarks/algorithms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import pandas as pd
66
from pandas.util import testing as tm
77

8-
for imp in ['pandas.util.hashing', 'pandas.tools.hashing']:
8+
for imp in ['pandas.util', 'pandas.tools.hashing']:
99
try:
1010
hashing = import_module(imp)
1111
break

asv_bench/benchmarks/attrs_caching.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
from .pandas_vb_common import *
2-
from pandas.util.decorators import cache_readonly
2+
3+
try:
4+
from pandas.util import cache_readonly
5+
except ImportError:
6+
from pandas.util.decorators import cache_readonly
37

48

59
class DataFrameAttributes(object):

doc/source/merging.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
1414
import matplotlib.pyplot as plt
1515
plt.close('all')
16-
import pandas.util.doctools as doctools
16+
import pandas.util._doctools as doctools
1717
p = doctools.TablePlotter()
1818
1919

doc/source/whatsnew/v0.20.0.txt

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,19 +1230,19 @@ If indicated, a deprecation warning will be issued if you reference theses modul
12301230
"pandas.algos", "pandas._libs.algos", ""
12311231
"pandas.hashtable", "pandas._libs.hashtable", ""
12321232
"pandas.indexes", "pandas.core.indexes", ""
1233-
"pandas.json", "pandas.io.json.libjson", "X"
1234-
"pandas.parser", "pandas.io.libparsers", "X"
1233+
"pandas.json", "pandas._libs.json", "X"
1234+
"pandas.parser", "pandas._libs.parsers", "X"
12351235
"pandas.formats", "pandas.io.formats", ""
12361236
"pandas.sparse", "pandas.core.sparse", ""
12371237
"pandas.tools", "pandas.core.reshape", ""
12381238
"pandas.types", "pandas.core.dtypes", ""
1239-
"pandas.io.sas.saslib", "pandas.io.sas.libsas", ""
1239+
"pandas.io.sas.saslib", "pandas.io.sas._sas", ""
12401240
"pandas._join", "pandas._libs.join", ""
1241-
"pandas._hash", "pandas.util.libhashing", ""
1241+
"pandas._hash", "pandas._libs.hashing", ""
12421242
"pandas._period", "pandas._libs.period", ""
1243-
"pandas._sparse", "pandas.core.sparse.libsparse", ""
1244-
"pandas._testing", "pandas.util.libtesting", ""
1245-
"pandas._window", "pandas.core.libwindow", ""
1243+
"pandas._sparse", "pandas._libs.sparse", ""
1244+
"pandas._testing", "pandas._libs.testing", ""
1245+
"pandas._window", "pandas._libs.window", ""
12461246

12471247

12481248
Some new subpackages are created with public functionality that is not directly
@@ -1254,6 +1254,8 @@ these are now the public subpackages.
12541254

12551255
- The function :func:`~pandas.api.types.union_categoricals` is now importable from ``pandas.api.types``, formerly from ``pandas.types.concat`` (:issue:`15998`)
12561256
- The type import ``pandas.tslib.NaTType`` is deprecated and can be replaced by using ``type(pandas.NaT)`` (:issue:`16146`)
1257+
- The public functions in ``pandas.tools.hashing`` deprecated from that locations, but are now importable from ``pandas.util`` (:issue:`16223`)
1258+
- The modules in ``pandas.util``: ``decorators``, ``print_versions``, ``doctools``, `validators``, ``depr_module`` are now private (:issue:`16223`)
12571259

12581260
.. _whatsnew_0200.privacy.errors:
12591261

@@ -1278,7 +1280,7 @@ The following are now part of this API:
12781280
'UnsupportedFunctionCall']
12791281

12801282

1281-
.. _whatsnew_0200.privay.testing:
1283+
.. _whatsnew_0200.privacy.testing:
12821284

12831285
``pandas.testing``
12841286
^^^^^^^^^^^^^^^^^^
@@ -1292,14 +1294,13 @@ The following testing functions are now part of this API:
12921294
- :func:`testing.assert_index_equal`
12931295

12941296

1295-
.. _whatsnew_0200.privay.plotting:
1297+
.. _whatsnew_0200.privacy.plotting:
12961298

12971299
``pandas.plotting``
12981300
^^^^^^^^^^^^^^^^^^^
12991301

13001302
A new public ``pandas.plotting`` module has been added that holds plotting functionality that was previously in either ``pandas.tools.plotting`` or in the top-level namespace. See the :ref:`deprecations sections <whatsnew_0200.privacy.deprecate_plotting>` for more details.
13011303

1302-
13031304
.. _whatsnew_0200.privacy.development:
13041305

13051306
Other Development Changes

pandas/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,17 @@
5050
import pandas.tools.plotting
5151
plot_params = pandas.plotting._style._Options(deprecated=True)
5252
# do not import deprecate to top namespace
53-
scatter_matrix = pandas.util.decorators.deprecate(
53+
scatter_matrix = pandas.util._decorators.deprecate(
5454
'pandas.scatter_matrix', pandas.plotting.scatter_matrix,
5555
'pandas.plotting.scatter_matrix')
5656

57-
from pandas.util.print_versions import show_versions
57+
from pandas.util._print_versions import show_versions
5858
from pandas.io.api import *
5959
from pandas.util._tester import test
6060
import pandas.testing
6161

6262
# extension module deprecations
63-
from pandas.util.depr_module import _DeprecatedModule
63+
from pandas.util._depr_module import _DeprecatedModule
6464

6565
json = _DeprecatedModule(deprmod='pandas.json',
6666
moved={'dumps': 'pandas.io.json.dumps',
File renamed without changes.
File renamed without changes.
File renamed without changes.

pandas/_libs/src/ujson/python/ujson.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@ static struct PyModuleDef moduledef = {
9090
NULL /* m_free */
9191
};
9292

93-
#define PYMODINITFUNC PyMODINIT_FUNC PyInit_libjson(void)
93+
#define PYMODINITFUNC PyMODINIT_FUNC PyInit_json(void)
9494
#define PYMODULE_CREATE() PyModule_Create(&moduledef)
9595
#define MODINITERROR return NULL
9696

9797
#else
9898

99-
#define PYMODINITFUNC PyMODINIT_FUNC initlibjson(void)
100-
#define PYMODULE_CREATE() Py_InitModule("libjson", ujsonMethods)
99+
#define PYMODINITFUNC PyMODINIT_FUNC initjson(void)
100+
#define PYMODULE_CREATE() Py_InitModule("json", ujsonMethods)
101101
#define MODINITERROR return
102102

103103
#endif

0 commit comments

Comments
 (0)