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

Attribute undocumented error for an inherited attribute #8602

Closed
altendky opened this issue Dec 27, 2020 · 8 comments
Closed

Attribute undocumented error for an inherited attribute #8602

altendky opened this issue Dec 27, 2020 · 8 comments

Comments

@altendky
Copy link
Contributor

altendky commented Dec 27, 2020

Describe the bug

Sphinx complains about missing documentation for an attribute of an inherited class (staticMetaObject is an attribute of QObject, Reenter inherits from QObject). This showed up with Sphinx 3.4.0 and continues with 3.4.1. I thought this might have been the same issue as #8567, but it has not resolved.

https://github.com/altendky/qtrio/runs/1613081989

Warning, treated as error:
attribute qtrio.Reenter.staticMetaObject is undocumented

https://github.com/altendky/qtrio/blob/bf3bcc41e8d63216153bbc42709550429bcf38ff/qtrio/_core.py#L104-L112

class Reenter(QtCore.QObject):
    """A ``QtCore.QObject`` for handling reenter events."""

    def event(self, event: QtCore.QEvent) -> bool:
        """Qt calls this when the object receives an event."""

        reenter_event = typing.cast(Reenter, event)
        reenter_event.fn()
        return False

To Reproduce
Steps to reproduce the behavior:

git clone https://github.com/altendky/qtrio
cd qtrio
git checkout bf3bcc41e8d63216153bbc42709550429bcf38ff
python3 -m venv venv
venv/bin/pip install --upgrade pip setuptools wheel
venv/bin/pip install .[p_docs,pyside2]
venv/bin/pip freeze
source venv/bin/activate
cd docs
sphinx-build -nW -b html source build
Full session
$ git clone https://github.com/altendky/qtrio
Cloning into 'qtrio'...
remote: Enumerating objects: 181, done.
remote: Counting objects: 100% (181/181), done.
remote: Compressing objects: 100% (106/106), done.
remote: Total 5199 (delta 85), reused 112 (delta 45), pack-reused 5018
Receiving objects: 100% (5199/5199), 715.64 KiB | 5.55 MiB/s, done.
Resolving deltas: 100% (3390/3390), done.
$ cd qtrio
$ git checkout bf3bcc41e8d63216153bbc42709550429bcf38ff
Note: switching to 'bf3bcc41e8d63216153bbc42709550429bcf38ff'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at bf3bcc4 Merge pull request #187 from altendky/ci_is_on_linux_not_ubuntu
$ python3 -m venv venv
$ venv/bin/pip install --upgrade pip setuptools wheel
Collecting pip
  Using cached pip-20.3.3-py2.py3-none-any.whl (1.5 MB)
Collecting setuptools
  Using cached setuptools-51.1.0-py3-none-any.whl (2.0 MB)
Collecting wheel
  Using cached wheel-0.36.2-py2.py3-none-any.whl (35 kB)
Installing collected packages: pip, setuptools, wheel
  Attempting uninstall: pip
    Found existing installation: pip 20.2.3
    Uninstalling pip-20.2.3:
      Successfully uninstalled pip-20.2.3
  Attempting uninstall: setuptools
    Found existing installation: setuptools 49.2.1
    Uninstalling setuptools-49.2.1:
      Successfully uninstalled setuptools-49.2.1
Successfully installed pip-20.3.3 setuptools-51.1.0 wheel-0.36.2
$ venv/bin/pip install .[p_docs,pyside2]
Processing /home/altendky/tmp/qtrio/docs/qtrio/docs/qtrio/qtrio
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Collecting pyside2!=5.15.2
  Using cached PySide2-5.15.1-5.15.1-cp35.cp36.cp37.cp38.cp39-abi3-manylinux1_x86_64.whl (165.8 MB)
Collecting shiboken2==5.15.1
  Using cached shiboken2-5.15.1-5.15.1-cp35.cp36.cp37.cp38.cp39-abi3-manylinux1_x86_64.whl (941 kB)
Collecting sphinx>=3.2.1
  Using cached Sphinx-3.4.1-py3-none-any.whl (2.9 MB)
Requirement already satisfied: setuptools in ./venv/lib/python3.9/site-packages (from sphinx>=3.2.1->qtrio==0.3.0+dev) (51.1.0)
Collecting alabaster<0.8,>=0.7
  Using cached alabaster-0.7.12-py2.py3-none-any.whl (14 kB)
Collecting babel>=1.3
  Using cached Babel-2.9.0-py2.py3-none-any.whl (8.8 MB)
Collecting docutils>=0.12
  Using cached docutils-0.16-py2.py3-none-any.whl (548 kB)
Collecting Jinja2>=2.3
  Using cached Jinja2-2.11.2-py2.py3-none-any.whl (125 kB)
Collecting MarkupSafe>=0.23
  Using cached MarkupSafe-1.1.1-cp39-cp39-linux_x86_64.whl
Collecting Pygments>=2.0
  Using cached Pygments-2.7.3-py3-none-any.whl (950 kB)
Collecting pytz>=2015.7
  Using cached pytz-2020.5-py2.py3-none-any.whl (510 kB)
Collecting requests>=2.5.0
  Using cached requests-2.25.1-py2.py3-none-any.whl (61 kB)
Collecting certifi>=2017.4.17
  Using cached certifi-2020.12.5-py2.py3-none-any.whl (147 kB)
Collecting chardet<5,>=3.0.2
  Using cached chardet-4.0.0-py2.py3-none-any.whl (178 kB)
Collecting idna<3,>=2.5
  Using cached idna-2.10-py2.py3-none-any.whl (58 kB)
Collecting snowballstemmer>=1.1
  Using cached snowballstemmer-2.0.0-py2.py3-none-any.whl (97 kB)
Collecting sphinx-qt-documentation>=0.3
  Using cached sphinx_qt_documentation-0.3-py3-none-any.whl (5.6 kB)
Collecting towncrier>=19.9.0rc1
  Using cached towncrier-19.9.0rc1-py2.py3-none-any.whl (28 kB)
Collecting trio>=0.16
  Using cached trio-0.17.0-py3-none-any.whl (354 kB)
Collecting async-generator
  Using cached async_generator-1.10-py3-none-any.whl (18 kB)
Collecting attrs
  Using cached attrs-20.3.0-py2.py3-none-any.whl (49 kB)
Collecting urllib3<1.27,>=1.21.1
  Using cached urllib3-1.26.2-py2.py3-none-any.whl (136 kB)
Collecting click
  Using cached click-7.1.2-py2.py3-none-any.whl (82 kB)
Collecting click-default-group
  Using cached click_default_group-1.2.2-py3-none-any.whl
Collecting decorator
  Using cached decorator-4.4.2-py2.py3-none-any.whl (9.2 kB)
Collecting imagesize
  Using cached imagesize-1.2.0-py2.py3-none-any.whl (4.8 kB)
Collecting incremental
  Using cached incremental-17.5.0-py2.py3-none-any.whl (16 kB)
Collecting outcome
  Using cached outcome-1.1.0-py2.py3-none-any.whl (9.7 kB)
Collecting packaging
  Using cached packaging-20.8-py2.py3-none-any.whl (39 kB)
Collecting pyparsing>=2.0.2
  Using cached pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
Collecting qtpy
  Using cached QtPy-1.9.0-py2.py3-none-any.whl (54 kB)
Collecting sniffio
  Using cached sniffio-1.2.0-py3-none-any.whl (10 kB)
Collecting sortedcontainers
  Using cached sortedcontainers-2.3.0-py2.py3-none-any.whl (29 kB)
Collecting sphinx-autodoc-typehints
  Using cached sphinx_autodoc_typehints-1.11.1-py3-none-any.whl (8.7 kB)
Collecting sphinx-rtd-theme
  Using cached sphinx_rtd_theme-0.5.0-py2.py3-none-any.whl (10.8 MB)
Collecting sphinxcontrib-applehelp
  Using cached sphinxcontrib_applehelp-1.0.2-py2.py3-none-any.whl (121 kB)
Collecting sphinxcontrib-devhelp
  Using cached sphinxcontrib_devhelp-1.0.2-py2.py3-none-any.whl (84 kB)
Collecting sphinxcontrib-htmlhelp
  Using cached sphinxcontrib_htmlhelp-1.0.3-py2.py3-none-any.whl (96 kB)
Collecting sphinxcontrib-jsmath
  Using cached sphinxcontrib_jsmath-1.0.1-py2.py3-none-any.whl (5.1 kB)
Collecting sphinxcontrib-qthelp
  Using cached sphinxcontrib_qthelp-1.0.3-py2.py3-none-any.whl (90 kB)
Collecting sphinxcontrib-serializinghtml
  Using cached sphinxcontrib_serializinghtml-1.1.4-py2.py3-none-any.whl (89 kB)
Collecting sphinxcontrib-trio
  Using cached sphinxcontrib_trio-1.1.2-py3-none-any.whl (12 kB)
Collecting toml
  Using cached toml-0.10.2-py2.py3-none-any.whl (16 kB)
Building wheels for collected packages: qtrio
  Building wheel for qtrio (PEP 517) ... done
  Created wheel for qtrio: filename=qtrio-0.3.0+dev-py3-none-any.whl size=41154 sha256=601959ca3a3597667c02b0fe1e5abb56fef1f2e2b480fbc00752535175666441
  Stored in directory: /tmp/pip-ephem-wheel-cache-u86y0iaf/wheels/ef/12/fd/6b7ad21a42f66f30c17bf16d8a2ff4056ed7d8b0b3b2345fcf
Successfully built qtrio
Installing collected packages: urllib3, pytz, pyparsing, MarkupSafe, idna, chardet, certifi, attrs, sphinxcontrib-serializinghtml, sphinxcontrib-qthelp, sphinxcontrib-jsmath, sphinxcontrib-htmlhelp, sphinxcontrib-devhelp, sphinxcontrib-applehelp, sortedcontainers, snowballstemmer, sniffio, requests, Pygments, packaging, outcome, Jinja2, imagesize, docutils, click, babel, async-generator, alabaster, trio, toml, sphinx, shiboken2, qtpy, incremental, decorator, click-default-group, towncrier, sphinxcontrib-trio, sphinx-rtd-theme, sphinx-qt-documentation, sphinx-autodoc-typehints, qtrio, pyside2
Successfully installed Jinja2-2.11.2 MarkupSafe-1.1.1 Pygments-2.7.3 alabaster-0.7.12 async-generator-1.10 attrs-20.3.0 babel-2.9.0 certifi-2020.12.5 chardet-4.0.0 click-7.1.2 click-default-group-1.2.2 decorator-4.4.2 docutils-0.16 idna-2.10 imagesize-1.2.0 incremental-17.5.0 outcome-1.1.0 packaging-20.8 pyparsing-2.4.7 pyside2-5.15.1 pytz-2020.5 qtpy-1.9.0 qtrio-0.3.0+dev requests-2.25.1 shiboken2-5.15.1 sniffio-1.2.0 snowballstemmer-2.0.0 sortedcontainers-2.3.0 sphinx-3.4.1 sphinx-autodoc-typehints-1.11.1 sphinx-qt-documentation-0.3 sphinx-rtd-theme-0.5.0 sphinxcontrib-applehelp-1.0.2 sphinxcontrib-devhelp-1.0.2 sphinxcontrib-htmlhelp-1.0.3 sphinxcontrib-jsmath-1.0.1 sphinxcontrib-qthelp-1.0.3 sphinxcontrib-serializinghtml-1.1.4 sphinxcontrib-trio-1.1.2 toml-0.10.2 towncrier-19.9.0rc1 trio-0.17.0 urllib3-1.26.2
$ venv/bin/pip freeze
alabaster==0.7.12
async-generator==1.10
attrs==20.3.0
Babel==2.9.0
certifi==2020.12.5
chardet==4.0.0
click==7.1.2
click-default-group==1.2.2
decorator==4.4.2
docutils==0.16
idna==2.10
imagesize==1.2.0
incremental==17.5.0
Jinja2==2.11.2
MarkupSafe==1.1.1
outcome==1.1.0
packaging==20.8
Pygments==2.7.3
pyparsing==2.4.7
PySide2==5.15.1
pytz==2020.5
QtPy==1.9.0
qtrio @ file:///home/altendky/tmp/qtrio/docs/qtrio/docs/qtrio/qtrio
requests==2.25.1
shiboken2==5.15.1
sniffio==1.2.0
snowballstemmer==2.0.0
sortedcontainers==2.3.0
Sphinx==3.4.1
sphinx-autodoc-typehints==1.11.1
sphinx-qt-documentation==0.3
sphinx-rtd-theme==0.5.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==1.0.3
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.4
sphinxcontrib-trio==1.1.2
toml==0.10.2
towncrier==19.9.0rc1
trio==0.17.0
urllib3==1.26.2
$ source venv/bin/activate
(venv) $ cd docs
(venv) $ sphinx-build -nW -b html source build
Running Sphinx v3.4.1
making output directory... done
loading intersphinx inventory from https://outcome.readthedocs.io/en/stable/objects.inv...
loading intersphinx inventory from https://docs.python.org/3/objects.inv...
loading intersphinx inventory from https://www.riverbankcomputing.com/static/Docs/PyQt5/objects.inv...
loading intersphinx inventory from https://docs.pytest.org/en/stable/objects.inv...
loading intersphinx inventory from https://pytest-trio.readthedocs.io/en/stable/objects.inv...
loading intersphinx inventory from https://trio.readthedocs.io/en/stable/objects.inv...
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 15 source files that are out of date
updating environment: [new config] 15 added, 0 changed, 0 removed
reading sources... [100%] testing                                                                                                                                                                                                                                              

Warning, treated as error:
attribute qtrio.Reenter.staticMetaObject is undocumented

Expected behavior
I expected no warnings/errors since the attribute is only inherited.

Your project
https://github.com/altendky/qtrio/tree/bf3bcc41e8d63216153bbc42709550429bcf38ff

Screenshots
n/a

Environment info

  • OS: Ubuntu Linux
  • Python version: CPython 3.8 and 3.9 (others untested)
  • Sphinx version: 3.4.0 and 3.4.1, was ok for <3.4
  • Sphinx extensions:
    "sphinx.ext.autodoc",
    "sphinx.ext.intersphinx",
    "sphinx.ext.coverage",
    "sphinx.ext.napoleon",
    "sphinx.ext.viewcode",
    "sphinx_autodoc_typehints",
    "sphinx_qt_documentation",
    "sphinxcontrib_trio",
  • Extra tools: n/a

Additional context
n/a

@tk0miya
Copy link
Member

tk0miya commented Dec 28, 2020

AFAIK, Sphinx does not emit such a warning. I guess the warning came from 3rd party extensions.

@tk0miya
Copy link
Member

tk0miya commented Dec 28, 2020

@altendky
Copy link
Contributor Author

Thanks for taking a look and for pointing out that my own code is generating the warning. Obviously I should have identified this myself and included it in the original report.

That said, it isn't clear to me yet why this should have changed with v3.4.0. I'm trying to walk through with a debugger to understand this better. There are many other inherited attributes that this does not happen for and while I don't yet know what about it would be significant, staticMetaObject is the only attribute listed for QObject as 'static' (C++) and which is not a method.

https://doc.qt.io/qt-5/qobject.html#static-public-members

I'll let you know what I find.

@altendky
Copy link
Contributor Author

A bisect points at 3638a9e and the comments at 3638a9e#r45371488 sound applicable to my case. You said the change was not intended but I don't see a link to any other issues being reported or PRs. The symptom (my warning) is still present at f18e988.

Do you expect to undo this changed behavior? I understand that other tasks, for Sphinx or just life in general, likely take priority but I want to understand if this is viewed as a bug to be fixed or if I should adapt to the new behavior.

altendky referenced this issue Dec 28, 2020
This deprecates `no_docstring` argument for Documenter.add_content().
After this change, please use Documenter.get_doc() to control (suppress)
the content of the python object.
@tk0miya
Copy link
Member

tk0miya commented Dec 28, 2020

About 3638a9e, I fixed it in #8581, and it was released as v3.4.1 now. If my understanding is correct, it has been already fixed. But, it seems I need to retake a look (and deeply).

@tk0miya
Copy link
Member

tk0miya commented Dec 29, 2020

Finally, I found the reason for this error. And I confirmed #8611 surely fixes it.

FROM python:3.8-slim

RUN apt update; apt install -y build-essential curl git make unzip vim
RUN git clone https://github.com/altendky/qtrio
WORKDIR /qtrio
RUN git checkout bf3bcc41e8d63216153bbc42709550429bcf38ff
RUN pip install --upgrade pip setuptools wheel
RUN pip install .[p_docs,pyside2]
RUN pip freeze
WORKDIR /qtrio/docs
RUN apt install -y python-pyqt5
RUN pip install git+https://github.com/tk0miya/sphinx@8602_process-docstring_for_nondatadescriptors
RUN sphinx-build -nW -b html source build

@tk0miya tk0miya added this to the 3.4.2 milestone Dec 29, 2020
tk0miya added a commit that referenced this issue Dec 31, 2020
…atadescriptors

Fix #8602: autodoc: The ``autodoc-process-docstring`` event is emitted to the non-datadescriptors unexpectedly
@tk0miya tk0miya closed this as completed Dec 31, 2020
@altendky
Copy link
Contributor Author

My apologies. I meant to get back to this when you posted the fix and test it out but managed to get myself distracted. Thank you once again for the prompt debugging and resolution.

@tk0miya
Copy link
Member

tk0miya commented Dec 31, 2020

Don't mind. Originally, this bug was embedded by me accidentally in the last release. So it's my work :-)

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 16, 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