-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
DOC: Show constructor arguments for some classes in pd.series.offsets
#61605
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
base: main
Are you sure you want to change the base?
Conversation
f"\'{c_PERIOD_AND_OFFSET_DEPR_FREQSTR.get(name)}\'" | ||
f" instead.", | ||
f"\'{c_PERIOD_AND_OFFSET_DEPR_FREQSTR.get(name)}\' " | ||
f"instead.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Dr-Irv this and the following change have for some time caused pre-commit to fail for me locally.
great that this is being fixed here. Thanks.
Any idea why CI hasn't picked this up before now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I was surprised as well.
/preview |
No strong opinions about this, but if the examples need the okexcept on windows sounds like this change is breaking things on windows, no? I guess I'm missing something, if you can clarify. But it would be better to fix the underlying problem, I don't think we should add okexcept unless we document exceptions. |
No, the change is needed to just build the regular documentation (without this change) on Windows. It has something to do with how sphinx calls cython and that doesn't seem to work right on Windows. Not sure exactly what the problem is. |
This contributes to #52431
In that issue, the goal is to show the arguments for the constructors for the various offsets, which are all in
pyx
files.The problem is that
sphinx
doesn't pick up the arguments for__init__()
in those files. By adding the# cython: embedsignature=True
at the top of the file, then it will pick it up for any class we document that has an explicit__init__()
method. So, if you preview the docs from this MR, you will see it for classes likeYearEnd
, andBusinessHour
because they have explicit__init__()
methods. But you won't see it forYearBegin
, for example, because it has no explicit__init__()
method.So to fix that, I illustrate how to fix it for
Day
, where I introduce an__init__()
method that just calls thesuper().__init__()
, and that makes sphinx then pick up the docs forpandas.tseries.offsets.Day
Also, I had to add the
okexcept
things todoc/source/user_guide/enhancingperf.rst
because otherwise the docs would not build on Windows.If this PR is accepted, then we can get the community to do the work of adding the various
__init__()
methods to the other documented offset classes and they can also add aParameters
section to those classes, which is what I did forDay
as well.