'types' package leveraged by MyPy available for robotframework-seleniumlibrary?

I’ve recently started using MyPy for static checking in my Python code. I’ve written a library that imports the WebElement object (for type-checking where it’s used) for one of my methods. My linter (Flake8) and formatter (YAPF) are just fine with things, but MyPy is complaining thusly:

Resources\rf_extensions.py:18: error: Skipping analyzing "SeleniumLibrary": module is installed, but missing library stubs or py.typed marker
Resources\rf_extensions.py:18: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)

So - I was wondering if there’s a types package for the RF Selenium Library? There exists one for types-selenium, but installing that doesn’t resolve the error. Obviously, this doesn’t break my code, but I’m trying to use better code hygiene.

No one doesn’t exists, although SeleniumLibrary has type definitions in methods, at least in all the public ones. But adding support is pretty easy, you could raise an issue to SL issue tracker. Even better if you can provide PR to fix the issue.

2 Likes