Skip to content

Conversation

rhshadrach
Copy link
Member

@rhshadrach rhshadrach commented Oct 18, 2025

This PR addresses all __module__ attributes of public objects that I can find with the exception of functions. It's not clear to me if we want to also be modifying the __module__ attribute of e.g. pandas.factorize and even if we do, I'd like to keep that separate as this PR is already becoming sizable.

Remaining documentation that contains .core.:

API docs

# Ignore redirects
grep -nre "\.core\." doc/build/html/reference/ | grep -v "has been moved" | grep -v "http-equiv=\"refresh\""
doc/build/html/reference/api/pandas.IndexSlice.html:762:<span class="sig-prename descclassname"><span class="pre">pandas.</span></span><span class="sig-name descname"><span class="pre">IndexSlice</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">&lt;pandas.core.indexing._IndexSlice</span> <span class="pre">object&gt;</span></em><a class="headerlink" href="#pandas.IndexSlice" title="Link to this definition">#</a></dt>
doc/build/html/reference/api/pandas.DataFrame.query.html:843:in combination with the source code in <code class="xref py py-mod docutils literal notranslate"><span class="pre">pandas.core.computation.parsing</span></code>.</p>

User Guide

grep -nre "\.core\." doc/build/html/user_guide/
doc/build/html/user_guide/io.html:3895:<span class="go">&lt;IPython.core.display.HTML object&gt;</span>
doc/build/html/user_guide/io.html:3922:<span class="go">&lt;IPython.core.display.HTML object&gt;</span>
doc/build/html/user_guide/io.html:3953:<span class="go">&lt;IPython.core.display.HTML object&gt;</span>
doc/build/html/user_guide/io.html:3984:<span class="go">&lt;IPython.core.display.HTML object&gt;</span>
doc/build/html/user_guide/io.html:4050:<span class="go">&lt;IPython.core.display.HTML object&gt;</span>
doc/build/html/user_guide/io.html:4091:<span class="go">&lt;IPython.core.display.HTML object&gt;</span>
doc/build/html/user_guide/io.html:4126:<span class="go">&lt;IPython.core.display.HTML object&gt;</span>

Getting Started

grep -nre "\.core\." doc/build/html/getting_started/

no output.

@rhshadrach rhshadrach requested a review from Dr-Irv as a code owner October 18, 2025 00:08
@rhshadrach rhshadrach marked this pull request as draft October 18, 2025 00:09
"""

__module__ = "pandas"
__module__ = "pandas.api.typing"
Copy link
Member

Choose a reason for hiding this comment

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

I get wanting NatType in the api,typing namespace, but do t we want pd.NaT in the pandas namespace? Same for pd.NA above

Copy link
Member Author

Choose a reason for hiding this comment

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

Ack, I didn't realize we'd also need to consider __module__ on class instances. Thanks.

@rhshadrach rhshadrach changed the title DOC: Set remaining __module__ attributes DOC: Set remaining __module__ attributes and remove core from documentation Oct 18, 2025
@rhshadrach rhshadrach changed the title DOC: Set remaining __module__ attributes and remove core from documentation DOC: Set __module__ attributes and remove core from documentation Oct 18, 2025
or ("Dtype" in name and obj.__module__ == "pandas")
or (name == "Categorical" and obj.__module__ == "pandas")
# TODO: Can't seem to change __module__
or name == "Interval"
Copy link
Member Author

Choose a reason for hiding this comment

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

Modifying __module__ on Interval doesn't seem to have an impact; I'm guessing because this is a cdef class?

Copy link
Member Author

Choose a reason for hiding this comment

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

@jbrockmendel - this is about ready, just this last todo I think. Was wondering if you could have a look here.

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.

ENH: set __module__ on top-level public objects

2 participants