Closed toaster-robotics closed 5 months ago
I did some further digging and it seems there already is a stub file containing write_bitmap. It's under stubs/scalar_rgb_util.pyi. So maybe vscode doesn't know to look there when I retarget mitsuba to scalar_rgb?
Hello @toaster-robotics,
I believe that the generated stubs will be much more complete in the next major version, with the transition to nanobind.
From my experience, at the first formatting/syntax issue in any stub .pyi
file the IDE's auto-completion system (ex: pyright
) will halt. Well let's just fix the stub?! The issue is that we hand crafted a script to build these stub files because of the thousands of types and classes that Mitsuba contains. We've ran into many, many, many cases were we would produce some illegal syntax, I'm not surprised that some still exist. In short, although every symbol is declared in the stubs files, some are not picked up because of some error earlier in the parsing.
We are transitioning to nanobinds
's stub generation tool which will be much more robust.
Summary
Many functions/properties are not available for autocomplete on vscode.
System configuration
vscode/pylance
Description
Many functions/properties are not available for autocomplete on vscode. For example, the function mitsuba.util.write_bitmap does not autocomplete and has no type hints. This is the same problem that pybullet has (issue link). They resolved it by generating a stub file and having that in their working directory. I attempted to generate a stub file using mypy (stub-gen) however it fails because the mitsuba variant has to be declared. I'm guess the retargetable aspect of mitsuba is the reason why some of the autocomplete doesn't work. It would be great to have this ability for the entire library. It helps a lot with coding. Otherwise there's a lot of looking up old code or searching the documents.
Below shows write_bitmap in white text, unlike render which is in yellow. This indicates an unknown function.
Steps to reproduce
type out mitsuba.util.write_bitmap and try and get a type hint