Skip to content

Improvements to arguments, types with stubtest #1294

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 9 commits into from
Jul 30, 2025

Conversation

loicdiridollou
Copy link
Member

More improvements with the stubtest flagging some drift with pandas.

One point that was raised is the handling of deprecated items, maybe the other possibility than purely removing it from the stubs is to force the stubs to adopt the default value so that whatever the user is doing it won't allow any other behavior.
We need to see how much we can use stubtest, I don't see it being used in CI at the moment or anytime soon considering the mountain of work that it raises (mostly correctly but I have seen a few places where it is flagging things that are fine), there is also the problem of the no_default that pandas uses abundantly and which is hard to replicate in the stubs.

  • Closes #xxxx (Replace xxxx with the Github issue number)
  • Tests added: Please use assert_type() to assert the type of any return value

@@ -53,7 +52,6 @@ class PeriodIndex(DatetimeIndexOpsMixin[pd.Period], PeriodIndexFieldOps):
def __rsub__( # pyright: ignore[reportIncompatibleMethodOverride]
self, other: NaTType
) -> NaTType: ...
def __array__(self, dtype=...) -> np.ndarray: ...
Copy link
Member Author

Choose a reason for hiding this comment

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

Using parent definition.

Copy link
Collaborator

@Dr-Irv Dr-Irv left a comment

Choose a reason for hiding this comment

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

thanks. a number of things that stubgen picks up we still need to follow the docs on

self,
func: AggFuncTypeBase | AggFuncTypeDictSeries,
func: AggFuncTypeBase | AggFuncTypeDictSeries = ...,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not valid. If you don't specify the value of func, an exception will be raised. Please revert.

@loicdiridollou loicdiridollou requested a review from Dr-Irv July 30, 2025 00:01
Copy link
Collaborator

@Dr-Irv Dr-Irv left a comment

Choose a reason for hiding this comment

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

@Dr-Irv Dr-Irv merged commit ae72ced into pandas-dev:main Jul 30, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants