-
Notifications
You must be signed in to change notification settings - Fork 1
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
Sphinx/autodoc reports metaclass conflict #11
Comments
Thanks for raising this! Obviously, I saw something (superficially) similar that came up during my attempt to port |
|
@posita I think I've found something interesting, if I fire up a normal Python REPL in my project, I can do this as expected: >>> from numerary import RealLike
>>> isinstance(RealLike, type)
True But if I put in a (Pdb) from numerary import RealLike
(Pdb) isinstance(RealLike, type)
False I have no idea why yet, but it seems highly relevant ... 🤔 Edit: also this: Normal REPL>>> type(RealLike)
<class 'numerary.types.CachingProtocolMeta'> At breakpoint(Pdb) type(RealLike)
<class 'numerary.RealLike'> |
Thanks! I did take a look at this and was equally stupefied. Rest assured I haven't forgotten about you! I'm working with the beartype project on some mods to the underlying protocol that may help with this. (Please! I hope! 🤞😖) I'm also hoping to make resolving #10 more straightforward. Apologies for the apparent lack of progress on this. Still digging in! |
@posita No worries, take your time 👍 |
I think I found the issue! The (good?) news is that it wasn't what I thought it was, so thanks for the nudge! For some reason, at some point, your Sphinx build process invokes something that ends up with if TYPE_CHECKING:
# Warning: Deep typing voodoo ahead. See
# <https://github.com/python/mypy/issues/11614>.
from abc import ABCMeta as _ProtocolMeta # <-- this is a lie that is only there for type-checking; it should never be executed at runtime
else:
_ProtocolMeta = type(Protocol) I discovered this by adding the following lines to if not issubclass(CachingProtocolMeta, (type(_SupportsAbs), type(Protocol))):
breakpoint() Once that triggered, it allowed me to inspect
Yikes. 😬 The documentation for
So I'm pretty sure this is on % find ~/.virtualenvs/phantom-types/lib/python3.9/site-packages -type f -print0 | xargs -0 grep -E 'TYPE_CHECKING.*=.*True'
…/.virtualenvs/phantom-types/lib/python3.9/site-packages/sphinx_autodoc_typehints.py: typing.TYPE_CHECKING = True Yowza. 🤯 (As an aside, some of these are cringe worthy.) I updated my clone of your repo via
Are you able to upgrade? If so, can you verify on your end? |
Oh jeez, that's some exceptional digging! 🤯 I'll look into upgrading the docs dependencies. Beers are on me if you're ever in Gothenburg, Sweden! |
It looks like this solved the whole thing, docs built fine on |
Hi again 👋
When adding numerary to phantom-types I forgot to update the dependencies of the docs build, which left two sections empty 😬 I'll need to work on the CI so that it blows up earlier for that, and obviously fix the missing imports.
However, as I'm trying to reproduce this failure locally (was a silent warning in CI), I get the traceback below. It seems to indicate that numerary has a metaclass conflict, which confuses me profoundly since both your and my test suites are passing. It's also not reproduced when I in the same environment fire up a REPL and do
from phantom.sized import *
.It seems very likely that isn't really an issue with numerary but rather with my sphinx/autodoc setup, but I it seemed worth reaching out here in case someone has ran into similar issues. Feel free to instantly close this though as I doubt it's actionable within numerary.
The text was updated successfully, but these errors were encountered: