This is an automated email from the ASF dual-hosted git repository.
apitrou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new 6f23099452 ARROW-17010: [Python] Remove deprecated APIs from <= 1.0.0
(top-level ipc, Value scalar classes, pyarrow.compat module) (#13545)
6f23099452 is described below
commit 6f230994527ac91340dca6ca4bf21610c1445f2f
Author: Joris Van den Bossche <[email protected]>
AuthorDate: Mon Jul 11 14:18:47 2022 +0200
ARROW-17010: [Python] Remove deprecated APIs from <= 1.0.0 (top-level ipc,
Value scalar classes, pyarrow.compat module) (#13545)
A first set of easy removals of deprecated functions / classes in the
top-level namespace and the `pyarrow.compat` module.
Authored-by: Joris Van den Bossche <[email protected]>
Signed-off-by: Antoine Pitrou <[email protected]>
---
python/pyarrow/__init__.py | 72 --------------------------------
python/pyarrow/compat.py | 29 -------------
python/pyarrow/tests/test_ipc.py | 17 --------
python/pyarrow/tests/test_scalars.py | 80 ++++++++++++++++--------------------
4 files changed, 36 insertions(+), 162 deletions(-)
diff --git a/python/pyarrow/__init__.py b/python/pyarrow/__init__.py
index 987ed8bc31..a030a53e37 100644
--- a/python/pyarrow/__init__.py
+++ b/python/pyarrow/__init__.py
@@ -359,78 +359,6 @@ def _plasma_store_entry_point():
from pyarrow.util import _deprecate_api, _deprecate_class
-read_message = _deprecate_api("read_message", "ipc.read_message",
- ipc.read_message, "0.17.0")
-
-read_record_batch = _deprecate_api("read_record_batch",
- "ipc.read_record_batch",
- ipc.read_record_batch, "0.17.0")
-
-read_schema = _deprecate_api("read_schema", "ipc.read_schema",
- ipc.read_schema, "0.17.0")
-
-read_tensor = _deprecate_api("read_tensor", "ipc.read_tensor",
- ipc.read_tensor, "0.17.0")
-
-write_tensor = _deprecate_api("write_tensor", "ipc.write_tensor",
- ipc.write_tensor, "0.17.0")
-
-get_record_batch_size = _deprecate_api("get_record_batch_size",
- "ipc.get_record_batch_size",
- ipc.get_record_batch_size, "0.17.0")
-
-get_tensor_size = _deprecate_api("get_tensor_size",
- "ipc.get_tensor_size",
- ipc.get_tensor_size, "0.17.0")
-
-open_stream = _deprecate_api("open_stream", "ipc.open_stream",
- ipc.open_stream, "0.17.0")
-
-open_file = _deprecate_api("open_file", "ipc.open_file", ipc.open_file,
- "0.17.0")
-
-
-def _deprecate_scalar(ty, symbol):
- return _deprecate_class("{}Value".format(ty), symbol, "1.0.0")
-
-
-ArrayValue = _deprecate_class("ArrayValue", Scalar, "1.0.0")
-NullType = _deprecate_class("NullType", NullScalar, "1.0.0")
-
-BooleanValue = _deprecate_scalar("Boolean", BooleanScalar)
-Int8Value = _deprecate_scalar("Int8", Int8Scalar)
-Int16Value = _deprecate_scalar("Int16", Int16Scalar)
-Int32Value = _deprecate_scalar("Int32", Int32Scalar)
-Int64Value = _deprecate_scalar("Int64", Int64Scalar)
-UInt8Value = _deprecate_scalar("UInt8", UInt8Scalar)
-UInt16Value = _deprecate_scalar("UInt16", UInt16Scalar)
-UInt32Value = _deprecate_scalar("UInt32", UInt32Scalar)
-UInt64Value = _deprecate_scalar("UInt64", UInt64Scalar)
-HalfFloatValue = _deprecate_scalar("HalfFloat", HalfFloatScalar)
-FloatValue = _deprecate_scalar("Float", FloatScalar)
-DoubleValue = _deprecate_scalar("Double", DoubleScalar)
-ListValue = _deprecate_scalar("List", ListScalar)
-LargeListValue = _deprecate_scalar("LargeList", LargeListScalar)
-MapValue = _deprecate_scalar("Map", MapScalar)
-FixedSizeListValue = _deprecate_scalar("FixedSizeList", FixedSizeListScalar)
-BinaryValue = _deprecate_scalar("Binary", BinaryScalar)
-StringValue = _deprecate_scalar("String", StringScalar)
-LargeBinaryValue = _deprecate_scalar("LargeBinary", LargeBinaryScalar)
-LargeStringValue = _deprecate_scalar("LargeString", LargeStringScalar)
-FixedSizeBinaryValue = _deprecate_scalar("FixedSizeBinary",
- FixedSizeBinaryScalar)
-Decimal128Value = _deprecate_scalar("Decimal128", Decimal128Scalar)
-Decimal256Value = _deprecate_scalar("Decimal256", Decimal256Scalar)
-UnionValue = _deprecate_scalar("Union", UnionScalar)
-StructValue = _deprecate_scalar("Struct", StructScalar)
-DictionaryValue = _deprecate_scalar("Dictionary", DictionaryScalar)
-Date32Value = _deprecate_scalar("Date32", Date32Scalar)
-Date64Value = _deprecate_scalar("Date64", Date64Scalar)
-Time32Value = _deprecate_scalar("Time32", Time32Scalar)
-Time64Value = _deprecate_scalar("Time64", Time64Scalar)
-TimestampValue = _deprecate_scalar("Timestamp", TimestampScalar)
-DurationValue = _deprecate_scalar("Duration", DurationScalar)
-
# TODO: Deprecate these somehow in the pyarrow namespace
from pyarrow.ipc import (Message, MessageReader, MetadataVersion,
diff --git a/python/pyarrow/compat.py b/python/pyarrow/compat.py
deleted file mode 100644
index 814a51bef2..0000000000
--- a/python/pyarrow/compat.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# flake8: noqa
-
-import pyarrow.util as util
-import warnings
-
-
-warnings.warn("pyarrow.compat has been deprecated and will be removed in a "
- "future release", FutureWarning)
-
-
-guid = util._deprecate_api("compat.guid", "util.guid",
- util.guid, "1.0.0")
diff --git a/python/pyarrow/tests/test_ipc.py b/python/pyarrow/tests/test_ipc.py
index 31fd2a8f8a..1b4aaaed6d 100644
--- a/python/pyarrow/tests/test_ipc.py
+++ b/python/pyarrow/tests/test_ipc.py
@@ -1102,23 +1102,6 @@ def test_schema_serialization_with_metadata():
assert recons_schema[1].metadata == field_metadata
-def test_deprecated_pyarrow_ns_apis():
- table = pa.table([pa.array([1, 2, 3, 4])], names=['a'])
- sink = pa.BufferOutputStream()
- with pa.ipc.new_stream(sink, table.schema) as writer:
- writer.write(table)
-
- with pytest.warns(FutureWarning,
- match="please use pyarrow.ipc.open_stream"):
- pa.open_stream(sink.getvalue())
-
- sink = pa.BufferOutputStream()
- with pa.ipc.new_file(sink, table.schema) as writer:
- writer.write(table)
- with pytest.warns(FutureWarning, match="please use pyarrow.ipc.open_file"):
- pa.open_file(sink.getvalue())
-
-
def write_file(batch, sink):
with pa.ipc.new_file(sink, batch.schema) as writer:
writer.write_batch(batch)
diff --git a/python/pyarrow/tests/test_scalars.py
b/python/pyarrow/tests/test_scalars.py
index bdb6f53e5a..42486c1159 100644
--- a/python/pyarrow/tests/test_scalars.py
+++ b/python/pyarrow/tests/test_scalars.py
@@ -26,51 +26,46 @@ import numpy as np
import pyarrow as pa
[email protected](['value', 'ty', 'klass', 'deprecated'], [
- (False, None, pa.BooleanScalar, pa.BooleanValue),
- (True, None, pa.BooleanScalar, pa.BooleanValue),
- (1, None, pa.Int64Scalar, pa.Int64Value),
- (-1, None, pa.Int64Scalar, pa.Int64Value),
- (1, pa.int8(), pa.Int8Scalar, pa.Int8Value),
- (1, pa.uint8(), pa.UInt8Scalar, pa.UInt8Value),
- (1, pa.int16(), pa.Int16Scalar, pa.Int16Value),
- (1, pa.uint16(), pa.UInt16Scalar, pa.UInt16Value),
- (1, pa.int32(), pa.Int32Scalar, pa.Int32Value),
- (1, pa.uint32(), pa.UInt32Scalar, pa.UInt32Value),
- (1, pa.int64(), pa.Int64Scalar, pa.Int64Value),
- (1, pa.uint64(), pa.UInt64Scalar, pa.UInt64Value),
- (1.0, None, pa.DoubleScalar, pa.DoubleValue),
- (np.float16(1.0), pa.float16(), pa.HalfFloatScalar, pa.HalfFloatValue),
- (1.0, pa.float32(), pa.FloatScalar, pa.FloatValue),
- (decimal.Decimal("1.123"), None, pa.Decimal128Scalar, pa.Decimal128Value),
[email protected](['value', 'ty', 'klass'], [
+ (False, None, pa.BooleanScalar),
+ (True, None, pa.BooleanScalar),
+ (1, None, pa.Int64Scalar),
+ (-1, None, pa.Int64Scalar),
+ (1, pa.int8(), pa.Int8Scalar),
+ (1, pa.uint8(), pa.UInt8Scalar),
+ (1, pa.int16(), pa.Int16Scalar),
+ (1, pa.uint16(), pa.UInt16Scalar),
+ (1, pa.int32(), pa.Int32Scalar),
+ (1, pa.uint32(), pa.UInt32Scalar),
+ (1, pa.int64(), pa.Int64Scalar),
+ (1, pa.uint64(), pa.UInt64Scalar),
+ (1.0, None, pa.DoubleScalar),
+ (np.float16(1.0), pa.float16(), pa.HalfFloatScalar),
+ (1.0, pa.float32(), pa.FloatScalar),
+ (decimal.Decimal("1.123"), None, pa.Decimal128Scalar),
(decimal.Decimal("1.1234567890123456789012345678901234567890"),
- None, pa.Decimal256Scalar, pa.Decimal256Value),
- ("string", None, pa.StringScalar, pa.StringValue),
- (b"bytes", None, pa.BinaryScalar, pa.BinaryValue),
- ("largestring", pa.large_string(), pa.LargeStringScalar,
- pa.LargeStringValue),
- (b"largebytes", pa.large_binary(), pa.LargeBinaryScalar,
- pa.LargeBinaryValue),
- (b"abc", pa.binary(3), pa.FixedSizeBinaryScalar, pa.FixedSizeBinaryValue),
- ([1, 2, 3], None, pa.ListScalar, pa.ListValue),
- ([1, 2, 3, 4], pa.large_list(pa.int8()), pa.LargeListScalar,
- pa.LargeListValue),
- ([1, 2, 3, 4, 5], pa.list_(pa.int8(), 5), pa.FixedSizeListScalar,
- pa.FixedSizeListValue),
- (datetime.date.today(), None, pa.Date32Scalar, pa.Date32Value),
- (datetime.date.today(), pa.date64(), pa.Date64Scalar, pa.Date64Value),
- (datetime.datetime.now(), None, pa.TimestampScalar, pa.TimestampValue),
+ None, pa.Decimal256Scalar),
+ ("string", None, pa.StringScalar),
+ (b"bytes", None, pa.BinaryScalar),
+ ("largestring", pa.large_string(), pa.LargeStringScalar),
+ (b"largebytes", pa.large_binary(), pa.LargeBinaryScalar),
+ (b"abc", pa.binary(3), pa.FixedSizeBinaryScalar),
+ ([1, 2, 3], None, pa.ListScalar),
+ ([1, 2, 3, 4], pa.large_list(pa.int8()), pa.LargeListScalar),
+ ([1, 2, 3, 4, 5], pa.list_(pa.int8(), 5), pa.FixedSizeListScalar),
+ (datetime.date.today(), None, pa.Date32Scalar),
+ (datetime.date.today(), pa.date64(), pa.Date64Scalar),
+ (datetime.datetime.now(), None, pa.TimestampScalar),
(datetime.datetime.now().time().replace(microsecond=0), pa.time32('s'),
- pa.Time32Scalar, pa.Time32Value),
- (datetime.datetime.now().time(), None, pa.Time64Scalar, pa.Time64Value),
- (datetime.timedelta(days=1), None, pa.DurationScalar, pa.DurationValue),
+ pa.Time32Scalar),
+ (datetime.datetime.now().time(), None, pa.Time64Scalar),
+ (datetime.timedelta(days=1), None, pa.DurationScalar),
(pa.MonthDayNano([1, -1, -10100]), None,
- pa.MonthDayNanoIntervalScalar, None),
- ({'a': 1, 'b': [1, 2]}, None, pa.StructScalar, pa.StructValue),
- ([('a', 1), ('b', 2)], pa.map_(pa.string(), pa.int8()), pa.MapScalar,
- pa.MapValue),
+ pa.MonthDayNanoIntervalScalar),
+ ({'a': 1, 'b': [1, 2]}, None, pa.StructScalar),
+ ([('a', 1), ('b', 2)], pa.map_(pa.string(), pa.int8()), pa.MapScalar),
])
-def test_basics(value, ty, klass, deprecated):
+def test_basics(value, ty, klass):
s = pa.scalar(value, type=ty)
assert isinstance(s, klass)
assert s.as_py() == value
@@ -80,9 +75,6 @@ def test_basics(value, ty, klass, deprecated):
assert hash(s) == hash(s)
assert s.is_valid is True
assert s != None # noqa: E711
- if deprecated is not None:
- with pytest.warns(FutureWarning):
- assert isinstance(s, deprecated)
s = pa.scalar(None, type=s.type)
assert s.is_valid is False