Skip to content

Commit 4b9c62d

Browse files
jbrockmendelWillAyd
authored andcommitted
DEPR: msgpack (#30112)
1 parent 76ddd78 commit 4b9c62d

Some content is hidden

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

58 files changed

+22
-6390
lines changed

LICENSES/MSGPACK_LICENSE

-13
This file was deleted.

LICENSES/MSGPACK_NUMPY_LICENSE

-33
This file was deleted.

MANIFEST.in

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ global-exclude *.gz
2020
global-exclude *.h5
2121
global-exclude *.html
2222
global-exclude *.json
23-
global-exclude *.msgpack
2423
global-exclude *.pickle
2524
global-exclude *.png
2625
global-exclude *.pyc

asv_bench/benchmarks/io/msgpack.py

-32
This file was deleted.

asv_bench/benchmarks/io/sas.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ def setup(self, format):
2626
]
2727
self.f = os.path.join(*paths)
2828

29-
def time_read_msgpack(self, format):
29+
def time_read_sas(self, format):
3030
read_sas(self.f, format=format)

ci/code_checks.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ if [[ -z "$CHECK" || "$CHECK" == "lint" ]]; then
9494

9595
# We don't lint all C files because we don't want to lint any that are built
9696
# from Cython files nor do we want to lint C files that we didn't modify for
97-
# this particular codebase (e.g. src/headers, src/klib, src/msgpack). However,
97+
# this particular codebase (e.g. src/headers, src/klib). However,
9898
# we can lint all header files since they aren't "generated" like C files are.
9999
MSG='Linting .c and .h' ; echo $MSG
100-
cpplint --quiet --extensions=c,h --headers=h --recursive --filter=-readability/casting,-runtime/int,-build/include_subdir pandas/_libs/src/*.h pandas/_libs/src/parser pandas/_libs/ujson pandas/_libs/tslibs/src/datetime pandas/io/msgpack pandas/_libs/*.cpp pandas/util
100+
cpplint --quiet --extensions=c,h --headers=h --recursive --filter=-readability/casting,-runtime/int,-build/include_subdir pandas/_libs/src/*.h pandas/_libs/src/parser pandas/_libs/ujson pandas/_libs/tslibs/src/datetime pandas/_libs/*.cpp
101101
RET=$(($RET + $?)) ; echo $MSG "DONE"
102102

103103
echo "isort --version-number"

doc/redirects.csv

-3
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,6 @@ generated/pandas.DataFrame.to_hdf,../reference/api/pandas.DataFrame.to_hdf
491491
generated/pandas.DataFrame.to,../reference/api/pandas.DataFrame.to
492492
generated/pandas.DataFrame.to_json,../reference/api/pandas.DataFrame.to_json
493493
generated/pandas.DataFrame.to_latex,../reference/api/pandas.DataFrame.to_latex
494-
generated/pandas.DataFrame.to_msgpack,../reference/api/pandas.DataFrame.to_msgpack
495494
generated/pandas.DataFrame.to_numpy,../reference/api/pandas.DataFrame.to_numpy
496495
generated/pandas.DataFrame.to_panel,../reference/api/pandas.DataFrame.to_panel
497496
generated/pandas.DataFrame.to_parquet,../reference/api/pandas.DataFrame.to_parquet
@@ -889,7 +888,6 @@ generated/pandas.read_gbq,../reference/api/pandas.read_gbq
889888
generated/pandas.read_hdf,../reference/api/pandas.read_hdf
890889
generated/pandas.read,../reference/api/pandas.read
891890
generated/pandas.read_json,../reference/api/pandas.read_json
892-
generated/pandas.read_msgpack,../reference/api/pandas.read_msgpack
893891
generated/pandas.read_parquet,../reference/api/pandas.read_parquet
894892
generated/pandas.read_pickle,../reference/api/pandas.read_pickle
895893
generated/pandas.read_sas,../reference/api/pandas.read_sas
@@ -1230,7 +1228,6 @@ generated/pandas.Series.to_json,../reference/api/pandas.Series.to_json
12301228
generated/pandas.Series.to_latex,../reference/api/pandas.Series.to_latex
12311229
generated/pandas.Series.to_list,../reference/api/pandas.Series.to_list
12321230
generated/pandas.Series.tolist,../reference/api/pandas.Series.tolist
1233-
generated/pandas.Series.to_msgpack,../reference/api/pandas.Series.to_msgpack
12341231
generated/pandas.Series.to_numpy,../reference/api/pandas.Series.to_numpy
12351232
generated/pandas.Series.to_period,../reference/api/pandas.Series.to_period
12361233
generated/pandas.Series.to_pickle,../reference/api/pandas.Series.to_pickle

doc/source/development/developer.rst

-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ The ``metadata`` field is ``None`` except for:
125125
in ``BYTE_ARRAY`` Parquet columns. The encoding can be one of:
126126

127127
* ``'pickle'``
128-
* ``'msgpack'``
129128
* ``'bson'``
130129
* ``'json'``
131130

doc/source/getting_started/install.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ PyTables 3.4.2 HDF5-based reading / writing
249249
SQLAlchemy 1.1.4 SQL support for databases other than sqlite
250250
SciPy 0.19.0 Miscellaneous statistical functions
251251
XLsxWriter 0.9.8 Excel writing
252-
blosc Compression for msgpack
252+
blosc Compression for HDF5
253253
fastparquet 0.3.2 Parquet reading / writing
254254
gcsfs 0.2.2 Google Cloud Storage access
255255
html5lib HTML parser for read_html (see :ref:`note <optional_html>`)
@@ -269,7 +269,7 @@ xclip Clipboard I/O on linux
269269
xlrd 1.1.0 Excel reading
270270
xlwt 1.2.0 Excel writing
271271
xsel Clipboard I/O on linux
272-
zlib Compression for msgpack
272+
zlib Compression for HDF5
273273
========================= ================== =============================================================
274274

275275
.. _optional_html:

doc/source/reference/frame.rst

-1
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,6 @@ Serialization / IO / conversion
357357
DataFrame.to_feather
358358
DataFrame.to_latex
359359
DataFrame.to_stata
360-
DataFrame.to_msgpack
361360
DataFrame.to_gbq
362361
DataFrame.to_records
363362
DataFrame.to_string

doc/source/reference/io.rst

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ Flat file
2222
read_table
2323
read_csv
2424
read_fwf
25-
read_msgpack
2625

2726
Clipboard
2827
~~~~~~~~~

doc/source/reference/series.rst

-1
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,6 @@ Serialization / IO / conversion
574574
Series.to_xarray
575575
Series.to_hdf
576576
Series.to_sql
577-
Series.to_msgpack
578577
Series.to_json
579578
Series.to_string
580579
Series.to_clipboard

doc/source/user_guide/cookbook.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,7 @@ in the frame:
12291229
The offsets of the structure elements may be different depending on the
12301230
architecture of the machine on which the file was created. Using a raw
12311231
binary file format like this for general data storage is not recommended, as
1232-
it is not cross platform. We recommended either HDF5 or msgpack, both of
1232+
it is not cross platform. We recommended either HDF5 or parquet, both of
12331233
which are supported by pandas' IO facilities.
12341234

12351235
Computation

doc/source/user_guide/io.rst

+9-77
Original file line numberDiff line numberDiff line change
@@ -3382,87 +3382,19 @@ The default is to 'infer':
33823382
msgpack
33833383
-------
33843384

3385-
pandas supports the ``msgpack`` format for
3386-
object serialization. This is a lightweight portable binary format, similar
3387-
to binary JSON, that is highly space efficient, and provides good performance
3388-
both on the writing (serialization), and reading (deserialization).
3385+
pandas support for ``msgpack`` has been removed in version 1.0.0. It is recommended to use pyarrow for on-the-wire transmission of pandas objects.
33893386

3390-
.. warning::
3391-
3392-
The msgpack format is deprecated as of 0.25 and will be removed in a future version.
3393-
It is recommended to use pyarrow for on-the-wire transmission of pandas objects.
3394-
3395-
.. warning::
3396-
3397-
:func:`read_msgpack` is only guaranteed backwards compatible back to pandas version 0.20.3
3398-
3399-
.. ipython:: python
3400-
:okwarning:
3401-
3402-
df = pd.DataFrame(np.random.rand(5, 2), columns=list('AB'))
3403-
df.to_msgpack('foo.msg')
3404-
pd.read_msgpack('foo.msg')
3405-
s = pd.Series(np.random.rand(5), index=pd.date_range('20130101', periods=5))
3406-
3407-
You can pass a list of objects and you will receive them back on deserialization.
3408-
3409-
.. ipython:: python
3410-
:okwarning:
3411-
3412-
pd.to_msgpack('foo.msg', df, 'foo', np.array([1, 2, 3]), s)
3413-
pd.read_msgpack('foo.msg')
3414-
3415-
You can pass ``iterator=True`` to iterate over the unpacked results:
3416-
3417-
.. ipython:: python
3418-
:okwarning:
3419-
3420-
for o in pd.read_msgpack('foo.msg', iterator=True):
3421-
print(o)
3422-
3423-
You can pass ``append=True`` to the writer to append to an existing pack:
3424-
3425-
.. ipython:: python
3426-
:okwarning:
3387+
Example pyarrow usage:
34273388

3428-
df.to_msgpack('foo.msg', append=True)
3429-
pd.read_msgpack('foo.msg')
3430-
3431-
Unlike other io methods, ``to_msgpack`` is available on both a per-object basis,
3432-
``df.to_msgpack()`` and using the top-level ``pd.to_msgpack(...)`` where you
3433-
can pack arbitrary collections of Python lists, dicts, scalars, while intermixing
3434-
pandas objects.
3435-
3436-
.. ipython:: python
3437-
:okwarning:
3438-
3439-
pd.to_msgpack('foo2.msg', {'dict': [{'df': df}, {'string': 'foo'},
3440-
{'scalar': 1.}, {'s': s}]})
3441-
pd.read_msgpack('foo2.msg')
3442-
3443-
.. ipython:: python
3444-
:suppress:
3445-
:okexcept:
3446-
3447-
os.remove('foo.msg')
3448-
os.remove('foo2.msg')
3449-
3450-
Read/write API
3451-
''''''''''''''
3452-
3453-
Msgpacks can also be read from and written to strings.
3454-
3455-
.. ipython:: python
3456-
:okwarning:
3457-
3458-
df.to_msgpack()
3459-
3460-
Furthermore you can concatenate the strings to produce a list of the original objects.
3389+
.. code-block:: python
34613390
3462-
.. ipython:: python
3463-
:okwarning:
3391+
>>> import pandas as pd
3392+
>>> import pyarrow as pa
3393+
>>> df = pd.DataFrame({'A': [1, 2, 3]})
3394+
>>> context = pa.default_serialization_context()
3395+
>>> df_bytestring = context.serialize(df).to_buffer().to_pybytes()
34643396
3465-
pd.read_msgpack(df.to_msgpack() + s.to_msgpack())
3397+
For documentation on pyarrow, see `here <https://arrow.apache.org/docs/python/index.html>`__.
34663398

34673399
.. _io.hdf5:
34683400

doc/source/whatsnew/v0.13.0.rst

+2-4
Original file line numberDiff line numberDiff line change
@@ -828,8 +828,7 @@ Experimental
828828

829829
Since this is an EXPERIMENTAL LIBRARY, the storage format may not be stable until a future release.
830830

831-
.. ipython:: python
832-
:okwarning:
831+
.. code-block:: python
833832
834833
df = pd.DataFrame(np.random.rand(5, 2), columns=list('AB'))
835834
df.to_msgpack('foo.msg')
@@ -841,8 +840,7 @@ Experimental
841840
842841
You can pass ``iterator=True`` to iterator over the unpacked results
843842

844-
.. ipython:: python
845-
:okwarning:
843+
.. code-block:: python
846844
847845
for o in pd.read_msgpack('foo.msg', iterator=True):
848846
print(o)

doc/source/whatsnew/v1.0.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,7 @@ or ``matplotlib.Axes.plot``. See :ref:`plotting.formatters` for more.
628628
- Removed previously deprecated ``errors`` argument in :meth:`Timestamp.tz_localize`, :meth:`DatetimeIndex.tz_localize`, and :meth:`Series.tz_localize` (:issue:`22644`)
629629
- Changed the default value for ``ordered`` in :class:`CategoricalDtype` from ``None`` to ``False`` (:issue:`26336`)
630630
- :meth:`Series.set_axis` and :meth:`DataFrame.set_axis` now require "labels" as the first argument and "axis" as an optional named parameter (:issue:`30089`)
631+
- Removed the previously deprecated :func:`to_msgpack`, :func:`read_msgpack`, :meth:`DataFrame.to_msgpack`, :meth:`Series.to_msgpack` (:issue:`27103`)
631632
-
632633
- Removed the previously deprecated keyword "fill_value" from :meth:`Categorical.fillna`, use "value" instead (:issue:`19269`)
633634
- Removed the previously deprecated keyword "data" from :func:`andrews_curves`, use "frame" instead (:issue:`6956`)

pandas/__init__.py

-3
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,6 @@
148148
ExcelFile,
149149
ExcelWriter,
150150
read_excel,
151-
# packers
152-
read_msgpack,
153-
to_msgpack,
154151
# parsers
155152
read_csv,
156153
read_fwf,

0 commit comments

Comments
 (0)