Skip to content

DEPS: Bump cython 3.0 #54335

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Aug 4, 2023
Merged

DEPS: Bump cython 3.0 #54335

merged 11 commits into from
Aug 4, 2023

Conversation

lithomas1
Copy link
Member

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

@lithomas1 lithomas1 added Compat pandas objects compatability with Numpy or Python functions Dependencies Required and optional dependencies labels Jul 31, 2023
@lithomas1 lithomas1 changed the title Bump cython 3.0 DEPS: Bump cython 3.0 Aug 1, 2023
@lithomas1 lithomas1 marked this pull request as ready for review August 2, 2023 01:13
@WillAyd
Copy link
Member

WillAyd commented Aug 2, 2023

Looks pretty good. Are all of these changes required to make Cython 3.0 work or are some of the signature changes general cleanups that made sense to bundle?

@Dr-Irv FYI in case this impacts pandas-stubs

@lithomas1
Copy link
Member Author

Looks pretty good. Are all of these changes required to make Cython 3.0 work or are some of the signature changes general cleanups that made sense to bundle?

@Dr-Irv FYI in case this impacts pandas-stubs

Yeah, it turns out our stubs are horrendously outdated. I guess Cython 3.0 exposes the annotation information, so stubtest is complaining now.

@lithomas1 lithomas1 added this to the 2.1 milestone Aug 2, 2023
@Dr-Irv
Copy link
Contributor

Dr-Irv commented Aug 2, 2023

@Dr-Irv FYI in case this impacts pandas-stubs

We're not that good in keeping the PYI files in the pandas source and the PYI files in pandas-stubs in sync. There's some related discussion here: pandas-dev/pandas-stubs#128

One of the issues here is that the pandas source has things in its PYI files for "private" methods - i.e., methods and classes that are not documented but are used to type check the pandas source. The philosophy on pandas-stubs is to only provide stubs for documented methods and classes - although we may be missing some documented methods/classes that should be in the pandas-stubs, and there are also ones that are in pandas-stubs that are not documented. Cleaning that up is a long term goal.

@hkad98
Copy link

hkad98 commented Aug 3, 2023

Do we really want to include this bump in the 2.1.0 release? AFAIK Apache Arrow will adapt Cython 3.0.0 in their 14.0.0, but they do not release 13.0.0 yet, meaning the integration with Apache Arrow will not work, right?

@lithomas1
Copy link
Member Author

Do we really want to include this bump in the 2.1.0 release? AFAIK Apache Arrow will adapt Cython 3.0.0 in their 14.0.0, but they do not release 13.0.0 yet, meaning the integration with Apache Arrow will not work, right?

We don't compile against Apache Arrow (only numpy). All integration with arrow is done through Python IIRC.

@@ -26,7 +26,7 @@ class NDArrayBacked:
def size(self) -> int: ...
@property
def nbytes(self) -> int: ...
def copy(self): ...
def copy(self, order: str = "C"): ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason this is "C" instead of ...?

Copy link
Member Author

@lithomas1 lithomas1 Aug 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default is "C" and I figured I'd be explicit. I think the ... is when you can't figure out the default or it's annoying to type?

cc @MarcoGorelli and @Dr-Irv for best practices

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a PYI file, you don't specify default values. Defaults would only go in the declaration of the function. So it should be order: str = ... . That means the order argument is optional.

Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@@ -2511,7 +2511,7 @@ cdef class _Period(PeriodMixin):
object_state = None, self.freq, self.ordinal
return (Period, object_state)

def strftime(self, fmt: str) -> str:
def strftime(self, fmt: str | None) -> str:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good one 👍

@mroeschke mroeschke merged commit 4cf63ea into pandas-dev:main Aug 4, 2023
@mroeschke
Copy link
Member

Nice thanks @lithomas1

@lithomas1 lithomas1 deleted the bump-cython-3.0 branch August 4, 2023 17:13
@jbrockmendel
Copy link
Member

very cool to see this in!

phofl added a commit to phofl/pandas that referenced this pull request Aug 11, 2023
lithomas1 pushed a commit that referenced this pull request Aug 11, 2023
* Revert "CLN: Cython 3 cleanups (#54482)"

This reverts commit a936863.

* Revert "DEPS: Bump cython 3.0 (#54335)"

This reverts commit 4cf63ea.
mroeschke pushed a commit to mroeschke/pandas that referenced this pull request Aug 18, 2023
* Revert "CLN: Cython 3 cleanups (pandas-dev#54482)"

This reverts commit a936863.

* Revert "DEPS: Bump cython 3.0 (pandas-dev#54335)"

This reverts commit 4cf63ea.
@lithomas1 lithomas1 mentioned this pull request Sep 18, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compat pandas objects compatability with Numpy or Python functions Dependencies Required and optional dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants