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

Sphinx 3.1.0 build fails with unexpected indentation on @classproperty with no docstring #7805

Closed
dvorapa opened this issue Jun 8, 2020 · 2 comments

Comments

@dvorapa
Copy link

dvorapa commented Jun 8, 2020

Describe the bug
Since update to Sphinx 3.1.0, Pywikibot build fails with "unexpected indentation" on a @classproperty with no docstring. The error can be found here: https://integration.wikimedia.org/ci/job/pywikibot-core-tox-doc-docker/10136/console

To Reproduce
Steps to reproduce the behavior:

$ git clone https://github.com/wikimedia/pywikibot
$ cd pywikibot
$ pip install .[security]
$ pip install -r requirements.txt
$ pip install -r docs/requirements-py3.txt
$ pip install rstcheck >= 3.3.1
$ sphinx-build -M html ./docs ./docs/_build
$ rstcheck --recursive --report warning --ignore-directives automodule,autoclass,autofunction .

Expected behavior
rstcheck does not report any error and build under Sphinx 3.0.4 worked. There should be no difference or clearly defined, what's wrong with our code. I read changelog for 3.1.0 thoroughly, but could not find any indication, what is wrong. Also the error message is not much informative.

You can see the problematic @classproperty here: https://phabricator.wikimedia.org/diffusion/PWBC/browse/master/pywikibot/families/wikisource_family.py$71

Your project
Link to your sphinx project, or attach zipped small project sample.

https://github.com/wikimedia/pywikibot

Environment info

Additional context
Console output: https://integration.wikimedia.org/ci/job/pywikibot-core-tox-doc-docker/10136/console
Problematic @classproperty: https://phabricator.wikimedia.org/diffusion/PWBC/browse/master/pywikibot/families/wikisource_family.py$71

@dvorapa dvorapa changed the title Sphinx 3.1.0 build fails with unexpected indentation on classproperty with no docstring Sphinx 3.1.0 build fails with unexpected indentation on @classproperty with no docstring Jun 9, 2020
wmfgerrit pushed a commit to wikimedia/pywikibot that referenced this issue Jun 9, 2020
sphinx-doc/sphinx#7805

Change-Id: I694f1be3593c6fc95928d24677f313705b70952b
@tk0miya
Copy link
Member

tk0miya commented Jun 12, 2020

I confired the error:

FROM python:3.7-slim

RUN apt update; apt install -y git make build-essential vim
RUN git clone https://github.com/wikimedia/pywikibot
WORKDIR /pywikibot
RUN pip3 install -e .
RUN pip3 install -r requirements.txt
RUN pip3 install -U sphinx
RUN pip3 install -U sphinx_epytext
WORKDIR /pywikibot/docs
RUN make html

And it seems Sphinx internally generates a following reST source for Family.code_aliases:

   .. py:attribute:: Family.code_aliases
      :module: pywikibot.families.wikisource_family

      dict() -> new empty dictionary
      dict(mapping) -> new dictionary initialized from a mapping object's
          (key, value) pairs
      dict(iterable) -> new dictionary initialized as if via:
          d = {}
          for k, v in iterable:
              d[k] = v
      dict(**kwargs) -> new dictionary initialized with the name=value pairs
          in the keyword argument list.  For example:  dict(one=1, two=2)

I don't know why it returns dict's docstring. But this is why Sphinx causes "unexpected indentation" error. I'll continue to investigate this.

@tk0miya
Copy link
Member

tk0miya commented Jun 13, 2020

Note: This would be a side effect of #7557.

@tk0miya tk0miya added this to the 3.1.1 milestone Jun 13, 2020
tk0miya added a commit to tk0miya/sphinx that referenced this issue Jun 13, 2020
tk0miya added a commit to tk0miya/sphinx that referenced this issue Jun 13, 2020
tk0miya added a commit to tk0miya/sphinx that referenced this issue Jun 14, 2020
tk0miya added a commit that referenced this issue Jun 14, 2020
Fix #7805: autodoc: an object which descriptors returns is documented
@tk0miya tk0miya closed this as completed Jun 14, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants