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

Extensions not working with autoapi.extension #21

Open
dvonessen opened this issue Jun 19, 2020 · 9 comments · Fixed by #28
Open

Extensions not working with autoapi.extension #21

dvonessen opened this issue Jun 19, 2020 · 9 comments · Fixed by #28
Labels
type:bug Something isn't working

Comments

@dvonessen
Copy link

Hello,

first thank you for this great and simple extension.
I am quite new to sphinx and restructured text, please do not mind if anything is missing.

Configuration
config.py

...
extensions = [
    "sphinx.ext.intersphinx",
    "autoapi.extension",
    "sphinx.ext.viewcode",
    "sphinx_multiversion",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ["_autoapi_templates", "_build", "Thumbs.db", ".DS_Store"]

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"

# -- autoapi configuration -----------------------------------------------
autoapi_type = "python"
autoapi_dirs = ["../dbv1_cdk"]
autoapi_member_order = "groupwise"
autoapi_template_dir = "_autoapi_templates"
autoapi_options = [
    "imported-members",
    "members",
    "show-inheritance",
    "show-module-summary",
    # "special-members",
    "undoc-members",
]
autoapi_keep_files = True

# -- Multiversion configuration ---------------------------------------------
# See: https://holzhaus.github.io/sphinx-multiversion/master/index.html
smv_branch_whitelist = r"^.*$"
smv_tag_whitelist = r"^\d+\.\d+\.\d+$"
smv_released_pattern = r"^tags/\d+\.\d+\.\d+"
...

index.rst

Quickstart
==========

.. toctree::
   :maxdepth: 2

   guides/quickstart

.. toctree::
   :maxdepth: 2

   autoapi/index

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

When I invoke sphinx-build SRC DST building the documentation works as expected, but with sphinx-multiversion I am getting following errors.

Running Sphinx v3.1.1
loading intersphinx inventory from https://docs.aws.amazon.com/cdk/api/latest/python/objects.inv...
loading intersphinx inventory from https://docs.python.org/3/objects.inv...
[AutoAPI] Reading files... [100%] /workspaces/serviceteamdbv2/dbv1_cdk/dbv1_cdk/base_lib/base_config_parser.py                                                                                                     
[AutoAPI] Mapping Data... [100%] /workspaces/serviceteamdbv2/dbv1_cdk/dbv1_cdk/base_lib/base_config_parser.py                                                                                                      
[AutoAPI] Rendering Data... [  6%] dbv1_cdk.example_package_1
[AutoAPI] Rendering Data... [ 12%] dbv1_cdk.dbv1_core
[AutoAPI] Rendering Data... [ 18%] dbv1_cdk.dbv1_ec2
[AutoAPI] Rendering Data... [ 25%] dbv1_cdk.dbv1_s3
[AutoAPI] Rendering Data... [ 31%] dbv1_cdk.dbv1_kms
[AutoAPI] Rendering Data... [ 37%] dbv1_cdk.dbv1_ssm
[AutoAPI] Rendering Data... [ 43%] dbv1_cdk
[AutoAPI] Rendering Data... [ 50%] dbv1_cdk.dbv1_autoscaling
[AutoAPI] Rendering Data... [ 56%] dbv1_cdk.dbv1_iam
[AutoAPI] Rendering Data... [ 62%] dbv1_cdk.base
[AutoAPI] Rendering Data... [ 68%] dbv1_cdk.example_package_2
[AutoAPI] Rendering Data... [ 75%] dbv1_cdk.tools
[AutoAPI] Rendering Data... [ 81%] dbv1_cdk.tools.pattern
[AutoAPI] Rendering Data... [ 87%] dbv1_cdk.tools.helper
[AutoAPI] Rendering Data... [ 93%] dbv1_cdk.base_lib
[AutoAPI] Rendering Data... [100%] dbv1_cdk.base_lib.base_config_parser

building [mo]: targets for 0 po files that are out of date
building [html]: targets for 2 source files that are out of date
updating environment: [new config] 2 added, 0 changed, 0 removed
[AutoAPI] Adding AutoAPI TOCTree [autoapi/index] to index.rst                                                                                                                                                      

/tmp/tmpcg1lzdqn/c5a47d28e21752e4a9b0dbc440fff5e1756c196b/docs/index.rst:9: WARNING: toctree contains reference to nonexisting document 'autoapi/index'
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index                                                                                                                                                                                     
/tmp/tmpcg1lzdqn/c5a47d28e21752e4a9b0dbc440fff5e1756c196b/docs/index.rst:9: WARNING: toctree contains reference to nonexisting document 'autoapi/index'
/tmp/tmpcg1lzdqn/c5a47d28e21752e4a9b0dbc440fff5e1756c196b/docs/index.rst:9: WARNING: toctree contains reference to nonexisting document 'autoapi/index'
/tmp/tmpcg1lzdqn/c5a47d28e21752e4a9b0dbc440fff5e1756c196b/docs/index.rst:9: WARNING: toctree contains reference to nonexisting document 'autoapi/index'
generating indices...  genindex/tmp/tmpcg1lzdqn/c5a47d28e21752e4a9b0dbc440fff5e1756c196b/docs/index.rst:9: WARNING: toctree contains reference to nonexisting document 'autoapi/index'
done
writing additional pages...  search/tmp/tmpcg1lzdqn/c5a47d28e21752e4a9b0dbc440fff5e1756c196b/docs/index.rst:9: WARNING: toctree contains reference to nonexisting document 'autoapi/index'
done
copying static files... ... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded, 6 warnings.

The HTML pages are in docs/_build/html/sphinx.

I can verify that this problem does not exists if i comment the extension autoapi.extension out of the config.py.
Maybe I missconfigured anything?

Thank you for your help!

@dvonessen
Copy link
Author

@Holzhaus do you have any clue?

@ThomasSteinbach
Copy link

Hi, I ran into exact the same problem. It would be nice to get to know, how to get sphinx-multiversion to work with autoapi.

Holzhaus added a commit that referenced this issue Aug 5, 2020
This avoids issues with cached modules without messing around with
`sys.modules` and requiring further configuration from the user.

Resolves #21 and #22.
Holzhaus added a commit that referenced this issue Aug 5, 2020
This avoids issues with cached modules without messing around with
`sys.modules` or requiring further configuration from the user.

Resolves #21 and #22.
Holzhaus added a commit that referenced this issue Aug 5, 2020
This avoids issues with cached modules without messing around with
`sys.modules` or requiring further configuration from the user.
The performance penalty should be neglible.

Resolves #21 and #22.
@Holzhaus
Copy link
Collaborator

Holzhaus commented Aug 5, 2020

I'm not familiar with autoapi, but it might be fixed by #28. Please let me know if that resolves the issue.

@dvonessen
Copy link
Author

@Holzhaus sorry for the late response, no it does not work.
I think the problem is, that the autoapi.extension is building the source in the docs directory and not in the tmp directories used with sphinx-multiversion.
I am not that familiar wit sphinx, maybe you can help to debug this a little bit more.

@Holzhaus Holzhaus reopened this Oct 23, 2020
@Holzhaus
Copy link
Collaborator

That sounds more like a bug with that extension, but I'm not familiar with it.

@dvonessen
Copy link
Author

Hmmm. That is a pitty!
Any recommendations how to use API documentation automatically?

@dvdjlaw
Copy link

dvdjlaw commented Dec 3, 2020

@dvonessen We are using autoapi.extension slightly differently than you are, but we are able to use it with sphinx-multiversion in our project. Maybe this will help you identify what's not working in your configuration.

@isaksamsten
Copy link

isaksamsten commented Feb 22, 2021

I got it to work pass -D autoapi_root="\${sourcedir}" -D autoapi_dirs="\${sourcedir}/../src"

and add "yourpackage/index" in your toctree

@adam-grant-hendry
Copy link

I got it to work pass -D autoapi_root="\${sourcedir}" -D autoapi_dirs="\${sourcedir}/../src"

and add "yourpackage/index" in your toctree

Perhaps root cause is identified in #76 ?

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

Successfully merging a pull request may close this issue.

7 participants