sphinx autodoc_mock_import type errors

101 views Asked by At

I'm attempting to document my code with sphinx autodoc but have run into problems with properties imported from external projects.

For example, this python script:

import myexternal

var = 5.0 * myexternal.constant
print(var)

imports an external package and attempts to use an internally defined constant. To account for the package in autodoc I added this line to my sphinx conf file:

autodoc_mock_imports = ['myexternal']

When I build sphinx I get a TypeError:

TypeError: unsupported operand type(s) for *: 'float' and 'constant'

Is there a way to setup the conf file to define 'constant' as type float? or ignore TypeErrors related to mocked packages?

0

There are 0 answers