Closed askpatrickw closed 2 years ago
If I remove__all__
from the adafruit_azureiot/__init__.py
, the docs build fine.
__all__ = ["IoTHubDevice", "IoTCentralDevice", "IoTResponse", "IoTError"]
It also builds if I change __all__
to use the full dot notation.
__all__ = [
"adafruit_azureiot.IoTCentralDevice",
"adafruit_azureiot.IoTHubDevice",
"adafruit_azureiotIoTResponse",
"adafruit_azureiot.IoTError",
]
But then pre-commit is angry.
************* Module adafruit_azureiot
adafruit_azureiot/__init__.py:43:4: E0603: Undefined variable name 'adafruit_azureiot.IoTCentralDevice' in __all__ (undefined-all-variable)
adafruit_azureiot/__init__.py:44:4: E0603: Undefined variable name 'adafruit_azureiot.IoTHubDevice' in __all__ (undefined-all-variable)
adafruit_azureiot/__init__.py:45:4: E0603: Undefined variable name 'adafruit_azureiotIoTResponse' in __all__ (undefined-all-variable)
adafruit_azureiot/__init__.py:46:4: E0603: Undefined variable name 'adafruit_azureiot.IoTError' in __all__ (undefined-all-variable)
One final comment....
I also tried removing the __ALL__
and using automodule
entries in api.rst
for each module and then I got back to the same error as the beginning.
This leads me to believe there's something wrong with the docstrings.
I worked around this by rolling Sphinx back to 4.3.2 in my branch. I opened a bug in the Sphinx repo https://github.com/sphinx-doc/sphinx/issues/10133
I think the logging
type provided here:
https://github.com/adafruit/Adafruit_CircuitPython_AzureIoT/blob/fe80aad45d74881cd26ece5ef0bd74dc78eeaaaf/adafruit_azureiot/iotcentral_device.py#L91
are potentially leading to this issue. I noticed that I can build the docs successfully on sphinx 4.4.0 if I remove those type hints.
I think maybe those types should be Logger
but it may be complicated a bit by the fact that adafruit_logging
library is not published to PyPi, so the actions container is not going to be able to download it using the normal method atm.
As a short term fix I think it may be easiest to remove the type hint from those arguments for now. I think the actions container is going to need access to adafruit_logging
library in order to fill in any sort of meaningful typing info from it and we'll need to get that published to PyPi in order for that to happen as far as I konw.
To test this theory I manually copied adafruit_logging
to my site-packages
directory and after doing that I am able to get a successful sphinx build on 4.4.0 also if I add this import:
from adafruit_logging import Logger
and change the type hint to be like this:
logger: Logger = None,
I'll modify the logging in my PR as suggested. Thanks @FoamyGuy!
Thanks @FoamyGuy that seems to have done the trick. They're also fixing this in Sphinx as well, the explanation was interesting.
This happen on main as well as in my PR branch.
sphinx.errors.SphinxWarning: error while formatting arguments for adafruit_azureiot.IoTCentralDevice: can only concatenate str (not "__qualname__") to str
No idea... searching the internet was no help.
verbose