Skip to content

[Docs] Remove unnecessary bases - #39982

Merged
bveeramani merged 2 commits into
ray-project:masterfrom
bveeramani:base-obj
Oct 5, 2023
Merged

bveeramani merged 2 commits into
ray-project:masterfrom
bveeramani:base-obj

Conversation

@bveeramani

@bveeramani bveeramani commented Sep 29, 2023 •

Copy link
Copy Markdown
Member

Why are these changes needed?

Before
image

After
image

Related issue number

Checks

Signed-off-by: Balaji Veeramani <[email protected]>
@bveeramani
bveeramani requested a review from a team as a code owner September 29, 2023 18:27
@KamenShah KamenShah mentioned this pull request Sep 29, 2023
8 tasks
@peytondmurray

Copy link
Copy Markdown
Contributor

@bveeramani Does this message only appear if you explicitly subclass object? If so, we can tear out any of those instances, as it was only necessary to subclass object in Python 2.

@angelinalg angelinalg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would the object class ever be listed in a list with multiple bases? Or is it automatically dropped if there is another base class to list?

@bveeramani

Copy link
Copy Markdown
Member Author

@bveeramani Does this message only appear if you explicitly subclass object?

No, it shows up even if you don't explicitly subclass object.

If so, we can tear out any of those instances, as it was only necessary to subclass object in Python 2.

Totally agree. I think we still have those in a handful of places.

@bveeramani

Copy link
Copy Markdown
Member Author

Would the object class ever be listed in a list with multiple bases? Or is it automatically dropped if there is another base class to list?

Don't think so unless you explicitly did something like Subclass(BaseClass, object), but that would be incredibly unusual.

@peytondmurray peytondmurray left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for this 🚀

