From b8516469373693c8dbcbd3944d881a2fff72181e Mon Sep 17 00:00:00 2001 From: Richard Shadrach Date: Sat, 16 Sep 2023 11:35:49 -0400 Subject: [PATCH 1/8] DEP: Use Cython 3.0 --- asv_bench/asv.conf.json | 2 +- environment.yml | 2 +- pyproject.toml | 2 +- requirements-dev.txt | 2 +- setup.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/asv_bench/asv.conf.json b/asv_bench/asv.conf.json index 810764754b7e1..ad54ab0e1a5fd 100644 --- a/asv_bench/asv.conf.json +++ b/asv_bench/asv.conf.json @@ -41,7 +41,7 @@ // pip (with all the conda available packages installed first, // followed by the pip installed packages). "matrix": { - "Cython": ["0.29.33"], + "Cython": ["3.0.2"], "matplotlib": [], "sqlalchemy": [], "scipy": [], diff --git a/environment.yml b/environment.yml index 5caa57ef37ee8..7e21ef8044f54 100644 --- a/environment.yml +++ b/environment.yml @@ -8,7 +8,7 @@ dependencies: # build dependencies - versioneer[toml] - - cython=0.29.33 + - cython=3.0.2 - meson[ninja]=1.2.1 - meson-python=0.13.1 diff --git a/pyproject.toml b/pyproject.toml index 7807a6cc6368d..5b79257468b96 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ requires = [ "meson-python==0.13.1", "meson==1.2.1", "wheel", - "Cython>=0.29.33,<3", # Note: sync with setup.py, environment.yml and asv.conf.json + "Cython==3.0.2", # Note: sync with setup.py, environment.yml and asv.conf.json # Note: numpy 1.25 has a backwards compatible C API by default # we don't want to force users to compile with 1.25 though # (Ideally, in the future, though, oldest-supported-numpy can be dropped when our min numpy is 1.25.x) diff --git a/requirements-dev.txt b/requirements-dev.txt index b8e7e376378c6..f24d5076dee70 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -3,7 +3,7 @@ pip versioneer[toml] -cython==0.29.33 +cython==3.0.2 meson[ninja]==1.2.1 meson-python==0.13.1 pytest>=7.3.2 diff --git a/setup.py b/setup.py index 663bbd3952eab..9bbf6b2f18386 100755 --- a/setup.py +++ b/setup.py @@ -37,7 +37,7 @@ def is_platform_mac(): # note: sync with pyproject.toml, environment.yml and asv.conf.json -min_cython_ver = "0.29.33" +min_cython_ver = "3.0.2" try: from Cython import ( From 0198fccdf4d3ec8fafeadb37999792e38b3b9848 Mon Sep 17 00:00:00 2001 From: Richard Shadrach Date: Fri, 13 Oct 2023 17:17:51 -0400 Subject: [PATCH 2/8] Cython 3.0.3 --- asv_bench/asv.conf.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asv_bench/asv.conf.json b/asv_bench/asv.conf.json index ad54ab0e1a5fd..7b738308fd919 100644 --- a/asv_bench/asv.conf.json +++ b/asv_bench/asv.conf.json @@ -41,7 +41,7 @@ // pip (with all the conda available packages installed first, // followed by the pip installed packages). "matrix": { - "Cython": ["3.0.2"], + "Cython": ["3.0.3"], "matplotlib": [], "sqlalchemy": [], "scipy": [], From 1c3d2dc197f9c9e861ab1ecd62218e857ee70490 Mon Sep 17 00:00:00 2001 From: Richard Shadrach Date: Fri, 27 Oct 2023 06:47:23 -0400 Subject: [PATCH 3/8] Update to Cython 3.0.4 --- asv_bench/asv.conf.json | 2 +- environment.yml | 2 +- requirements-dev.txt | 2 +- setup.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/asv_bench/asv.conf.json b/asv_bench/asv.conf.json index 7b738308fd919..452e593ee87ec 100644 --- a/asv_bench/asv.conf.json +++ b/asv_bench/asv.conf.json @@ -41,7 +41,7 @@ // pip (with all the conda available packages installed first, // followed by the pip installed packages). "matrix": { - "Cython": ["3.0.3"], + "Cython": ["3.0.4"], "matplotlib": [], "sqlalchemy": [], "scipy": [], diff --git a/environment.yml b/environment.yml index 28bb7e26cfffc..178512f537077 100644 --- a/environment.yml +++ b/environment.yml @@ -8,7 +8,7 @@ dependencies: # build dependencies - versioneer[toml] - - cython=3.0.2 + - cython=3.0.4 - meson[ninja]=1.2.1 - meson-python=0.13.1 diff --git a/requirements-dev.txt b/requirements-dev.txt index fb49c1eba2566..18a1278e053ad 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -3,7 +3,7 @@ pip versioneer[toml] -cython==3.0.2 +cython==3.0.4 meson[ninja]==1.2.1 meson-python==0.13.1 pytest>=7.3.2 diff --git a/setup.py b/setup.py index fc30f71e3e384..d30a45b9a497a 100755 --- a/setup.py +++ b/setup.py @@ -37,7 +37,7 @@ def is_platform_mac(): # note: sync with pyproject.toml, environment.yml and asv.conf.json -min_cython_ver = "3.0.2" +min_cython_ver = "3.0.4" try: from Cython import ( From d57419ed97f16e62c301e0c0c30979a831ff9f29 Mon Sep 17 00:00:00 2001 From: Thomas Li <47963215+lithomas1@users.noreply.github.com> Date: Fri, 4 Aug 2023 10:11:27 -0700 Subject: [PATCH 4/8] Merge pyi updates --- pandas/_libs/arrays.pyi | 2 +- pandas/_libs/groupby.pyi | 3 +-- pandas/_libs/hashtable.pyi | 9 +++++---- pandas/_libs/hashtable_class_helper.pxi.in | 6 ++++-- pandas/_libs/lib.pyi | 22 ++++++++++++---------- pandas/_libs/ops.pyi | 4 ++-- pandas/_libs/sparse.pyi | 4 ++++ pandas/_libs/tslibs/conversion.pyi | 3 ++- pandas/_libs/tslibs/dtypes.pyi | 4 ++-- pandas/_libs/tslibs/np_datetime.pyi | 2 +- pandas/_libs/tslibs/timedeltas.pyi | 8 +++++--- pandas/_libs/tslibs/timestamps.pyi | 2 +- pandas/_libs/tslibs/tzconversion.pyi | 2 +- pandas/_libs/tslibs/vectorized.pyi | 2 +- pandas/_libs/window/aggregations.pyi | 4 ++-- scripts/run_stubtest.py | 2 ++ 16 files changed, 46 insertions(+), 33 deletions(-) diff --git a/pandas/_libs/arrays.pyi b/pandas/_libs/arrays.pyi index 78fee8f01319c..86f69c3cdfc75 100644 --- a/pandas/_libs/arrays.pyi +++ b/pandas/_libs/arrays.pyi @@ -26,7 +26,7 @@ class NDArrayBacked: def size(self) -> int: ... @property def nbytes(self) -> int: ... - def copy(self): ... + def copy(self, order=...): ... def delete(self, loc, axis=...): ... def swapaxes(self, axis1, axis2): ... def repeat(self, repeats: int | Sequence[int], axis: int | None = ...): ... diff --git a/pandas/_libs/groupby.pyi b/pandas/_libs/groupby.pyi index 609663c721950..135828a23648a 100644 --- a/pandas/_libs/groupby.pyi +++ b/pandas/_libs/groupby.pyi @@ -44,7 +44,6 @@ def group_fillna_indexer( labels: np.ndarray, # ndarray[int64_t] sorted_labels: npt.NDArray[np.intp], mask: npt.NDArray[np.uint8], - direction: Literal["ffill", "bfill"], limit: int, # int64_t dropna: bool, ) -> None: ... @@ -55,7 +54,7 @@ def group_any_all( mask: np.ndarray, # const uint8_t[::1] val_test: Literal["any", "all"], skipna: bool, - nullable: bool, + result_mask: np.ndarray | None, ) -> None: ... def group_sum( out: np.ndarray, # complexfloatingintuint_t[:, ::1] diff --git a/pandas/_libs/hashtable.pyi b/pandas/_libs/hashtable.pyi index 0ac914e86f699..555ec73acd9b2 100644 --- a/pandas/_libs/hashtable.pyi +++ b/pandas/_libs/hashtable.pyi @@ -20,7 +20,6 @@ class Factorizer: def factorize( self, values: np.ndarray, - sort: bool = ..., na_sentinel=..., na_value=..., mask=..., @@ -157,9 +156,9 @@ class HashTable: def __contains__(self, key: Hashable) -> bool: ... def sizeof(self, deep: bool = ...) -> int: ... def get_state(self) -> dict[str, int]: ... - # TODO: `item` type is subclass-specific - def get_item(self, item): ... # TODO: return type? - def set_item(self, item, val) -> None: ... + # TODO: `val/key` type is subclass-specific + def get_item(self, val): ... # TODO: return type? + def set_item(self, key, val) -> None: ... def get_na(self): ... # TODO: return type? def set_na(self, val) -> None: ... def map_locations( @@ -185,6 +184,7 @@ class HashTable: self, values: np.ndarray, # np.ndarray[subclass-specific] return_inverse: bool = ..., + mask=..., ) -> ( tuple[ np.ndarray, # np.ndarray[subclass-specific] @@ -198,6 +198,7 @@ class HashTable: na_sentinel: int = ..., na_value: object = ..., mask=..., + ignore_na: bool = True, ) -> tuple[np.ndarray, npt.NDArray[np.intp]]: ... # np.ndarray[subclass-specific] class Complex128HashTable(HashTable): ... diff --git a/pandas/_libs/hashtable_class_helper.pxi.in b/pandas/_libs/hashtable_class_helper.pxi.in index 1cf5d734705af..c0723392496c1 100644 --- a/pandas/_libs/hashtable_class_helper.pxi.in +++ b/pandas/_libs/hashtable_class_helper.pxi.in @@ -1239,9 +1239,10 @@ cdef class StringHashTable(HashTable): na_value=na_value, ignore_na=ignore_na, return_inverse=True) + # Add unused mask parameter for compat with other signatures def get_labels(self, ndarray[object] values, ObjectVector uniques, Py_ssize_t count_prior=0, Py_ssize_t na_sentinel=-1, - object na_value=None): + object na_value=None, object mask=None): # -> np.ndarray[np.intp] _, labels = self._unique(values, uniques, count_prior=count_prior, na_sentinel=na_sentinel, na_value=na_value, @@ -1496,9 +1497,10 @@ cdef class PyObjectHashTable(HashTable): na_value=na_value, ignore_na=ignore_na, return_inverse=True) + # Add unused mask parameter for compat with other signatures def get_labels(self, ndarray[object] values, ObjectVector uniques, Py_ssize_t count_prior=0, Py_ssize_t na_sentinel=-1, - object na_value=None): + object na_value=None, object mask=None): # -> np.ndarray[np.intp] _, labels = self._unique(values, uniques, count_prior=count_prior, na_sentinel=na_sentinel, na_value=na_value, diff --git a/pandas/_libs/lib.pyi b/pandas/_libs/lib.pyi index 15bd5a7379105..b2bea0521afa8 100644 --- a/pandas/_libs/lib.pyi +++ b/pandas/_libs/lib.pyi @@ -45,22 +45,24 @@ def is_scalar(val: object) -> bool: ... def is_list_like(obj: object, allow_sets: bool = ...) -> bool: ... def is_pyarrow_array(obj: object) -> bool: ... def is_period(val: object) -> TypeGuard[Period]: ... -def is_interval(val: object) -> TypeGuard[Interval]: ... -def is_decimal(val: object) -> TypeGuard[Decimal]: ... -def is_complex(val: object) -> TypeGuard[complex]: ... -def is_bool(val: object) -> TypeGuard[bool | np.bool_]: ... -def is_integer(val: object) -> TypeGuard[int | np.integer]: ... +def is_interval(obj: object) -> TypeGuard[Interval]: ... +def is_decimal(obj: object) -> TypeGuard[Decimal]: ... +def is_complex(obj: object) -> TypeGuard[complex]: ... +def is_bool(obj: object) -> TypeGuard[bool | np.bool_]: ... +def is_integer(obj: object) -> TypeGuard[int | np.integer]: ... def is_int_or_none(obj) -> bool: ... -def is_float(val: object) -> TypeGuard[float]: ... +def is_float(obj: object) -> TypeGuard[float]: ... def is_interval_array(values: np.ndarray) -> bool: ... -def is_datetime64_array(values: np.ndarray) -> bool: ... -def is_timedelta_or_timedelta64_array(values: np.ndarray) -> bool: ... +def is_datetime64_array(values: np.ndarray, skipna: bool = True) -> bool: ... +def is_timedelta_or_timedelta64_array( + values: np.ndarray, skipna: bool = True +) -> bool: ... def is_datetime_with_singletz_array(values: np.ndarray) -> bool: ... def is_time_array(values: np.ndarray, skipna: bool = ...): ... def is_date_array(values: np.ndarray, skipna: bool = ...): ... def is_datetime_array(values: np.ndarray, skipna: bool = ...): ... def is_string_array(values: np.ndarray, skipna: bool = ...): ... -def is_float_array(values: np.ndarray, skipna: bool = ...): ... +def is_float_array(values: np.ndarray): ... def is_integer_array(values: np.ndarray, skipna: bool = ...): ... def is_bool_array(values: np.ndarray, skipna: bool = ...): ... def fast_multiget(mapping: dict, keys: np.ndarray, default=...) -> np.ndarray: ... @@ -181,7 +183,7 @@ def count_level_2d( max_bin: int, ) -> np.ndarray: ... # np.ndarray[np.int64, ndim=2] def get_level_sorter( - label: np.ndarray, # const int64_t[:] + codes: np.ndarray, # const int64_t[:] starts: np.ndarray, # const intp_t[:] ) -> np.ndarray: ... # np.ndarray[np.intp, ndim=1] def generate_bins_dt64( diff --git a/pandas/_libs/ops.pyi b/pandas/_libs/ops.pyi index 515f7aa53ba15..6738a1dff4a9e 100644 --- a/pandas/_libs/ops.pyi +++ b/pandas/_libs/ops.pyi @@ -37,8 +37,8 @@ def vec_binop( @overload def maybe_convert_bool( arr: npt.NDArray[np.object_], - true_values: Iterable = ..., - false_values: Iterable = ..., + true_values: Iterable | None = None, + false_values: Iterable | None = None, convert_to_masked_nullable: Literal[False] = ..., ) -> tuple[np.ndarray, None]: ... @overload diff --git a/pandas/_libs/sparse.pyi b/pandas/_libs/sparse.pyi index 9e5cecc61e5ca..536265b25425e 100644 --- a/pandas/_libs/sparse.pyi +++ b/pandas/_libs/sparse.pyi @@ -39,6 +39,10 @@ class BlockIndex(SparseIndex): self, length: int, blocs: np.ndarray, blengths: np.ndarray ) -> None: ... + # Override to have correct parameters + def intersect(self, other: SparseIndex) -> Self: ... + def make_union(self, y: SparseIndex) -> Self: ... + def make_mask_object_ndarray( arr: npt.NDArray[np.object_], fill_value ) -> npt.NDArray[np.bool_]: ... diff --git a/pandas/_libs/tslibs/conversion.pyi b/pandas/_libs/tslibs/conversion.pyi index be75c2f2f68ea..6426e32c52304 100644 --- a/pandas/_libs/tslibs/conversion.pyi +++ b/pandas/_libs/tslibs/conversion.pyi @@ -9,6 +9,7 @@ DT64NS_DTYPE: np.dtype TD64NS_DTYPE: np.dtype def precision_from_unit( - in_reso: int, # NPY_DATETIMEUNIT + unit: str, + out_reso: int = ..., ) -> tuple[int, int]: ... # (int64_t, _) def localize_pydatetime(dt: datetime, tz: tzinfo | None) -> datetime: ... diff --git a/pandas/_libs/tslibs/dtypes.pyi b/pandas/_libs/tslibs/dtypes.pyi index d8680ed2d27b4..176e4295879c7 100644 --- a/pandas/_libs/tslibs/dtypes.pyi +++ b/pandas/_libs/tslibs/dtypes.pyi @@ -10,10 +10,10 @@ OFFSET_TO_PERIOD_FREQSTR: dict[str, str] OFFSET_DEPR_FREQSTR: dict[str, str] DEPR_ABBREVS: dict[str, UnitChoices] -def periods_per_day(reso: int) -> int: ... +def periods_per_day(reso: int = ...) -> int: ... def periods_per_second(reso: int) -> int: ... def is_supported_unit(reso: int) -> bool: ... -def npy_unit_to_abbrev(reso: int) -> str: ... +def npy_unit_to_abbrev(unit: int) -> str: ... def get_supported_reso(reso: int) -> int: ... def abbrev_to_npy_unit(abbrev: str) -> int: ... def freq_to_period_freqstr(freq_n: int, freq_name: str) -> str: ... diff --git a/pandas/_libs/tslibs/np_datetime.pyi b/pandas/_libs/tslibs/np_datetime.pyi index 0cb0e3b0237d7..c42bc43ac9d89 100644 --- a/pandas/_libs/tslibs/np_datetime.pyi +++ b/pandas/_libs/tslibs/np_datetime.pyi @@ -9,7 +9,7 @@ class OutOfBoundsTimedelta(ValueError): ... def py_get_unit_from_dtype(dtype: np.dtype): ... def py_td64_to_tdstruct(td64: int, unit: int) -> dict: ... def astype_overflowsafe( - arr: np.ndarray, + values: np.ndarray, dtype: np.dtype, copy: bool = ..., round_ok: bool = ..., diff --git a/pandas/_libs/tslibs/timedeltas.pyi b/pandas/_libs/tslibs/timedeltas.pyi index 181703c5f55b2..24ec6c8891a89 100644 --- a/pandas/_libs/tslibs/timedeltas.pyi +++ b/pandas/_libs/tslibs/timedeltas.pyi @@ -71,7 +71,7 @@ _S = TypeVar("_S", bound=timedelta) def get_unit_for_round(freq, creso: int) -> int: ... def disallow_ambiguous_unit(unit: str | None) -> None: ... def ints_to_pytimedelta( - arr: npt.NDArray[np.timedelta64], + m8values: npt.NDArray[np.timedelta64], box: bool = ..., ) -> npt.NDArray[np.object_]: ... def array_to_timedelta64( @@ -165,8 +165,10 @@ class Timedelta(timedelta): def __gt__(self, other: timedelta) -> bool: ... def __hash__(self) -> int: ... def isoformat(self) -> str: ... - def to_numpy(self) -> np.timedelta64: ... - def view(self, dtype: npt.DTypeLike = ...) -> object: ... + def to_numpy( + self, dtype: npt.DTypeLike = ..., copy: bool = False + ) -> np.timedelta64: ... + def view(self, dtype: npt.DTypeLike) -> object: ... @property def unit(self) -> str: ... def as_unit(self, unit: str, round_ok: bool = ...) -> Timedelta: ... diff --git a/pandas/_libs/tslibs/timestamps.pyi b/pandas/_libs/tslibs/timestamps.pyi index e23f01b800874..c78c174e27902 100644 --- a/pandas/_libs/tslibs/timestamps.pyi +++ b/pandas/_libs/tslibs/timestamps.pyi @@ -183,7 +183,7 @@ class Timestamp(datetime): def is_year_end(self) -> bool: ... def to_pydatetime(self, warn: bool = ...) -> datetime: ... def to_datetime64(self) -> np.datetime64: ... - def to_period(self, freq: BaseOffset | str = ...) -> Period: ... + def to_period(self, freq: BaseOffset | str | None = None) -> Period: ... def to_julian_date(self) -> np.float64: ... @property def asm8(self) -> np.datetime64: ... diff --git a/pandas/_libs/tslibs/tzconversion.pyi b/pandas/_libs/tslibs/tzconversion.pyi index a354765a348ec..2108fa0f35547 100644 --- a/pandas/_libs/tslibs/tzconversion.pyi +++ b/pandas/_libs/tslibs/tzconversion.pyi @@ -10,7 +10,7 @@ from pandas._typing import npt # tz_convert_from_utc_single exposed for testing def tz_convert_from_utc_single( - val: np.int64, tz: tzinfo, creso: int = ... + utc_val: np.int64, tz: tzinfo, creso: int = ... ) -> np.int64: ... def tz_localize_to_utc( vals: npt.NDArray[np.int64], diff --git a/pandas/_libs/tslibs/vectorized.pyi b/pandas/_libs/tslibs/vectorized.pyi index 3fd9e2501e611..de19f592da62b 100644 --- a/pandas/_libs/tslibs/vectorized.pyi +++ b/pandas/_libs/tslibs/vectorized.pyi @@ -31,7 +31,7 @@ def get_resolution( reso: int = ..., # NPY_DATETIMEUNIT ) -> Resolution: ... def ints_to_pydatetime( - arr: npt.NDArray[np.int64], + stamps: npt.NDArray[np.int64], tz: tzinfo | None = ..., box: str = ..., reso: int = ..., # NPY_DATETIMEUNIT diff --git a/pandas/_libs/window/aggregations.pyi b/pandas/_libs/window/aggregations.pyi index b926a7cb73425..a6cfbec9b15b9 100644 --- a/pandas/_libs/window/aggregations.pyi +++ b/pandas/_libs/window/aggregations.pyi @@ -111,8 +111,8 @@ def ewm( com: float, # float64_t adjust: bool, ignore_na: bool, - deltas: np.ndarray, # const float64_t[:] - normalize: bool, + deltas: np.ndarray | None = None, # const float64_t[:] + normalize: bool = True, ) -> np.ndarray: ... # np.ndarray[np.float64] def ewmcov( input_x: np.ndarray, # const float64_t[:] diff --git a/scripts/run_stubtest.py b/scripts/run_stubtest.py index dedcdb5532593..35cbbef08124e 100644 --- a/scripts/run_stubtest.py +++ b/scripts/run_stubtest.py @@ -47,6 +47,8 @@ # stubtest might be too sensitive "pandas._libs.lib.NoDefault", "pandas._libs.lib._NoDefault.no_default", + # stubtest/Cython is not recognizing the default value for the dtype parameter + "pandas._libs.lib.map_infer_mask", # internal type alias (should probably be private) "pandas._libs.lib.ndarray_obj_2d", # runtime argument "owner" has a default value but stub argument does not From a0c67b24afd9d86a730d4b1a865774a4b58132a4 Mon Sep 17 00:00:00 2001 From: Richard Shadrach Date: Thu, 9 Nov 2023 06:51:11 -0500 Subject: [PATCH 5/8] fixup --- pandas/_libs/tslibs/conversion.pyi | 2 +- pandas/core/arrays/datetimelike.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pandas/_libs/tslibs/conversion.pyi b/pandas/_libs/tslibs/conversion.pyi index 6426e32c52304..cbb7d44516d71 100644 --- a/pandas/_libs/tslibs/conversion.pyi +++ b/pandas/_libs/tslibs/conversion.pyi @@ -9,7 +9,7 @@ DT64NS_DTYPE: np.dtype TD64NS_DTYPE: np.dtype def precision_from_unit( - unit: str, + unit: int, out_reso: int = ..., ) -> tuple[int, int]: ... # (int64_t, _) def localize_pydatetime(dt: datetime, tz: tzinfo | None) -> datetime: ... diff --git a/pandas/core/arrays/datetimelike.py b/pandas/core/arrays/datetimelike.py index 33b2f65340a3b..d984164c543cf 100644 --- a/pandas/core/arrays/datetimelike.py +++ b/pandas/core/arrays/datetimelike.py @@ -2281,8 +2281,7 @@ def _concat_same_type( return new_obj def copy(self, order: str = "C") -> Self: - # error: Unexpected keyword argument "order" for "copy" - new_obj = super().copy(order=order) # type: ignore[call-arg] + new_obj = super().copy(order=order) new_obj._freq = self.freq return new_obj From 49cc4c27e10472bcff9e8e1fb4631e79b8cec2e7 Mon Sep 17 00:00:00 2001 From: Richard Shadrach Date: Tue, 14 Nov 2023 16:44:25 -0500 Subject: [PATCH 6/8] Update pyi files and upgrade to Cython 3.0.5 --- asv_bench/asv.conf.json | 2 +- doc/source/conf.py | 1 + environment.yml | 2 +- pandas/_libs/tslibs/conversion.pyi | 2 +- pandas/_libs/tslibs/period.pyi | 2 +- pandas/_libs/tslibs/strptime.pyi | 1 + requirements-dev.txt | 2 +- setup.py | 2 +- 8 files changed, 8 insertions(+), 6 deletions(-) diff --git a/asv_bench/asv.conf.json b/asv_bench/asv.conf.json index 452e593ee87ec..9b0dc14fe6747 100644 --- a/asv_bench/asv.conf.json +++ b/asv_bench/asv.conf.json @@ -41,7 +41,7 @@ // pip (with all the conda available packages installed first, // followed by the pip installed packages). "matrix": { - "Cython": ["3.0.4"], + "Cython": ["3.0.5"], "matplotlib": [], "sqlalchemy": [], "scipy": [], diff --git a/doc/source/conf.py b/doc/source/conf.py index 3f35e88cf543a..0ea4688a3a3d4 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -783,6 +783,7 @@ def rstjinja(app, docname, source): # Make sure we're outputting HTML if app.builder.format != "html": return + print(docname) src = source[0] rendered = app.builder.templates.render_string(src, app.config.html_context) source[0] = rendered diff --git a/environment.yml b/environment.yml index 4a0ed4490bf26..5b90b1620537f 100644 --- a/environment.yml +++ b/environment.yml @@ -8,7 +8,7 @@ dependencies: # build dependencies - versioneer[toml] - - cython=3.0.4 + - cython=3.0.5 - meson[ninja]=1.2.1 - meson-python=0.13.1 diff --git a/pandas/_libs/tslibs/conversion.pyi b/pandas/_libs/tslibs/conversion.pyi index cbb7d44516d71..a5f5d04efeb76 100644 --- a/pandas/_libs/tslibs/conversion.pyi +++ b/pandas/_libs/tslibs/conversion.pyi @@ -9,7 +9,7 @@ DT64NS_DTYPE: np.dtype TD64NS_DTYPE: np.dtype def precision_from_unit( - unit: int, + in_reso: int, out_reso: int = ..., ) -> tuple[int, int]: ... # (int64_t, _) def localize_pydatetime(dt: datetime, tz: tzinfo | None) -> datetime: ... diff --git a/pandas/_libs/tslibs/period.pyi b/pandas/_libs/tslibs/period.pyi index a4aecd2ce0a09..846d238beadbd 100644 --- a/pandas/_libs/tslibs/period.pyi +++ b/pandas/_libs/tslibs/period.pyi @@ -89,7 +89,7 @@ class Period(PeriodMixin): @classmethod def _from_ordinal(cls, ordinal: int, freq) -> Period: ... @classmethod - def now(cls, freq: Frequency = ...) -> Period: ... + def now(cls, freq: Frequency) -> Period: ... def strftime(self, fmt: str | None) -> str: ... def to_timestamp( self, diff --git a/pandas/_libs/tslibs/strptime.pyi b/pandas/_libs/tslibs/strptime.pyi index 4565bb7ecf959..0ec1a1e25a2b3 100644 --- a/pandas/_libs/tslibs/strptime.pyi +++ b/pandas/_libs/tslibs/strptime.pyi @@ -8,6 +8,7 @@ def array_strptime( exact: bool = ..., errors: str = ..., utc: bool = ..., + creso: int = ..., # NPY_DATETIMEUNIT ) -> tuple[np.ndarray, np.ndarray]: ... # first ndarray is M8[ns], second is object ndarray of tzinfo | None diff --git a/requirements-dev.txt b/requirements-dev.txt index d7fa48f0e5283..d11f51c45afcd 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -3,7 +3,7 @@ pip versioneer[toml] -cython==3.0.4 +cython==3.0.5 meson[ninja]==1.2.1 meson-python==0.13.1 pytest>=7.3.2 diff --git a/setup.py b/setup.py index d30a45b9a497a..d6fb4b775a351 100755 --- a/setup.py +++ b/setup.py @@ -37,7 +37,7 @@ def is_platform_mac(): # note: sync with pyproject.toml, environment.yml and asv.conf.json -min_cython_ver = "3.0.4" +min_cython_ver = "3.0.5" try: from Cython import ( From 71693857680f2b1d8bab48e29434492d50f1bb04 Mon Sep 17 00:00:00 2001 From: Richard Shadrach Date: Tue, 14 Nov 2023 16:54:09 -0500 Subject: [PATCH 7/8] Remove debug print --- doc/source/conf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 0ea4688a3a3d4..3f35e88cf543a 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -783,7 +783,6 @@ def rstjinja(app, docname, source): # Make sure we're outputting HTML if app.builder.format != "html": return - print(docname) src = source[0] rendered = app.builder.templates.render_string(src, app.config.html_context) source[0] = rendered From c291adab47ff9f158d2a22e2df872e237295abc8 Mon Sep 17 00:00:00 2001 From: Thomas Li <47963215+lithomas1@users.noreply.github.com> Date: Thu, 16 Nov 2023 11:46:23 -0500 Subject: [PATCH 8/8] fix typo --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b80748ac9341b..8ebd70762b2a5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ requires = [ "meson-python==0.13.1", "meson==1.2.1", "wheel", - "Cython==3.0.4", # Note: sync with setup.py, environment.yml and asv.conf.json + "Cython==3.0.5", # Note: sync with setup.py, environment.yml and asv.conf.json # Any NumPy version should be fine for compiling. Users are unlikely # to get a NumPy<1.25 so the result will be compatible with all relevant # NumPy versions (if not it is presumably compatible with their version).