CrossNox / m2r2

Markdown to reStructuredText converter
https://crossnox.github.io/m2r2
MIT License
107 stars 26 forks source link

docutils 0.21 has removed nodes.reprunicode() and therefore building documentation using m2r2 fails #68

Open galadash opened 4 months ago

galadash commented 4 months ago

Our regular Jenkins pipelines to generate documentation have started failing due to a dependency issue caused by a new release of docutils: view change history here

  • docutils/nodes.py
    • Remove compatibility hacks nodes.reprunicode and nodes.ensure_str().

the following error is raised:

2024-04-17 16:32:18  Exception occurred:
2024-04-17 16:32:18    File "/data/jenkins/workspace/gda-project_gda-bb-utils_main/venv/lib/python3.10/site-packages/m2r2.py", line 611, in run
2024-04-17 16:32:18      path = nodes.reprunicode(path)
2024-04-17 16:32:18  AttributeError: module 'docutils.nodes' has no attribute 'reprunicode'

m2r2 only states a minimum requirement for docutils, and therefore my pipeline fails. my pipeline exists of the following commands in case this can be of any help:

python3 -m pip install sphinx
python3 -m pip install sphinxcontrib-confluencebuilder
python3 -m pip install autoclasstoc
python3 -m pip install m2r2
sphinx-build -b confluence ./doc/source ./build/confluence

Unfortunately, I'm out of time for today, and if necessary I will add more information tomorrow!

galadash commented 4 months ago

Just an update:

I found out this issue actually ONLY came to light after Sphinx's update on April 16 (2 days ago). Sphinx 7.3.0 changes Sphinx PR #11411 Before that update, as Sphinx was installed before m2r2, it would be leading to install its dependencies, and would have used "docutils>=0.18.1,<0.21",

Current Workaround is to fix the version in my requirements.txt (installed in a previous step in our Jenkins Pipeline) to fix the docutils==0.20.1 or docutils>0.21

drebbe-intrepid commented 2 months ago

came here to say "me too". Adding docutils>=0.18.1,<0.21 to my requirements.txt fixed it.

ReenigneArcher commented 3 weeks ago

It seems this repo is no longer maintained, and possibly no longer necessary?

I am going to try myst-parser: https://github.com/LizardByte/.github/pull/373

https://www.sphinx-doc.org/en/master/usage/markdown.html

CrossNox commented 3 weeks ago

If you can, please let us know if that works for you. I maintain it in my very limited free time and am focusing on the mistune v2 migration. The fix seems trivial enough, though.

ReenigneArcher commented 3 weeks ago

I think it works and there is a PR up to resolve it. https://github.com/CrossNox/m2r2/pull/69

It looks like your test workflow only runs on push events though. Would you like a PR to make it run on pull request events, so you can validate everything works before merging?