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
Can python.apigen
be used for documenting global variables?
#294
Comments
I think this is not currently supported by Sphinx: The best solution would be to fix upstream in Sphinx. I'm not sure what workarounds might be possible. |
In the past, I've used autodoc's .. autodata:: my_module.GLOBAL_MEMBER I've never tried documenting a |
The way I accomplished this in one of my libraries is the following. The resulting webpage: The variable declaraition: |
Thanks very much for trying to help! I like @mhostetter solution the most, but I still cannot make it work :( Can you please take a look at my setup to check what I'm missing? Here are the key parts of my project:
"""Defines some custom type annotations."""
from typing import TypeAlias
from nptyping import Float64, NDArray, Shape
# noinspection PyUnresolvedReferences
NDSquareMatrix: TypeAlias = NDArray[Shape["Size, Size"], Float64] # noqa: F821
"""Shorthand annotation for NumPy square matrix of floats.
Group
-----
Types
""" But when I try to build the doc, I'm getting the following error:
Am I doing something wrong, or it is a bug? Thanks! |
Actually, I've given up on introducing these type aliases anyway, so my problem (at this moment) went away. Feel free to close this one. I'm leaving it open only because it describes a potential bug. Thanks for trying to help! |
If it is a bug, it isn't specific to this theme, rather Sphinx itself. |
@2bndy5 not sure how you've concluded that having in mind that the error arises in the extension of this theme:
But anyway, it's your call... |
There is a limitation in the built-in autodoc extension that our apigen extension depends on. However, the fact that our extension raises an exception is a bug that we should address. Can you provide a minimal complete self-contained example that reproduces the exception issue? |
@jbms Sure, will do tomorrow (not close to a comp now...) |
@jbms As promised, here's a minimal project that reproduces the error: https://github.com/peske/sphinx-immaterial-bug |
First, thanks for the great work!
Here's the example of a variable (type annotation) that I would like to document:
Is this possible to accomplish in any way? Directly, or some workaround... Any help will be appreciated!
The text was updated successfully, but these errors were encountered: