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

Very slow build time with v3.0.1 #7479

Closed
jklaise opened this issue Apr 14, 2020 · 3 comments
Closed

Very slow build time with v3.0.1 #7479

jklaise opened this issue Apr 14, 2020 · 3 comments

Comments

@jklaise
Copy link

jklaise commented Apr 14, 2020

Describe the bug
After upgrading to 3.0.1 (and hotfixing m2r bug #7420), the build of the docs takes a very long time (~1500s compared to ~30s on 2.4.4). Most of the time is spent on reading sources which I generate dynamically with sphinxcontrib.apidoc. This extension just calls sphinx-apidoc, I have checked that the problem persists if I call sphinx-apidoc directly to generate sources first and then make html which results in a very slow build.

To Reproduce
To build our docs you also need pandoc which can be installed via package manager such as conda or via the OS one.

Steps to reproduce the behavior:

$ git clone https://github.com/SeldonIO/alibi.git
$ cd alibi
$ pip install -r requirements/requirements_ci.txt
$ pip uninstall m2r
$ pip install m2r @ git+https://github.com/crossnox/m2r@dev#egg=m2r
$ pip install -e .
$ make build_docs

Expected behavior
Docs build in a reasonable amount of time.

Your project
https://github.com/SeldonIO/alibi

Screenshots
If applicable, add screenshots to help explain your problem.

Environment info

  • OS: Arch Linux
  • Python version: 3.7.3
  • Sphinx version: 3.0.1
  • Sphinx extensions:
    [
    'sphinx.ext.autodoc',
    'sphinx.ext.doctest',
    'sphinx.ext.intersphinx',
    'sphinx.ext.todo',
    'sphinx.ext.coverage',
    'sphinx.ext.mathjax',
    'sphinx.ext.ifconfig',
    'sphinx.ext.viewcode',
    'sphinx.ext.napoleon',
    'sphinx_autodoc_typehints',
    'sphinxcontrib.apidoc',
    'nbsphinx',
    'nbsphinx_link',
    'm2r'
    ]

Additional context

sophiamyang added a commit to sophiamyang/pyviz.org that referenced this issue Apr 15, 2020
sophiamyang added a commit to sophiamyang/pyviz.org that referenced this issue Apr 15, 2020
TypeError: add_source_parser() positional arguments error in Sphinx v3.0.0
following recommendation sphinx-doc/sphinx#7420 to change m2r to m2r @ git+https://github.com/crossnox/m2r@dev#egg=m2r
sphinx-doc/sphinx#7479
jbednar pushed a commit to pyviz/pyviz.org that referenced this issue Apr 15, 2020
TypeError: add_source_parser() positional arguments error in Sphinx v3.0.0
following recommendation sphinx-doc/sphinx#7420 to change m2r to m2r @ git+https://github.com/crossnox/m2r@dev#egg=m2r
sphinx-doc/sphinx#7479
@fragmuffin
Copy link

fragmuffin commented Apr 16, 2020

I'm experiencing a similar slowdown on a closed-source project.

extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.doctest',
    'sphinx.ext.intersphinx',
    'sphinx.ext.mathjax',
]

Environment

$ lsb_release -d
Description:	Ubuntu 18.04.3 LTS
$ sphinx-build --version
sphinx-build 3.0.1
$ python --version
Python 3.6.8

Search for root cause

With all api docs removed except for the following:

.. automodule:: ucontrol.battery_ctrl
   :members:
   :undoc-members:
   :show-inheritance:

reading sources still takes a few seconds (much longer than it should)

When removing :members: OR :undoc-members: (or both), the slowdown is no longer there.
(removing :show-inheritance: makes no difference)

So, not a root cause, but at least it's a breadcrumb.

edit: I'm also using autodoc_mock_imports (and so is https://github.com/SeldonIO/alibi (see link in original bug report))

@tk0miya tk0miya added this to the 3.0.2 milestone Apr 18, 2020
tk0miya added a commit to tk0miya/sphinx that referenced this issue Apr 18, 2020
Call ``inspect.unwrap()`` for Mocked objects and modules causes
deep recurrsion calls. As a result, it causes slow builds.  This
skips to try documenting mocked objects on filtering members.
tk0miya added a commit to tk0miya/sphinx that referenced this issue Apr 18, 2020
Call ``inspect.unwrap()`` for Mocked objects and modules causes
deep recurrsion calls. As a result, it causes slow builds.  This
skips to try documenting mocked objects on filtering members.
tk0miya added a commit that referenced this issue Apr 19, 2020
Fix #7479: autodoc: Sphinx builds has been slower since 3.0.0
tk0miya added a commit that referenced this issue Apr 19, 2020
Call ``inspect.unwrap()`` for Mocked objects and modules causes
deep recurrsion calls. As a result, it causes slow builds.  This
skips to try documenting mocked objects on filtering members.
@tk0miya
Copy link
Member

tk0miya commented Apr 19, 2020

Fixed by #7504. It will be released as 3.0.2 soon (see #7505).
Thank you for reporting!

@fragmuffin
Copy link

Fix confirmed working with my project.
Thank you for the fix!; greatly appreciated 👍

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

3 participants