Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

AttributeError: module 'mistune' has no attribute 'BlockGrammar' in line 58 of m2r.py #66

Open
mcepl opened this issue Nov 23, 2021 · 17 comments

Comments

@mcepl
Copy link

mcepl commented Nov 23, 2021

When packaging new version of mistune (2.0.0-rc1) is included into openSUSE/Factory, this package’s test suite starts failing:

[   32s] + /usr/bin/python3.6 setup.py build '--executable=/usr/bin/python3.6 -s'
[   32s] Traceback (most recent call last):
[   32s]   File "setup.py", line 14, in <module>
[   32s]     from m2r import parse_from_file
[   32s]   File "/home/abuild/rpmbuild/BUILD/m2r-0.2.1/m2r.py", line 58, in <module>
[   32s]     class RestBlockGrammar(mistune.BlockGrammar):
[   32s] AttributeError: module 'mistune' has no attribute 'BlockGrammar'
[   32s] error: Bad exit status from /var/tmp/rpm-tmp.G27V7P (%build)

Complete build log with all versions of packages used and steps taken.

V3lop5 added a commit to NOWUM/EnSysMod that referenced this issue Dec 5, 2021
m2r seems to be broken with latest version of mistune
see: miyakogi/m2r#66
@ahopkins
Copy link

ahopkins commented Dec 6, 2021

I am getting this as well. Setting mistune<2.0.0 to fix the problem for now.

@crazyscientist
Copy link

This issue seems to be specific to Python 3.6.

With Python 3.8 m2r==0.2.1 and mistune==2.0.0 seem to work well together 🤔

@ahopkins
Copy link

ahopkins commented Dec 6, 2021

This issue seems to be specific to Python 3.6.

My CI uses the latest 3.9 (via latest Sphinx).

djgalloway pushed a commit to ceph/ceph that referenced this issue Dec 6, 2021
lubosmj added a commit to pulp/plugin_template that referenced this issue Dec 6, 2021
This temporary change is required to resolve issues in the CI pipeline (docs runner).

The change is inspired by miyakogi/m2r#66.

[noissue]
djgalloway pushed a commit to ceph/ceph that referenced this issue Dec 6, 2021
miyakogi/m2r#66

Signed-off-by: David Galloway <[email protected]>
(cherry picked from commit ed2ad24)
djgalloway pushed a commit to ceph/ceph that referenced this issue Dec 6, 2021
miyakogi/m2r#66

Signed-off-by: David Galloway <[email protected]>
(cherry picked from commit ed2ad24)
djgalloway pushed a commit to ceph/ceph that referenced this issue Dec 6, 2021
miyakogi/m2r#66

Signed-off-by: David Galloway <[email protected]>
(cherry picked from commit ed2ad24)
djgalloway pushed a commit to ceph/ceph that referenced this issue Dec 6, 2021
miyakogi/m2r#66

Signed-off-by: David Galloway <[email protected]>
(cherry picked from commit ed2ad24)
mdellweg pushed a commit to pulp/plugin_template that referenced this issue Dec 7, 2021
This temporary change is required to resolve issues in the CI pipeline (docs runner).

The change is inspired by miyakogi/m2r#66.

[noissue]
@mahendrapaipuri
Copy link

I am facing the same issue right now and it looks like mistune v2.* versions had huge revamp and there is no BlockGrammar class anymore by the looks of it -> https://github.com/lepture/mistune/blob/v2.0.0a1/mistune/__init__.py#L54-L59 . I think m2r2 needs to constraint the mistune version to <2.0.0 as suggested in one of the above comments?

@mahendrapaipuri
Copy link

The PR is waiting to be merged to fix this issue. Seems like this repository is not being maintained anymore.

@mcepl
Copy link
Author

mcepl commented Dec 8, 2021

The PR is waiting to be merged to fix this issue. Seems like this repository is not being maintained anymore.

Fixing the issue should actually mean fixing the issue.

@mcepl
Copy link
Author

mcepl commented Dec 8, 2021

Just to confirm that even with m2r-0.2.1 and mistune-2.0.0 I get exactly the same result.

Complete build log showing all packages used and steps taken to achieve the failed test.

@mahendrapaipuri
Copy link

@mcepl I agree that fixing the issue means revamping m2r2 with upstream changes in the API of mistune. But seems like no one is maintaining this repo anymore. As long as mistune>=2.0.0 is used to build m2r2, this will always break (due to changes in API in mistune>=2.0.0). So the quick fix would be to lock mistune<2.0.0.

