File tree 4 files changed +59
-3
lines changed
4 files changed +59
-3
lines changed Original file line number Diff line number Diff line change 92
92
- name : " Numpy Dev"
93
93
env_file : actions-311-numpydev.yaml
94
94
pattern : " not slow and not network and not single_cpu"
95
- test_args : " -W error::DeprecationWarning -W error::FutureWarning"
95
+ # Currently restricted the warnings that error to Deprecation Warnings from numpy
96
+ # done since pyarrow isn't compatible with numpydev always
97
+ # TODO: work with pyarrow to revert this?
98
+ test_args : " -W error::DeprecationWarning:numpy -W error::FutureWarning:numpy"
96
99
- name : " Pyarrow Nightly"
97
100
env_file : actions-311-pyarrownightly.yaml
98
101
pattern : " not slow and not network and not single_cpu"
Original file line number Diff line number Diff line change 202
202
FutureWarning ,
203
203
stacklevel = 2 ,
204
204
)
205
- # Don't allow users to use pandas.os or pandas.warnings
206
- del os , warnings
205
+
206
+ # DeprecationWarning for missing pyarrow
207
+ from pandas .compat .pyarrow import pa_version_under10p1 , pa_not_found
208
+
209
+ if pa_version_under10p1 :
210
+ # pyarrow is either too old or nonexistent, warn
211
+ from pandas .compat ._optional import VERSIONS
212
+
213
+ if pa_not_found :
214
+ pa_msg = "was not found to be installed on your system."
215
+ else :
216
+ pa_msg = (
217
+ f"was too old on your system - pyarrow { VERSIONS ['pyarrow' ]} "
218
+ "is the current minimum supported version as of this release."
219
+ )
220
+
221
+ warnings .warn (
222
+ f"""
223
+ Pyarrow will become a required dependency of pandas in the next major release of pandas (pandas 3.0),
224
+ (to allow more performant data types, such as the Arrow string type, and better interoperability with other libraries)
225
+ but { pa_msg }
226
+ If this would cause problems for you,
227
+ please provide us feedback at https://github.com/pandas-dev/pandas/issues/54466
228
+ """ , # noqa: E501
229
+ DeprecationWarning ,
230
+ stacklevel = 2 ,
231
+ )
232
+ del VERSIONS , pa_msg
233
+
234
+ # Delete all unnecessary imported modules
235
+ del pa_version_under10p1 , pa_not_found , warnings , os
207
236
208
237
# module level doc-string
209
238
__doc__ = """
Original file line number Diff line number Diff line change 8
8
import pyarrow as pa
9
9
10
10
_palv = Version (Version (pa .__version__ ).base_version )
11
+ pa_not_found = False
11
12
pa_version_under10p1 = _palv < Version ("10.0.1" )
12
13
pa_version_under11p0 = _palv < Version ("11.0.0" )
13
14
pa_version_under12p0 = _palv < Version ("12.0.0" )
16
17
pa_version_under14p1 = _palv < Version ("14.0.1" )
17
18
pa_version_under15p0 = _palv < Version ("15.0.0" )
18
19
except ImportError :
20
+ pa_not_found = True
19
21
pa_version_under10p1 = True
20
22
pa_version_under11p0 = True
21
23
pa_version_under12p0 = True
Original file line number Diff line number Diff line change 8
8
import numpy as np
9
9
import pytest
10
10
11
+ import pandas .util ._test_decorators as td
12
+
11
13
import pandas as pd
12
14
from pandas import Series
13
15
import pandas ._testing as tm
@@ -265,3 +267,23 @@ def test_bz2_missing_import():
265
267
code = textwrap .dedent (code )
266
268
call = [sys .executable , "-c" , code ]
267
269
subprocess .check_output (call )
270
+
271
+
272
+ @td .skip_if_installed ("pyarrow" )
273
+ @pytest .mark .parametrize ("module" , ["pandas" , "pandas.arrays" ])
274
+ def test_pyarrow_missing_warn (module ):
275
+ # GH56896
276
+ response = subprocess .run (
277
+ [sys .executable , "-c" , f"import { module } " ],
278
+ capture_output = True ,
279
+ check = True ,
280
+ )
281
+ msg = """
282
+ Pyarrow will become a required dependency of pandas in the next major release of pandas (pandas 3.0),
283
+ (to allow more performant data types, such as the Arrow string type, and better interoperability with other libraries)
284
+ but was not found to be installed on your system.
285
+ If this would cause problems for you,
286
+ please provide us feedback at https://github.com/pandas-dev/pandas/issues/54466
287
+ """ # noqa: E501
288
+ stderr_msg = response .stderr .decode ("utf-8" )
289
+ assert msg in stderr_msg , stderr_msg
You can’t perform that action at this time.
0 commit comments