Skip to content

Commit e11bf72

Browse files
authored
DOC: Set __module__ attributes and remove core from documentation (pandas-dev#62727)
1 parent a329dc3 commit e11bf72

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+230
-34
lines changed

ci/code_checks.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,12 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
7373
-i "pandas.Period.freq GL08" \
7474
-i "pandas.Period.ordinal GL08" \
7575
-i "pandas.errors.IncompatibleFrequency SA01,SS06,EX01" \
76+
-i "pandas.errors.InvalidVersion GL08" \
7677
-i "pandas.api.extensions.ExtensionArray.value_counts EX01,RT03,SA01" \
77-
-i "pandas.core.groupby.DataFrameGroupBy.plot PR02" \
78-
-i "pandas.core.groupby.SeriesGroupBy.plot PR02" \
79-
-i "pandas.core.resample.Resampler.quantile PR01,PR07" \
78+
-i "pandas.api.typing.DataFrameGroupBy.plot PR02" \
79+
-i "pandas.api.typing.SeriesGroupBy.plot PR02" \
80+
-i "pandas.api.typing.Resampler.quantile PR01,PR07" \
81+
-i "pandas.arrays.NumpyExtensionArray GL08" \
8082
-i "pandas.tseries.offsets.BDay PR02,SA01" \
8183
-i "pandas.tseries.offsets.BHalfYearBegin.is_on_offset GL08" \
8284
-i "pandas.tseries.offsets.BHalfYearBegin.n GL08" \

doc/source/reference/groupby.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
=======
66
GroupBy
77
=======
8-
.. currentmodule:: pandas.core.groupby
8+
.. currentmodule:: pandas.api.typing
99

1010
:class:`pandas.api.typing.DataFrameGroupBy` and :class:`pandas.api.typing.SeriesGroupBy`
1111
instances are returned by groupby calls :func:`pandas.DataFrame.groupby` and
@@ -40,7 +40,7 @@ Function application helper
4040

4141
NamedAgg
4242

43-
.. currentmodule:: pandas.core.groupby
43+
.. currentmodule:: pandas.api.typing
4444

4545
Function application
4646
--------------------

doc/source/reference/resampling.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
==========
66
Resampling
77
==========
8-
.. currentmodule:: pandas.core.resample
8+
.. currentmodule:: pandas.api.typing
99

1010
:class:`pandas.api.typing.Resampler` instances are returned by
1111
resample calls: :func:`pandas.DataFrame.resample`, :func:`pandas.Series.resample`.

doc/source/reference/window.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ calls: :func:`pandas.DataFrame.ewm` and :func:`pandas.Series.ewm`.
1717

1818
Rolling window functions
1919
------------------------
20-
.. currentmodule:: pandas.core.window.rolling
20+
.. currentmodule:: pandas.api.typing
2121

2222
.. autosummary::
2323
:toctree: api/
@@ -48,7 +48,8 @@ Rolling window functions
4848

4949
Weighted window functions
5050
-------------------------
51-
.. currentmodule:: pandas.core.window.rolling
51+
.. currentmodule:: pandas.api.typing
52+
5253

5354
.. autosummary::
5455
:toctree: api/
@@ -62,7 +63,8 @@ Weighted window functions
6263

6364
Expanding window functions
6465
--------------------------
65-
.. currentmodule:: pandas.core.window.expanding
66+
.. currentmodule:: pandas.api.typing
67+
6668

6769
.. autosummary::
6870
:toctree: api/
@@ -93,7 +95,8 @@ Expanding window functions
9395

9496
Exponentially-weighted window functions
9597
---------------------------------------
96-
.. currentmodule:: pandas.core.window.ewm
98+
.. currentmodule:: pandas.api.typing
99+
97100

98101
.. autosummary::
99102
:toctree: api/

doc/source/user_guide/enhancingperf.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ by evaluate arithmetic and boolean expression all at once for large :class:`~pan
455455
:func:`~pandas.eval` is many orders of magnitude slower for
456456
smaller expressions or objects than plain Python. A good rule of thumb is
457457
to only use :func:`~pandas.eval` when you have a
458-
:class:`~pandas.core.frame.DataFrame` with more than 10,000 rows.
458+
:class:`~pandas.DataFrame` with more than 10,000 rows.
459459

460460
Supported syntax
461461
~~~~~~~~~~~~~~~~

meson.build

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ versioneer = files('generate_version.py')
1818

1919
add_project_arguments('-DNPY_NO_DEPRECATED_API=0', language: 'c')
2020
add_project_arguments('-DNPY_NO_DEPRECATED_API=0', language: 'cpp')
21+
# Enables settings __module__ on cdef classes
22+
# https://github.com/cython/cython/issues/7231
23+
add_project_arguments('-DCYTHON_USE_TYPE_SPECS=1', language: 'c')
2124

2225
# Allow supporting older numpys than the version compiled against
2326
# Set the define to the min supported version of numpy for pandas

pandas/_config/config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ class OptionError(AttributeError, KeyError):
117117
OptionError: No such option
118118
"""
119119

120+
__module__ = "pandas.errors"
121+
120122

121123
#
122124
# User API
@@ -441,6 +443,8 @@ def __dir__(self) -> list[str]:
441443

442444

443445
options = DictWrapper(_global_config)
446+
# DictWrapper defines a custom setattr
447+
object.__setattr__(options, "__module__", "pandas")
444448

445449
#
446450
# Functions for use by pandas developers, in addition to User - api

pandas/_libs/interval.pyx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@ cdef class Interval(IntervalMixin):
382382
>>> year_2017.length
383383
Timedelta('365 days 00:00:00')
384384
"""
385+
__module__ = "pandas"
385386
_typ = "interval"
386387
__array_priority__ = 1000
387388

@@ -444,6 +445,7 @@ cdef class Interval(IntervalMixin):
444445
>>> interval.closed
445446
'left'
446447
"""
448+
__module__ = "pandas"
447449

448450
def __init__(self, left, right, str closed="right"):
449451
# note: it is faster to just do these checks than to use a special

pandas/_libs/lib.pyx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2944,7 +2944,9 @@ class _NoDefault(Enum):
29442944

29452945
# Note: no_default is exported to the public API in pandas.api.extensions
29462946
no_default = _NoDefault.no_default # Sentinel indicating the default value.
2947+
no_default.__module__ = "pandas.api.extensions"
29472948
NoDefault = Literal[_NoDefault.no_default]
2949+
NoDefault.__module__ = "pandas.api.typing"
29482950

29492951

29502952
@cython.boundscheck(False)

pandas/_libs/missing.pyx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ class NAType(C_NAType):
393393
>>> True | pd.NA
394394
True
395395
"""
396-
__module__ = "pandas"
396+
__module__ = "pandas.api.typing"
397397

398398
_instance = None
399399

@@ -546,3 +546,4 @@ class NAType(C_NAType):
546546

547547
C_NA = NAType() # C-visible
548548
NA = C_NA # Python-visible
549+
NA.__module__ = "pandas"

0 commit comments

Comments
 (0)