@ahopkins
Copy link

ahopkins commented Dec 8, 2021

Sounds like an m2r3 is needed 😆

@mahendrapaipuri
Copy link

Wait, I have just realised that this is indeed "old" repository and the new "m2r2" is a fork of this repo and being actively maintained here -> https://github.com/CrossNox/m2r2 . They have already have a PR on this issue and hopefully it will be released soon.

guits pushed a commit to guits/ceph that referenced this issue Dec 8, 2021
miyakogi/m2r#66

Signed-off-by: David Galloway <[email protected]>
(cherry picked from commit ed2ad24)
@mcepl
Copy link
Author

mcepl commented Dec 8, 2021

They have already have a PR on this issue and hopefully it will be released soon.

And again, that PR is not fix just freezing old version of mistune.

joelostblom added a commit to joelostblom/altair that referenced this issue Mar 22, 2022
jadinm added a commit to cnp3/ipmininet that referenced this issue Mar 27, 2022
m2r does not support newest version of mistune:
see miyakogi/m2r#66
@jimhavrilla
Copy link

jimhavrilla commented Apr 6, 2022

Can you update pypi with this? If I pip install m2r I get this error. Works with 0.8.4 mistune.

qmonnet added a commit to qmonnet/cilium that referenced this issue Apr 8, 2022
Update the Python dependencies on the docs-builder image, to avoid
relying on old packages and limit the burden for the next updates of the
image.

Most packages are updated to their latest version, or to the latest
version possible as per the dependency graph.

