Skip to content

[5.2.x] Fixed #36535 -- Ensured compatibility with docutils < 0.22 and also 0.22+. #19690

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

nessita
Copy link
Contributor

@nessita nessita commented Jul 31, 2025

Regression in 5aefd00.

Trac ticket number

ticket-36535

Branch description

This change ensures compatibility with both older and newer versions of Docutils, including recent version 0.22.

Docutils 0.22 includes this change, which allows the writer parameter to be either a string or an instance. However, older versions only accept the writer name as a string passed via the writer_name argument (which was removed in 0.22). The good news is that older version already accepted an writer param which should be given a writer instance.

To support versions from 0.19 through 0.22 and beyond, this change updates the logic to create a writer instance explicitly, avoiding version-specific behavior.

@nessita nessita force-pushed the docutils-0.22-compat branch from d65fc57 to d6fa9b9 Compare July 31, 2025 17:08
@nessita nessita changed the title Ensured compatibility with docutils < 0.22 and also 0.22+. [5.2.x] Ensured compatibility with docutils < 0.22 and also 0.22+. Jul 31, 2025
@nessita nessita changed the title [5.2.x] Ensured compatibility with docutils < 0.22 and also 0.22+. [5.2.x] Fixed #36535 -- Ensured compatibility with docutils < 0.22 and also 0.22+. Jul 31, 2025
@nessita nessita requested a review from felixxm July 31, 2025 20:28
Copy link
Contributor

@sarahboyce sarahboyce left a comment

Choose a reason for hiding this comment

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

Thank you

parts = docutils.core.publish_parts(
source % text,
source_path=thing_being_parsed,
destination_path=None,
writer="html",
writer=writer_instance,
Copy link
Member

Choose a reason for hiding this comment

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

I'd consider adding release notes (5.2.5.txt):

* Added compatibility for ``docutils`` 0.22 (:ticket:`36535`)

Copy link
Contributor

Choose a reason for hiding this comment

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

Just a note that we'd need to add the release note on main as well 👍
Unsure if it's easier to target main, backport, then do the drop of docutils < 0.22 support

Copy link
Member

Choose a reason for hiding this comment

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

Just a note that we'd need to add the release note on main as well 👍

Not sure if we need it 🤔, adding this to 5.2.5 means that Django 5.2.5+ is compatible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@felixxm but if we add it only to 5.2.5 there would be a discrepancy between main and stable/5.2.x... I haven't seen that before! (other than the version bumps for releasing).

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry I mean that the release note should also exist on main

@nessita
Copy link
Contributor Author

nessita commented Aug 1, 2025

As discussed with Sarah, we'll be closing this in favor of #19693.

@nessita nessita closed this Aug 1, 2025
@nessita nessita deleted the docutils-0.22-compat branch August 1, 2025 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants