Beta Version of Type Hint Auto completion is available from pyVmomi 188.8.131.52.
Type hints are introduced in Python 3.5 via PEP 484, which allows to check Python code for type conflicts before execution. Popular Integrated Development Environments (IDE) leverages this for the code auto completion.
We are happy to announce pyVmomi 184.108.40.206 supports type hints auto completion. They can speed up your coding process by providing better auto-complete suggestions, and they can catch errors before your code even runs.
Below example demonstrates the pyVmomi auto completion feature usage in building complex VirtualMachineCloneSpec and VirtualMachineRelocateSpec constructs for a cloneVM() Task. For this example we used Visual Studio(VS) Code IDE .
The type hint supports are also dependent on the IDE specific constructs. We recommend to read your IDE documentation to fully utilise this feature.
In conclusion, type hints are a powerful tool for Python programmers. So next time you’re writing code using pyVmomi, consider using type hints to make your life easier. It will definitely help in speeding up vSphere automation tasks. Also, it could avoid frequent referencing of API documentation guides in application development.
Note: We are releasing this beta version in order to gather feedback from our users and it will improve over new releases. We encourage users to test this feature in your favourite IDEs and report any bugs or issues they encounter.
Credits to our Cloud Infrastructure BU Software Engineers – Daniel Draganov, Kamen Mazdrashki and Stefan Hristov for providing this great capability.