Skip to content

Commit 8cce3b2

Browse files
committed
Revert "DEPS: Bump cython 3.0 (pandas-dev#54335)"
This reverts commit 4cf63ea.
1 parent f702b77 commit 8cce3b2

34 files changed

+50
-66
lines changed

asv_bench/asv.conf.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
// pip (with all the conda available packages installed first,
4242
// followed by the pip installed packages).
4343
"matrix": {
44-
"Cython": ["3.0.0"],
44+
"Cython": ["0.29.33"],
4545
"matplotlib": [],
4646
"sqlalchemy": [],
4747
"scipy": [],

ci/deps/actions-310.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies:
66

77
# build dependencies
88
- versioneer[toml]
9-
- cython>=3.0.0
9+
- cython>=0.29.33
1010
- meson[ninja]=1.0.1
1111
- meson-python=0.13.1
1212

ci/deps/actions-311-downstream_compat.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dependencies:
77

88
# build dependencies
99
- versioneer[toml]
10-
- cython>=3.0.0
10+
- cython>=0.29.33
1111
- meson[ninja]=1.0.1
1212
- meson-python=0.13.1
1313

ci/deps/actions-311-pyarrownightly.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dependencies:
77
# build dependencies
88
- versioneer[toml]
99
- meson[ninja]=1.0.1
10-
- cython>=3.0.0
10+
- cython>=0.29.33
1111
- meson-python=0.13.1
1212

1313
# test dependencies

ci/deps/actions-311.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies:
66

77
# build dependencies
88
- versioneer[toml]
9-
- cython>=3.0.0
9+
- cython>=0.29.33
1010
- meson[ninja]=1.0.1
1111
- meson-python=0.13.1
1212

ci/deps/actions-39-minimum_versions.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dependencies:
88

99
# build dependencies
1010
- versioneer[toml]
11-
- cython>=3.0.0
11+
- cython>=0.29.33
1212
- meson[ninja]=1.0.1
1313
- meson-python=0.13.1
1414

ci/deps/actions-39.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies:
66

77
# build dependencies
88
- versioneer[toml]
9-
- cython>=3.0.0
9+
- cython>=0.29.33
1010
- meson[ninja]=1.0.1
1111
- meson-python=0.13.1
1212

ci/deps/actions-pypy-39.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dependencies:
99

1010
# build dependencies
1111
- versioneer[toml]
12-
- cython>=3.0.0
12+
- cython>=0.29.33
1313
- meson[ninja]=1.0.1
1414
- meson-python=0.13.1
1515

ci/deps/circle-310-arm64.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies:
66

77
# build dependencies
88
- versioneer[toml]
9-
- cython>=3.0.0
9+
- cython>=0.29.33
1010
- meson[ninja]=1.0.1
1111
- meson-python=0.13.1
1212

doc/source/whatsnew/v2.1.0.rst

-1
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,6 @@ Other
873873
- Bug in :meth:`Series.memory_usage` when ``deep=True`` throw an error with Series of objects and the returned value is incorrect, as it does not take into account GC corrections (:issue:`51858`)
874874
- Bug in :meth:`period_range` the default behavior when freq was not passed as an argument was incorrect(:issue:`53687`)
875875
- Fixed incorrect ``__name__`` attribute of ``pandas._libs.json`` (:issue:`52898`)
876-
- The minimum version of Cython needed to compile pandas is now ``3.0.0`` (:issue:`54335`)
877876

878877
.. ---------------------------------------------------------------------------
879878
.. _whatsnew_210.contributors:

environment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dependencies:
88

99
# build dependencies
1010
- versioneer[toml]
11-
- cython=3.0.0
11+
- cython=0.29.33
1212
- meson[ninja]=1.0.1
1313
- meson-python=0.13.1
1414

pandas/_libs/arrays.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class NDArrayBacked:
2626
def size(self) -> int: ...
2727
@property
2828
def nbytes(self) -> int: ...
29-
def copy(self, order=...): ...
29+
def copy(self): ...
3030
def delete(self, loc, axis=...): ...
3131
def swapaxes(self, axis1, axis2): ...
3232
def repeat(self, repeats: int | Sequence[int], axis: int | None = ...): ...

pandas/_libs/groupby.pyi

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def group_fillna_indexer(
4444
labels: np.ndarray, # ndarray[int64_t]
4545
sorted_labels: npt.NDArray[np.intp],
4646
mask: npt.NDArray[np.uint8],
47+
direction: Literal["ffill", "bfill"],
4748
limit: int, # int64_t
4849
dropna: bool,
4950
) -> None: ...
@@ -54,7 +55,7 @@ def group_any_all(
5455
mask: np.ndarray, # const uint8_t[::1]
5556
val_test: Literal["any", "all"],
5657
skipna: bool,
57-
result_mask: np.ndarray | None,
58+
nullable: bool,
5859
) -> None: ...
5960
def group_sum(
6061
out: np.ndarray, # complexfloatingintuint_t[:, ::1]

pandas/_libs/hashtable.pyi

+4-5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class Factorizer:
2020
def factorize(
2121
self,
2222
values: np.ndarray,
23+
sort: bool = ...,
2324
na_sentinel=...,
2425
na_value=...,
2526
mask=...,
@@ -156,9 +157,9 @@ class HashTable:
156157
def __contains__(self, key: Hashable) -> bool: ...
157158
def sizeof(self, deep: bool = ...) -> int: ...
158159
def get_state(self) -> dict[str, int]: ...
159-
# TODO: `val/key` type is subclass-specific
160-
def get_item(self, val): ... # TODO: return type?
161-
def set_item(self, key, val) -> None: ...
160+
# TODO: `item` type is subclass-specific
161+
def get_item(self, item): ... # TODO: return type?
162+
def set_item(self, item, val) -> None: ...
162163
def get_na(self): ... # TODO: return type?
163164
def set_na(self, val) -> None: ...
164165
def map_locations(
@@ -184,7 +185,6 @@ class HashTable:
184185
self,
185186
values: np.ndarray, # np.ndarray[subclass-specific]
186187
return_inverse: bool = ...,
187-
mask=...,
188188
) -> (
189189
tuple[
190190
np.ndarray, # np.ndarray[subclass-specific]
@@ -198,7 +198,6 @@ class HashTable:
198198
na_sentinel: int = ...,
199199
na_value: object = ...,
200200
mask=...,
201-
ignore_na: bool = True,
202201
) -> tuple[np.ndarray, npt.NDArray[np.intp]]: ... # np.ndarray[subclass-specific]
203202

204203
class Complex128HashTable(HashTable): ...

pandas/_libs/hashtable_class_helper.pxi.in

+2-4
Original file line numberDiff line numberDiff line change
@@ -1239,10 +1239,9 @@ cdef class StringHashTable(HashTable):
12391239
na_value=na_value, ignore_na=ignore_na,
12401240
return_inverse=True)
12411241

1242-
# Add unused mask parameter for compat with other signatures
12431242
def get_labels(self, ndarray[object] values, ObjectVector uniques,
12441243
Py_ssize_t count_prior=0, Py_ssize_t na_sentinel=-1,
1245-
object na_value=None, object mask=None):
1244+
object na_value=None):
12461245
# -> np.ndarray[np.intp]
12471246
_, labels = self._unique(values, uniques, count_prior=count_prior,
12481247
na_sentinel=na_sentinel, na_value=na_value,
@@ -1497,10 +1496,9 @@ cdef class PyObjectHashTable(HashTable):
14971496
na_value=na_value, ignore_na=ignore_na,
14981497
return_inverse=True)
14991498

1500-
# Add unused mask parameter for compat with other signatures
15011499
def get_labels(self, ndarray[object] values, ObjectVector uniques,
15021500
Py_ssize_t count_prior=0, Py_ssize_t na_sentinel=-1,
1503-
object na_value=None, object mask=None):
1501+
object na_value=None):
15041502
# -> np.ndarray[np.intp]
15051503
_, labels = self._unique(values, uniques, count_prior=count_prior,
15061504
na_sentinel=na_sentinel, na_value=na_value,

pandas/_libs/lib.pyi

+10-12
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,22 @@ def is_scalar(val: object) -> bool: ...
4545
def is_list_like(obj: object, allow_sets: bool = ...) -> bool: ...
4646
def is_pyarrow_array(obj: object) -> bool: ...
4747
def is_period(val: object) -> TypeGuard[Period]: ...
48-
def is_interval(obj: object) -> TypeGuard[Interval]: ...
49-
def is_decimal(obj: object) -> TypeGuard[Decimal]: ...
50-
def is_complex(obj: object) -> TypeGuard[complex]: ...
51-
def is_bool(obj: object) -> TypeGuard[bool | np.bool_]: ...
52-
def is_integer(obj: object) -> TypeGuard[int | np.integer]: ...
48+
def is_interval(val: object) -> TypeGuard[Interval]: ...
49+
def is_decimal(val: object) -> TypeGuard[Decimal]: ...
50+
def is_complex(val: object) -> TypeGuard[complex]: ...
51+
def is_bool(val: object) -> TypeGuard[bool | np.bool_]: ...
52+
def is_integer(val: object) -> TypeGuard[int | np.integer]: ...
5353
def is_int_or_none(obj) -> bool: ...
54-
def is_float(obj: object) -> TypeGuard[float]: ...
54+
def is_float(val: object) -> TypeGuard[float]: ...
5555
def is_interval_array(values: np.ndarray) -> bool: ...
56-
def is_datetime64_array(values: np.ndarray, skipna: bool = True) -> bool: ...
57-
def is_timedelta_or_timedelta64_array(
58-
values: np.ndarray, skipna: bool = True
59-
) -> bool: ...
56+
def is_datetime64_array(values: np.ndarray) -> bool: ...
57+
def is_timedelta_or_timedelta64_array(values: np.ndarray) -> bool: ...
6058
def is_datetime_with_singletz_array(values: np.ndarray) -> bool: ...
6159
def is_time_array(values: np.ndarray, skipna: bool = ...): ...
6260
def is_date_array(values: np.ndarray, skipna: bool = ...): ...
6361
def is_datetime_array(values: np.ndarray, skipna: bool = ...): ...
6462
def is_string_array(values: np.ndarray, skipna: bool = ...): ...
65-
def is_float_array(values: np.ndarray): ...
63+
def is_float_array(values: np.ndarray, skipna: bool = ...): ...
6664
def is_integer_array(values: np.ndarray, skipna: bool = ...): ...
6765
def is_bool_array(values: np.ndarray, skipna: bool = ...): ...
6866
def fast_multiget(mapping: dict, keys: np.ndarray, default=...) -> np.ndarray: ...
@@ -183,7 +181,7 @@ def count_level_2d(
183181
max_bin: int,
184182
) -> np.ndarray: ... # np.ndarray[np.int64, ndim=2]
185183
def get_level_sorter(
186-
codes: np.ndarray, # const int64_t[:]
184+
label: np.ndarray, # const int64_t[:]
187185
starts: np.ndarray, # const intp_t[:]
188186
) -> np.ndarray: ... # np.ndarray[np.intp, ndim=1]
189187
def generate_bins_dt64(

pandas/_libs/ops.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ def vec_binop(
3737
@overload
3838
def maybe_convert_bool(
3939
arr: npt.NDArray[np.object_],
40-
true_values: Iterable | None = None,
41-
false_values: Iterable | None = None,
40+
true_values: Iterable = ...,
41+
false_values: Iterable = ...,
4242
convert_to_masked_nullable: Literal[False] = ...,
4343
) -> tuple[np.ndarray, None]: ...
4444
@overload

pandas/_libs/sparse.pyi

-4
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ class BlockIndex(SparseIndex):
3939
self, length: int, blocs: np.ndarray, blengths: np.ndarray
4040
) -> None: ...
4141

42-
# Override to have correct parameters
43-
def intersect(self, other: SparseIndex) -> Self: ...
44-
def make_union(self, y: SparseIndex) -> Self: ...
45-
4642
def make_mask_object_ndarray(
4743
arr: npt.NDArray[np.object_], fill_value
4844
) -> npt.NDArray[np.bool_]: ...

pandas/_libs/tslibs/conversion.pyi

-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,5 @@ TD64NS_DTYPE: np.dtype
1010

1111
def precision_from_unit(
1212
unit: str,
13-
out_reso: int = ...,
1413
) -> tuple[int, int]: ... # (int64_t, _)
1514
def localize_pydatetime(dt: datetime, tz: tzinfo | None) -> datetime: ...

pandas/_libs/tslibs/dtypes.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ from enum import Enum
55
_attrname_to_abbrevs: dict[str, str]
66
_period_code_map: dict[str, int]
77

8-
def periods_per_day(reso: int = ...) -> int: ...
8+
def periods_per_day(reso: int) -> int: ...
99
def periods_per_second(reso: int) -> int: ...
1010
def is_supported_unit(reso: int) -> bool: ...
11-
def npy_unit_to_abbrev(unit: int) -> str: ...
11+
def npy_unit_to_abbrev(reso: int) -> str: ...
1212
def get_supported_reso(reso: int) -> int: ...
1313
def abbrev_to_npy_unit(abbrev: str) -> int: ...
1414

pandas/_libs/tslibs/np_datetime.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class OutOfBoundsTimedelta(ValueError): ...
99
def py_get_unit_from_dtype(dtype: np.dtype): ...
1010
def py_td64_to_tdstruct(td64: int, unit: int) -> dict: ...
1111
def astype_overflowsafe(
12-
values: np.ndarray,
12+
arr: np.ndarray,
1313
dtype: np.dtype,
1414
copy: bool = ...,
1515
round_ok: bool = ...,

pandas/_libs/tslibs/offsets.pyi

+1-4
Original file line numberDiff line numberDiff line change
@@ -277,10 +277,7 @@ def roll_qtrday(
277277
INVALID_FREQ_ERR_MSG: Literal["Invalid frequency: {0}"]
278278

279279
def shift_months(
280-
dtindex: npt.NDArray[np.int64],
281-
months: int,
282-
day_opt: str | None = ...,
283-
reso: int = ...,
280+
dtindex: npt.NDArray[np.int64], months: int, day_opt: str | None = ...
284281
) -> npt.NDArray[np.int64]: ...
285282

286283
_offset_map: dict[str, BaseOffset]

pandas/_libs/tslibs/period.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class Period(PeriodMixin):
8989
@classmethod
9090
def _from_ordinal(cls, ordinal: int, freq) -> Period: ...
9191
@classmethod
92-
def now(cls, freq: BaseOffset) -> Period: ...
92+
def now(cls, freq: BaseOffset = ...) -> Period: ...
9393
def strftime(self, fmt: str) -> str: ...
9494
def to_timestamp(
9595
self,

pandas/_libs/tslibs/period.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2511,7 +2511,7 @@ cdef class _Period(PeriodMixin):
25112511
object_state = None, self.freq, self.ordinal
25122512
return (Period, object_state)
25132513

2514-
def strftime(self, fmt: str | None) -> str:
2514+
def strftime(self, fmt: str) -> str:
25152515
r"""
25162516
Returns a formatted string representation of the :class:`Period`.
25172517

pandas/_libs/tslibs/timedeltas.pyi

+3-5
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ UnitChoices: TypeAlias = Literal[
6868
_S = TypeVar("_S", bound=timedelta)
6969

7070
def ints_to_pytimedelta(
71-
m8values: npt.NDArray[np.timedelta64],
71+
arr: npt.NDArray[np.timedelta64],
7272
box: bool = ...,
7373
) -> npt.NDArray[np.object_]: ...
7474
def array_to_timedelta64(
@@ -162,10 +162,8 @@ class Timedelta(timedelta):
162162
def __gt__(self, other: timedelta) -> bool: ...
163163
def __hash__(self) -> int: ...
164164
def isoformat(self) -> str: ...
165-
def to_numpy(
166-
self, dtype: npt.DTypeLike = ..., copy: bool = False
167-
) -> np.timedelta64: ...
168-
def view(self, dtype: npt.DTypeLike) -> object: ...
165+
def to_numpy(self) -> np.timedelta64: ...
166+
def view(self, dtype: npt.DTypeLike = ...) -> object: ...
169167
@property
170168
def unit(self) -> str: ...
171169
def as_unit(self, unit: str, round_ok: bool = ...) -> Timedelta: ...

pandas/_libs/tslibs/timestamps.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ class Timestamp(datetime):
180180
def is_year_end(self) -> bool: ...
181181
def to_pydatetime(self, warn: bool = ...) -> datetime: ...
182182
def to_datetime64(self) -> np.datetime64: ...
183-
def to_period(self, freq: BaseOffset | str | None = None) -> Period: ...
183+
def to_period(self, freq: BaseOffset | str = ...) -> Period: ...
184184
def to_julian_date(self) -> np.float64: ...
185185
@property
186186
def asm8(self) -> np.datetime64: ...

pandas/_libs/tslibs/tzconversion.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ from pandas._typing import npt
1010

1111
# tz_convert_from_utc_single exposed for testing
1212
def tz_convert_from_utc_single(
13-
utc_val: np.int64, tz: tzinfo, creso: int = ...
13+
val: np.int64, tz: tzinfo, creso: int = ...
1414
) -> np.int64: ...
1515
def tz_localize_to_utc(
1616
vals: npt.NDArray[np.int64],

pandas/_libs/tslibs/vectorized.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def get_resolution(
3131
reso: int = ..., # NPY_DATETIMEUNIT
3232
) -> Resolution: ...
3333
def ints_to_pydatetime(
34-
stamps: npt.NDArray[np.int64],
34+
arr: npt.NDArray[np.int64],
3535
tz: tzinfo | None = ...,
3636
box: str = ...,
3737
reso: int = ..., # NPY_DATETIMEUNIT

pandas/_libs/window/aggregations.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ def ewm(
111111
com: float, # float64_t
112112
adjust: bool,
113113
ignore_na: bool,
114-
deltas: np.ndarray | None = None, # const float64_t[:]
115-
normalize: bool = True,
114+
deltas: np.ndarray, # const float64_t[:]
115+
normalize: bool,
116116
) -> np.ndarray: ... # np.ndarray[np.float64]
117117
def ewmcov(
118118
input_x: np.ndarray, # const float64_t[:]

pandas/core/arrays/datetimelike.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -2260,7 +2260,8 @@ def _concat_same_type(
22602260
return new_obj
22612261

22622262
def copy(self, order: str = "C") -> Self:
2263-
new_obj = super().copy(order=order)
2263+
# error: Unexpected keyword argument "order" for "copy"
2264+
new_obj = super().copy(order=order) # type: ignore[call-arg]
22642265
new_obj._freq = self.freq
22652266
return new_obj
22662267

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ requires = [
55
"meson-python==0.13.1",
66
"meson==1.0.1",
77
"wheel",
8-
"Cython>=3.0.0", # Note: sync with setup.py, environment.yml and asv.conf.json
8+
"Cython>=0.29.33,<3", # Note: sync with setup.py, environment.yml and asv.conf.json
99
# Note: numpy 1.25 has a backwards compatible C API by default
1010
# we don't want to force users to compile with 1.25 though
1111
# (Ideally, in the future, though, oldest-supported-numpy can be dropped when our min numpy is 1.25.x)

requirements-dev.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
pip
55
versioneer[toml]
6-
cython==3.0.0
6+
cython==0.29.33
77
meson[ninja]==1.0.1
88
meson-python==0.13.1
99
pytest>=7.3.2

0 commit comments

Comments
 (0)