@bveeramani
bveeramani merged commit 4b6419c into ray-project:master Oct 5, 2023
Zandew pushed a commit to Zandew/ray that referenced this pull request Oct 10, 2023
vymao pushed a commit to vymao/ray that referenced this pull request Oct 11, 2023
elliot-barn pushed a commit that referenced this pull request May 8, 2026
…nf.py (#63197)

## Why

The Anyscale docs team is auditing `doc/source/conf.py` against current
Ray state as part of strategy work tracked in
[anyscale/docs#2064](anyscale/docs#2064). One
finding: `conf.py` globally swaps `sphinx.ext.autodoc.ClassDocumenter`
with a `MockedClassDocumenter` subclass that suppresses the `Bases:
object` line for classes that inherit directly from `object`.

The patch was added in
[#39982](#39982) (Oct 2023). It's
a cosmetic workaround. Two reasons it may now be obsolete:

1. **Modern pydata-sphinx-theme** (Ray pins 0.14.1; current is 0.16.x)
renders base class lines differently than it did when the patch was
authored.
2. **Global monkey patches at conf.py module scope** are a fragility
liability — if a future Sphinx ClassDocumenter signature change lands,
the patch breaks the build at import. The cosmetic value should be
weighed against that ongoing maintenance cost.

## What this PR does

1. Removes the `MockedClassDocumenter` class and its global assignment
to `sphinx.ext.autodoc.ClassDocumenter`.
2. Removes the now-unused `from sphinx.ext import autodoc` import.

## How to validate

This is a probe, not a request-for-merge. The validation surfaces are:

1. **RtD PR preview build** — runs against this branch. With
`fail_on_warning: true` set in `.readthedocs.yaml`, any new Sphinx
warning means the patch was still load-bearing in a non-cosmetic way.
2. **`doc: check API doc consistency`** — premerge step that runs `make
-C doc/ html` internally. Same fail-on-warning gate.
3. **Visual diff of any API ref page** for a class that inherits
directly from `object`. If `Bases: object` reappears in those pages, the
patch was effectively suppressing visible noise — keep it. If the line
is rendered the same way (or absent) by the modern theme without the
patch, drop it.

## Possible outcomes

- **Build clean, no visible regression** → the patch is dead weight.
Drop.
- **Build clean, `Bases: object` reappears on many pages** → the patch
is doing what it claims. Keep, and add a comment explaining what would
replace it (a CSS rule on the modern theme's rendered output, or a
different autodoc filter).
- **Build fails** → the patch was load-bearing in a way nobody
documented. Revert and document.

## Status

**Draft.** Posting for visibility and validation, not for merge. Looking
for a Ray maintainer to confirm whether the cosmetic suppression is
still desired and whether there's a less-fragile mechanism to achieve
it. Justin Yu @justinvyu, Aydin Abiar @aslonnie, or Elliot Barnwell
@ebarn-anyscale would all be reasonable reviewers given recent activity
in this area.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Douglas Strodtman <[email protected]>
Lucas61000 pushed a commit to Lucas61000/ray that referenced this pull request May 15, 2026
…nf.py (ray-project#63197)

## Why

The Anyscale docs team is auditing `doc/source/conf.py` against current
Ray state as part of strategy work tracked in
[anyscale/docs#2064](anyscale/docs#2064). One
finding: `conf.py` globally swaps `sphinx.ext.autodoc.ClassDocumenter`
with a `MockedClassDocumenter` subclass that suppresses the `Bases:
object` line for classes that inherit directly from `object`.

The patch was added in
[ray-project#39982](ray-project#39982) (Oct 2023). It's
a cosmetic workaround. Two reasons it may now be obsolete:

1. **Modern pydata-sphinx-theme** (Ray pins 0.14.1; current is 0.16.x)
renders base class lines differently than it did when the patch was
authored.
2. **Global monkey patches at conf.py module scope** are a fragility
liability — if a future Sphinx ClassDocumenter signature change lands,
the patch breaks the build at import. The cosmetic value should be
weighed against that ongoing maintenance cost.

## What this PR does

1. Removes the `MockedClassDocumenter` class and its global assignment
to `sphinx.ext.autodoc.ClassDocumenter`.
2. Removes the now-unused `from sphinx.ext import autodoc` import.

## How to validate

This is a probe, not a request-for-merge. The validation surfaces are:

1. **RtD PR preview build** — runs against this branch. With
`fail_on_warning: true` set in `.readthedocs.yaml`, any new Sphinx
warning means the patch was still load-bearing in a non-cosmetic way.
2. **`doc: check API doc consistency`** — premerge step that runs `make
-C doc/ html` internally. Same fail-on-warning gate.
3. **Visual diff of any API ref page** for a class that inherits
directly from `object`. If `Bases: object` reappears in those pages, the
patch was effectively suppressing visible noise — keep it. If the line
is rendered the same way (or absent) by the modern theme without the
patch, drop it.

## Possible outcomes

- **Build clean, no visible regression** → the patch is dead weight.
Drop.
- **Build clean, `Bases: object` reappears on many pages** → the patch
is doing what it claims. Keep, and add a comment explaining what would
replace it (a CSS rule on the modern theme's rendered output, or a
different autodoc filter).
- **Build fails** → the patch was load-bearing in a way nobody
documented. Revert and document.

## Status

**Draft.** Posting for visibility and validation, not for merge. Looking
for a Ray maintainer to confirm whether the cosmetic suppression is
still desired and whether there's a less-fragile mechanism to achieve
it. Justin Yu @justinvyu, Aydin Abiar @aslonnie, or Elliot Barnwell
@ebarn-anyscale would all be reasonable reviewers given recent activity
in this area.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Douglas Strodtman <[email protected]>
alexandrplashchinsky pushed a commit to alexandrplashchinsky/ray-alex that referenced this pull request May 29, 2026
…nf.py (ray-project#63197)

## Why

The Anyscale docs team is auditing `doc/source/conf.py` against current
Ray state as part of strategy work tracked in
[anyscale/docs#2064](anyscale/docs#2064). One
finding: `conf.py` globally swaps `sphinx.ext.autodoc.ClassDocumenter`
with a `MockedClassDocumenter` subclass that suppresses the `Bases:
object` line for classes that inherit directly from `object`.

The patch was added in
[ray-project#39982](ray-project#39982) (Oct 2023). It's
a cosmetic workaround. Two reasons it may now be obsolete:

1. **Modern pydata-sphinx-theme** (Ray pins 0.14.1; current is 0.16.x)
renders base class lines differently than it did when the patch was
authored.
2. **Global monkey patches at conf.py module scope** are a fragility
liability — if a future Sphinx ClassDocumenter signature change lands,
the patch breaks the build at import. The cosmetic value should be
weighed against that ongoing maintenance cost.

## What this PR does

1. Removes the `MockedClassDocumenter` class and its global assignment
to `sphinx.ext.autodoc.ClassDocumenter`.
2. Removes the now-unused `from sphinx.ext import autodoc` import.

## How to validate

This is a probe, not a request-for-merge. The validation surfaces are:

1. **RtD PR preview build** — runs against this branch. With
`fail_on_warning: true` set in `.readthedocs.yaml`, any new Sphinx
warning means the patch was still load-bearing in a non-cosmetic way.
2. **`doc: check API doc consistency`** — premerge step that runs `make
-C doc/ html` internally. Same fail-on-warning gate.
3. **Visual diff of any API ref page** for a class that inherits
directly from `object`. If `Bases: object` reappears in those pages, the
patch was effectively suppressing visible noise — keep it. If the line
is rendered the same way (or absent) by the modern theme without the
patch, drop it.

## Possible outcomes

- **Build clean, no visible regression** → the patch is dead weight.
Drop.
- **Build clean, `Bases: object` reappears on many pages** → the patch
is doing what it claims. Keep, and add a comment explaining what would
replace it (a CSS rule on the modern theme's rendered output, or a
different autodoc filter).
- **Build fails** → the patch was load-bearing in a way nobody
documented. Revert and document.

## Status

**Draft.** Posting for visibility and validation, not for merge. Looking
for a Ray maintainer to confirm whether the cosmetic suppression is
still desired and whether there's a less-fragile mechanism to achieve
it. Justin Yu @justinvyu, Aydin Abiar @aslonnie, or Elliot Barnwell
@ebarn-anyscale would all be reasonable reviewers given recent activity
in this area.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Douglas Strodtman <[email protected]>
Signed-off-by: Alexandr Plashchinsky <[email protected]>
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.

3 participants