I have a Raspberry Pi project written in Python that uses RPi.GPIO module. All the work on the code is done on a Windows box where RPi.GPIO will not install and every time I
Just a few minutes ago I've found another solution: Do not place "import RPi.GPIO" at the beginning of the file. Place it inside the function / method (maybe not a good style). So sphinx will not see it and a documentation will be build.
But the solution with mocking is better, here is a link: http://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#confval-autodoc_mock_imports
Just add the following line to conf.py (RPi and serial are examples):
autodoc_mock_imports = ["RPi", 'serial']