-
Notifications
You must be signed in to change notification settings - Fork 134
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
Add warning message for unresolved python elements #419
Comments
I've haven't checked this yet but I think that it's a behaviour of autodoc. The manual directives are built on top of autodoc, and therefore we inherit some of the behaviour that autodoc has. Unfortunately, I think that this is one of those behaviours. |
@AWhetter : I've checked now. When I use
This happens in: https://github.com/sphinx-doc/sphinx/blob/cb8a28dd7e11a7a0a5bc9694163fc164433e2f36/sphinx/ext/autodoc/importer.py#L163 I think the problem occurs with sphinx-autoapi because it doesn't use the import method of the autodoc classes, but instead does a lookup in env.autoapi_objects. And if that lookup fails, there is no warning. |
@AWhetter : I've added the warning as a feature. When running tests on sphinx-autoapi locally, the warning showed when building the docs, and raised my attention that the API documentation is actually missing from this page: https://sphinx-autoapi.readthedocs.io/en/latest/reference/templates.html So, you see how useful this warning feature is :-) |
Observed behavior
In an rst file with content like:
Where
example
is an existing python module inautoapi_dirs
, andtest_example.bar_test
is just something I fabulated,sphinx-build -W -b html
will happily run through with no warnings.The resulting HTML page has an empty section "Non-existing code references", i.e. the broken code import is silently ignored.
Expected behavior
sphinx-autoapi
emits a warning for every unresolvable code import.Steps to reproduce
I have added a self-contained example and the list of installed packages.
I tried with sphinx-autoapi 3.0.0 and sphinx-autoapi 2.0.0, and sphinx 7.2.6.
Would be happy to learn if this is a bug or intended behavior. As this is definitely unwanted in our project, I would like to learn how to add a warning for unresolveable imports.
python-autoapi-example.zip
The text was updated successfully, but these errors were encountered: