Open miohtama opened 2 years ago
This is working as expected, the Hexstr is not a class, but a new type instance that makes a restriction in strings. https://docs.python.org/3/library/typing.html#newtype
The one thing that does seem strange is a superfluous () after new type.
Can I somehow instruct sphinx-autodoc-typehints
not to expand new type instances, because in my particular case it reduced the readability of the documentation?
No, that would be contrary to the current design philosophy. The same way type aliases are extended this is too. One could add a flag for this but adding such feature might be quite involved PR, you're free to try to create that.
Thank you so much @gaborbernat - I am choosing not to fight on this hill for now.
I'll keep this issue open to remove the extra ()
after the NewType.
I am maintaining some Python API documentation for Ethereum and Web3.py ecosystem.
To improve the readability of the API documentation, I stumbled upon on your very useful
sphinx-autodoc-typehints
plugin. IMHO I feel this should be a core feature for apidocs.I am generating some docs on Python 3.9 that use "custom" types. However, an unnecessary
NewType()
appears in the generated doc output. This comes form the custom types defined in eth-typing modules.Any way to suppress this or hack around this?
Here is the function signature.:
Here is the example output: