Closed dvicini closed 3 months ago
On Python <3.11 you need typing_extension
. The @overload
implementation is, e.g., not good enough to generate documentation via nanobind's stubgen. Basically the auto-generated documentation will lack all the overload documentation for pure Python functions using this decorator. Note that for things that are feature-complete in typing
, the typing_extension
package just forwards.
I do see how it could be inconvenient though, and building the documentation is probably something that's more important for ReadTheDocs etc. We could fail over from typing_extension
to typing
if the former is not found. (So a bidirectional failover :D, since the extension is already a polyfill)
That makes sense, I see now why it didn't work before: I already had the typing_extensions
package installed, but it turns out that older versions of that package do not have the forwards you are referring to.
I updated the package and now it works.
Hi,
I was curious to run the nanobind branch of Mitsuba to check if a bug I was going to report was already fixed there. On the way, I found this minor issue:
The support for Python < 3.11 seems to be broken. Dr.Jit's
__init__py
tries to import a few types from thetyping_extension
module (e.g., Optional). But it seems that those should be imported from the typing package instead. That's easy to fix, but it seems that the issue also occurs deeper down in nanobind's stubgen.Sorry that I am a bit lazy here and don't just submit a fix PR - I don't really need Python 3.10 support myself, this was something I found by accident.