Docutils 0.22 introduced a breaking-ish change that affects how the writer
argument is handled in docutils.core.publish_parts()
, which is used in admindocs' parse_rst()
.
In version 0.22 and above, the writer
argument can be an instance *or* a string. Earlier versions (0.19 through 0.21) only support passing the writer name as a string via writer_name
, *or* passing an instance directly to writer
, but not both interchangeably.
An earlier patch (65ab92f6a83644bbb555d0eff3a02d8d9301aba4) was backported to Django 5.2.x to avoid test failures and runtime errors with docutils 0.22+, since Django does not currently restrict the dependency beyond requiring version 0.19 or higher. However, that patch introduced a backward incompatibility with docutils < 0.22, which now fails due to the changed usage pattern.
To fix this, a version-agnostic approach is proposed: explicitly instantiate the writer and avoid use of writer_name
. This ensures compatibility with all currently supported docutils versions without needing to bump the minimum required version.
Thank you, confirmed we have test failures with docutils < 0.22
As discussed on the PR, we can bump minimum supported version on main to 0.22 as this is the first to support Python 3.12 (minum supported Python version since #36005). Hence, it makes sense for this PR to target 5.2