REF: make CustomMixin a cdef class
State: closed


Labels:
name: Frequency
description: DateOffsets

Comments:
can you rebase
one more time :->
```
/home/runner/work/pandas/pandas/doc/source/reference/api/pandas.tseries.offsets.BDay.calendar.rst: WARNING: document isn't included in any toctree
/home/runner/work/pandas/pandas/doc/source/reference/api/pandas.tseries.offsets.BDay.holidays.rst: WARNING: document isn't included in any toctree
/home/runner/work/pandas/pandas/doc/source/reference/api/pandas.tseries.offsets.BDay.weekmask.rst: WARNING: document isn't included in any toctree
/home/runner/work/pandas/pandas/doc/source/reference/api/pandas.tseries.offsets.BusinessDay.calendar.rst: WARNING: document isn't included in any toctree
/home/runner/work/pandas/pandas/doc/source/reference/api/pandas.tseries.offsets.BusinessDay.holidays.rst: WARNING: document isn't included in any toctree
/home/runner/work/pandas/pandas/doc/source/reference/api/pandas.tseries.offsets.BusinessDay.weekmask.rst: WARNING: document isn't included in any toctree
/home/runner/work/pandas/pandas/doc/source/reference/api/pandas.tseries.offsets.BusinessHour.calendar.rst: WARNING: document isn't included in any toctree
/home/runner/work/pandas/pandas/doc/source/reference/api/pandas.tseries.offsets.BusinessHour.holidays.rst: WARNING: document isn't included in any toctree
/home/runner/work/pandas/pandas/doc/source/reference/api/pandas.tseries.offsets.BusinessHour.weekmask.rst: WARNING: document isn't included in any toctree
```

cc @jorisvandenbossche suggestions for how to suppress these warnings?  The situation: in order to fix [cython MRO troubles] i had to add these attributes in the _declaration_ for these classes, but these classes never actually define/use these attributes, so they _shouldnt_ be in the docs.
I would remove from the docs for now? once the cython classes are unified maybe can get away with re-adding?
I would remove from the docs for now?

you mean remove the classes entirely?
@jbrockmendel you can add those classes in the docs in a comment, so they don't show up in the overview list, but are actually built (to shut up sphinx to warn about it) 
See eg at the bottom of `reference/index.rst` as example
@jorisvandenbossche not having much luck. what ive put at the end of the document is (several variations of):

```
.. This is to prevent warnings in the doc build. We don't want to encourage
.. these methods.  See GH#34345

..
    BDay
    ----
    .. autosummary::
       :toctree: api/

        BDay

    Properties
    ~~~~~~~~~~
    .. autosummary::
       :toctree: api/

        BDay.base
        BDay.freqstr
        BDay.kwds
        BDay.name
        BDay.nanos
        BDay.normalize
        BDay.offset
        BDay.rule_code
        BDay.n

    Methods
    ~~~~~~~
    .. autosummary::
       :toctree: api/

        BDay.apply
        BDay.apply_index
        BDay.copy
        BDay.isAnchored
        BDay.onOffset
        BDay.is_anchored
        BDay.is_on_offset
        BDay.rollback
        BDay.rollforward
        BDay.__call__
```

which is giving errors:

```
WARNING: [autosummary] failed to import 'pandas.tseries.frequencies.BDay': no module named pandas.tseries.frequencies.BDay
WARNING: [autosummary] failed to import 'pandas.tseries.frequencies.BDay.__call__': no module named pandas.tseries.frequencies.BDay.__call__
WARNING: [autosummary] failed to import 'pandas.tseries.frequencies.BDay.apply': no module named pandas.tseries.frequencies.BDay.apply
WARNING: [autosummary] failed to import 'pandas.tseries.frequencies.BDay.apply_index': no module named pandas.tseries.frequencies.BDay.apply_index
WARNING: [autosummary] failed to import 'pandas.tseries.frequencies.BDay.base': no module named pandas.tseries.frequencies.BDay.base
WARNING: [autosummary] failed to import 'pandas.tseries.frequencies.BDay.copy': no module named pandas.tseries.frequencies.BDay.copy
WARNING: [autosummary] failed to import 'pandas.tseries.frequencies.BDay.freqstr': no module named pandas.tseries.frequencies.BDay.freqstr
WARNING: [autosummary] failed to import 'pandas.tseries.frequencies.BDay.isAnchored': no module named pandas.tseries.frequencies.BDay.isAnchored
WARNING: [autosummary] failed to import 'pandas.tseries.frequencies.BDay.is_anchored': no module named pandas.tseries.frequencies.BDay.is_anchored
WARNING: [autosummary] failed to import 'pandas.tseries.frequencies.BDay.is_on_offset': no module named pandas.tseries.frequencies.BDay.is_on_offset
WARNING: [autosummary] failed to import 'pandas.tseries.frequencies.BDay.kwds': no module named pandas.tseries.frequencies.BDay.kwds
WARNING: [autosummary] failed to import 'pandas.tseries.frequencies.BDay.n': no module named pandas.tseries.frequencies.BDay.n
WARNING: [autosummary] failed to import 'pandas.tseries.frequencies.BDay.name': no module named pandas.tseries.frequencies.BDay.name
WARNING: [autosummary] failed to import 'pandas.tseries.frequencies.BDay.nanos': no module named pandas.tseries.frequencies.BDay.nanos
WARNING: [autosummary] failed to import 'pandas.tseries.frequencies.BDay.normalize': no module named pandas.tseries.frequencies.BDay.normalize
WARNING: [autosummary] failed to import 'pandas.tseries.frequencies.BDay.offset': no module named pandas.tseries.frequencies.BDay.offset
WARNING: [autosummary] failed to import 'pandas.tseries.frequencies.BDay.onOffset': no module named pandas.tseries.frequencies.BDay.onOffset
WARNING: [autosummary] failed to import 'pandas.tseries.frequencies.BDay.rollback': no module named pandas.tseries.frequencies.BDay.rollback
WARNING: [autosummary] failed to import 'pandas.tseries.frequencies.BDay.rollforward': no module named pandas.tseries.frequencies.BDay.rollforward
WARNING: [autosummary] failed to import 'pandas.tseries.frequencies.BDay.rule_code': no module named pandas.tseries.frequencies.BDay.rule_code
WARNING: [autosummary] failed to import 'pandas.tseries.frequencies.Methods': no module named pandas.tseries.frequencies.Methods
WARNING: [autosummary] failed to import 'pandas.tseries.frequencies.Properties': no module named pandas.tseries.frequencies.Properties

```
But BDay indeed doesn't exist in `pd.tseries.frequencies`?
> But BDay indeed doesn't exist in pd.tseries.frequencies?

No, it is in tseries.offsets.  If I move the comment-text up to just before `.. _api.frequencies:` then the warning is 

```
WARNING: [autosummary] failed to import 'pandas.tseries.offsets.Methods': no module named pandas.tseries.offsets.Methods
WARNING: [autosummary] failed to import 'pandas.tseries.offsets.Properties': no module named pandas.tseries.offsets.Properties
```
You will need to show the change that gives this warning
> You will need to show the change that gives this warning

Locally, this file now ends with

```
    [...]
    CDay.rollback
    CDay.rollforward
    CDay.__call__

.. This is to prevent warnings in the doc build. We don't want to encourage
.. these methods.  See GH#34345

..
    BDay
    ----
    .. autosummary::
       :toctree: api/

        BDay

    Properties
    ~~~~~~~~~~
    .. autosummary::
       :toctree: api/

        BDay.base
        BDay.freqstr
        BDay.kwds
        BDay.name
        BDay.nanos
        BDay.normalize
        BDay.offset
        BDay.rule_code
        BDay.n

    Methods
    ~~~~~~~
    .. autosummary::
       :toctree: api/

        BDay.apply
        BDay.apply_index
        BDay.copy
        BDay.isAnchored
        BDay.onOffset
        BDay.is_anchored
        BDay.is_on_offset
        BDay.rollback
        BDay.rollforward
        BDay.__call__


.. _api.frequencies:

===========
Frequencies
===========
.. currentmodule:: pandas.tseries.frequencies

.. _api.offsets:

.. autosummary::
   :toctree: api/

   to_offset

```
@jorisvandenbossche i still need to rebase+test this, so not a huge hurry, but any thoughts on the doc issue?  we're at the tail end of this process
Not directly, sorry. But if you can push it here, might be easier to check with the full change
The docs are passing here?
> The docs are passing here?

Yes.  In the most recent commit i added the "dummy" attributes to the docs for the non-custom classes, so if accessed they will just be None.
green, booyah
>  In the most recent commit i added the "dummy" attributes to the docs for the non-custom classes, so if accessed they will just be None.

But why do `BDay` etc need to be in the docs at all? 
No idea
It was not meant as a technical "why" question, but a documentation question, and you are the expert in offsets: is `BDay` a class is used by users? (or is only a base class they should never use, I don't know)
BDay is an alias for BusinessDay, which i think is fairly common.  It is used directly by users
OK, so it's good to have it in the docs then. But maybe we could only add the class docstring page itself, without adding all methods/properties? (we have machinery for that, will do a PR just for BDay)