Skip to content

Conversation

bsipocz
Copy link
Contributor

@bsipocz bsipocz commented Aug 18, 2025

Purpose

We started seeing deprecations for set_classes() when running sphinx-automodapi tests (e.g. astropy/sphinx-automodapi#214). We don't call that method directly, but it appeared that sphinx itself calls it. Using this patch locally, those failures cleaned up.

However, this patch really badly fails the sphinx tests locally, so I'm trying to smoke out issues with CI (and I expect that some docutils version checker will be needed, too. I'll add changelog/authors once this is all green and decided to be the good approach)

@@ -9,7 +9,7 @@
from docutils.parsers.rst import directives
from docutils.parsers.rst.directives import images, tables
from docutils.parsers.rst.directives.misc import Meta
from docutils.parsers.rst.roles import set_classes
Copy link
Member

Choose a reason for hiding this comment

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

We still need the old name for old versions of Docutils, which we still support

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I suspected that this needs to be version dependent. I'll add a checker, though first will need to sort out what goes wrong for the latest docutils where it should work

@AA-Turner AA-Turner changed the title MAINT: changing deprecated set_classes to normalize_options Use normalize_options() from Docutils in preference to set_classes() Aug 18, 2025
@@ -584,10 +584,11 @@ def code_role(
options: dict[str, Any] | None = None,
content: Sequence[str] = (),
) -> tuple[list[Node], list[system_message]]:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh, and this annoys Ruff, though I explicitly added the line as it was very difficult to see where the signature ends and the actual code starts.

@bsipocz
Copy link
Contributor Author

bsipocz commented Aug 19, 2025

The one remaining failure is actually relevant as instead of the <h2 class="myclass rubric">A rubric with a heading level 2</h2> we now generate <h2 class="rubric">A rubric with a heading level 2</h2> while in the input we clearly have :class: myclass.

I suspect this is something trivial for someone more familiar with the sphinx testing internals, so I don't yet dive into this rabbit hole of figuring it out myself.

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.

2 participants