Mistune is pinned to a version < 2.0.0 to fix an issue with m2r
(miyakogi/m2r#66), which is pulled as a
dependency to sphinxcontrib-openapi.

The Makefile for the documentation needs to be updated: the short-name
options for sphinx-autobuild seem to have disappeared, leaving the long
names only.

Signed-off-by: Quentin Monnet <[email protected]>
nbusseneau pushed a commit to cilium/cilium that referenced this issue Apr 12, 2022
Update the Python dependencies on the docs-builder image, to avoid
relying on old packages and limit the burden for the next updates of the
image.

Most packages are updated to their latest version, or to the latest
version possible as per the dependency graph.

Mistune is pinned to a version < 2.0.0 to fix an issue with m2r
(miyakogi/m2r#66), which is pulled as a
dependency to sphinxcontrib-openapi.

The Makefile for the documentation needs to be updated: the short-name
options for sphinx-autobuild seem to have disappeared, leaving the long
names only.

Signed-off-by: Quentin Monnet <[email protected]>
@amyreese
Copy link

Sounds like an m2r3 is needed 😆

I forked a new project, sphinx-mdinclude from m2r2, and did extensive work to upgrade to mistune 2.0. Details available at https://sphinx-mdinclude.readthedocs.io/en/latest/

@kloczek
Copy link

kloczek commented Jun 15, 2022

I just hit the same issue trying generate jupyter-server documentation.
Any chance to make new release updated against latest mistune?

qmonnet added a commit to qmonnet/openapi that referenced this issue Aug 11, 2022
m2r is unmaintained [0]. It relies on mistune, but is not compatible with
mistune versions >= 2.0 [1]. This makes it impossible to update mistune,
even though there is a CVE in the package [2].

Switch to sphinx-mdinclude instead.

There is also m2r2, but it is not a suitable alternative because they
simply force the use of an older mistune version.

[0] sphinx-contrib#123
[1] miyakogi/m2r#66
[2] GHSA-fw3v-x4f2-v673
[3] CrossNox/m2r2#43
qmonnet added a commit to cilium/openapi that referenced this issue Aug 11, 2022
m2r is unmaintained [0]. It relies on mistune, but is not compatible with
mistune versions >= 2.0 [1]. This makes it impossible to update mistune,
even though there is a CVE in the old versions of the package [2].

Switch to sphinx-mdinclude instead.

There is also m2r2, but it is not a suitable alternative because they
simply force the use of an older mistune version [3].

[0] sphinx-contrib#123
[1] miyakogi/m2r#66
[2] GHSA-fw3v-x4f2-v673
[3] CrossNox/m2r2#43
qmonnet added a commit to qmonnet/cilium that referenced this issue Aug 11, 2022
Sphinxcontrib-openapi relies on m2r. But m2r is unmaintained [0]. It
relies on mistune, but is not compatible with mistune versions >= 2.0
[1]. This makes it impossible to update mistune, even though there is a
CVE in the old versions of the package [2].

Switch to sphinx-mdinclude instead.

There is also m2r2, but it is not a suitable alternative because they
simply force the use of an older mistune version [3].

[0] sphinx-contrib/openapi#123
[1] miyakogi/m2r#66
[2] GHSA-fw3v-x4f2-v673
[3] CrossNox/m2r2#43

Signed-off-by: Quentin Monnet <[email protected]>
@kloczek
Copy link

kloczek commented Aug 12, 2022

Any plans to update m2r for mistune 2.x? 🤔

tklauser pushed a commit to cilium/cilium that referenced this issue Aug 17, 2022
Sphinxcontrib-openapi relies on m2r. But m2r is unmaintained [0]. It
relies on mistune, but is not compatible with mistune versions >= 2.0
[1]. This makes it impossible to update mistune, even though there is a
CVE in the old versions of the package [2].

Switch to sphinx-mdinclude instead.

There is also m2r2, but it is not a suitable alternative because they
simply force the use of an older mistune version [3].

[0] sphinx-contrib/openapi#123
[1] miyakogi/m2r#66
[2] GHSA-fw3v-x4f2-v673
[3] CrossNox/m2r2#43

Signed-off-by: Quentin Monnet <[email protected]>
tklauser pushed a commit to tklauser/cilium that referenced this issue Aug 17, 2022
[ upstream commit 4f893e8 ]

Sphinxcontrib-openapi relies on m2r. But m2r is unmaintained [0]. It
relies on mistune, but is not compatible with mistune versions >= 2.0
[1]. This makes it impossible to update mistune, even though there is a
CVE in the old versions of the package [2].

Switch to sphinx-mdinclude instead.

There is also m2r2, but it is not a suitable alternative because they
simply force the use of an older mistune version [3].

[0] sphinx-contrib/openapi#123
[1] miyakogi/m2r#66
[2] GHSA-fw3v-x4f2-v673
[3] CrossNox/m2r2#43

Signed-off-by: Quentin Monnet <[email protected]>
Signed-off-by: Tobias Klauser <[email protected]>
aditighag pushed a commit to cilium/cilium that referenced this issue Aug 22, 2022
[ upstream commit 4f893e8 ]

Sphinxcontrib-openapi relies on m2r. But m2r is unmaintained [0]. It
relies on mistune, but is not compatible with mistune versions >= 2.0
[1]. This makes it impossible to update mistune, even though there is a
CVE in the old versions of the package [2].

Switch to sphinx-mdinclude instead.

There is also m2r2, but it is not a suitable alternative because they
simply force the use of an older mistune version [3].

[0] sphinx-contrib/openapi#123
[1] miyakogi/m2r#66
[2] GHSA-fw3v-x4f2-v673
[3] CrossNox/m2r2#43

Signed-off-by: Quentin Monnet <[email protected]>
Signed-off-by: Tobias Klauser <[email protected]>
qmonnet added a commit to qmonnet/openapi that referenced this issue Aug 31, 2022
m2r is unmaintained [0]. It relies on mistune, but is not compatible with
mistune versions >= 2.0 [1]. This makes it impossible to update mistune,
even though there is a CVE in the old versions of the package [2].

Switch to sphinx-mdinclude instead.

There is also m2r2, but it is not a suitable alternative because they
simply force the use of an older mistune version [3].

[0] sphinx-contrib#123
[1] miyakogi/m2r#66
[2] GHSA-fw3v-x4f2-v673
[3] CrossNox/m2r2#43

Fixes: sphinx-contrib#123
qmonnet added a commit to qmonnet/openapi that referenced this issue Aug 31, 2022
m2r is unmaintained [0]. It relies on mistune, but is not compatible with
mistune versions >= 2.0 [1]. This makes it impossible to update mistune,
even though there is a CVE in the old versions of the package [2].

Switch to sphinx-mdinclude instead.

There is also m2r2, but it is not a suitable alternative because they
simply force the use of an older mistune version [3].

[0] sphinx-contrib#123
[1] miyakogi/m2r#66
[2] GHSA-fw3v-x4f2-v673
[3] CrossNox/m2r2#43

Fixes: sphinx-contrib#123
ninajika added a commit to ninajika/search-engine-parser that referenced this issue Sep 9, 2022
Needed because m2r does not support newest version of mistune: miyakogi/m2r#66
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants