Skip to content
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

myst-parser 0.18.0 causes undocumented subclass class attributes to appear in docs #583

Closed
oscarbenjamin opened this issue Jun 8, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@oscarbenjamin
Copy link

Describe the bug

This comes from building the SymPy docs. There are related SymPy and Sphinx issues here:
sympy/sympy#23598
sphinx-doc/sphinx#10538

Building the SymPy docs with myst-parser 0.18.0 leads to lots of warnings like:

docstring of sympy.polys.domains.field.Field.is_Field:14: WARNING: more than one target found for cross-reference 'is_Ring': sympy.polys.domains.domain.Domain.is_Ring, sympy.polys.domains.ring.Ring.is_Ring

What is happening is that the Domain class has an attribute is_Ring which has a docstring and shoud show in the docs. The subclass Ring also sets the attribute but without a docstring and should not show in the docs. Somehow using myst-parser 0.18.0 causes the Ring.is_Ring attribute to show in the docs. Then any see also references to is_Ring fail because there are multiple targets.

Full output in CI can be seen here:
https://github.com/sympy/sympy/runs/6784391829?check_suite_focus=true

The problem seems to be that there is a class Domain which has a documented attribute is_Ring:
https://github.com/sympy/sympy/blob/a96dce8b55675a0529d9bed479e2569126e27149/sympy/polys/domains/domain.py#L245-L262
You can see that in the docs here:
https://docs.sympy.org/dev/modules/polys/domainsref.html#sympy.polys.domains.domain.Domain.is_Ring

Then there is a class Ring which is a subclass of Domain and changes the value of the class attribute but does not document it:
https://github.com/sympy/sympy/blob/a96dce8b55675a0529d9bed479e2569126e27149/sympy/polys/domains/ring.py#L13

In previous versions of myst-parser the Ring class would not show the is_Ring attribute:
https://docs.sympy.org/dev/modules/polys/domainsref.html#sympy.polys.domains.ring.Ring

Building with myst-parser 0.17.2 there are no warnings and the Ring.is_Ring attribute does not show in the docs (which is the desired behaviour).

I'm not sure if this should be considered a bug in MyST-Parser or Sphinx or if it's actually a problem with the SymPy docs. In any case the change to myst-parser 0.18.0 has triggered the problem and I can confirm that installing 0.17.2 instead makes the problem go away so somehow the change is related to MyST-Parser.

Reproduce the bug

$ git clone https://github.com/sympy/sympy.git
$ cd sympy/doc
$ pip install -r requirements.txt
$ make html
$ # open _build/html/modules/polys/domainsref.html

List your environment

No response

@oscarbenjamin oscarbenjamin added the bug Something isn't working label Jun 8, 2022
@welcome
Copy link

welcome bot commented Jun 8, 2022

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.

If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).

Welcome to the EBP community! 🎉

@chrisjsewell
Copy link
Member

Heya, yeh definitely nothing to do with myst-parser and purely due to the change in sphinx version.
It probably was just failing silently before, as I found myself in: aiidateam/aiida-core@58a5d80

@oscarbenjamin
Copy link
Author

Oh, I see. Changing the myst-parser version change the Sphinx version as well. I've confirmed that forcing sphinx to be 5.0.1 while keeping myst-parser at 0.17.2 still reproduces the problem so it's definitely a Sphinx problem.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants