Skip to content
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

pyvmomi==8.0.3.0.1 errors with mypy #1080

Open
sodul opened this issue Jun 27, 2024 · 2 comments
Open

pyvmomi==8.0.3.0.1 errors with mypy #1080

sodul opened this issue Jun 27, 2024 · 2 comments
Labels

Comments

@sodul
Copy link

sodul commented Jun 27, 2024

Describe the bug

Run mypy on code using pyvmomi, mypy will throw an error:

AssertionError: Cannot find component 'ByTime' for 'pyVmomi.vim.event.EventFilterSpec.ByTime'

Reproduction steps

pip install pyvmomi==8.0.3.0.1 types-pyvmomi==8.0.0.6 mypy==1.10.1

Call mypy on code using pyvmomi:
mypy

To fix:
pip install pyvmomi==8.0.2.0.1

Expected behavior

No errors.

Additional context

Relates to #862 and #1048.

@sodul sodul added the bug label Jun 27, 2024
@phagara
Copy link

phagara commented Jun 27, 2024

another incorrect typing stub:

$ cat foo.py
from pyVmomi import vim
print(vim.TaskInfo.State.success)

$ python3 foo.py
success

$ mypy foo.py
foo.py:2: error: Module has no attribute "State"  [attr-defined]
    print(vim.TaskInfo.State.success)
          ^~~~~~~~~~~~~~~~~~
Found 1 error in 1 file (checked 1 source file)

@IvarVirusiim
Copy link

Some more issues:

vm: vim.VirtualMachine
vm.runtime.powerState

error: RuntimeInfo? has no attribute "powerState"  

Something relating to ManagedEntity, because many objects get error for accessing name:

Datastore? has no attribute "name" 
Network? has no attribute "name" 
ManagedEntity? has no attribute "name" 

More examples:

TaskInfo? has no attribute "state" 
TaskInfo? has no attribute "result"
DatastoreBrowser? has no attribute "SearchDatastore_Task"  
VirtualDevice? has no attribute "connectable" 
VirtualDevice? has no attribute "uptCompatibilityEnabled" 
VirtualDevice? has no attribute "backing" 
VirtualHardware? has no attribute "device"

There seems to be an issue with the underlying generation issue. Those are some of the few examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants