Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No library stub file for module lxml.html in python

Tags:

python

Upon adding this line import lxml.html vim displays No library stub file for module lxml.html.

What does it mean?

like image 457
jjk Avatar asked Feb 25 '26 07:02

jjk


2 Answers

Mypy makes use of a package called TypeShed. Typeshed contains type stubs for the python standard library and a few third party packages. lxml isn't represented there. So the type checker doesn't know about the types within lxml.

Stubs are explained here: https://github.com/python/mypy/wiki/Creating-Stubs-For-Python-Modules

like image 74
Sheena Avatar answered Feb 26 '26 20:02

Sheena


The stub file for lxml.html was not available until version 0.2.0 (released in May 2021). You can just pip install lxml-stubs --upgrade.

like image 36
Nuno André Avatar answered Feb 26 '26 19:02

Nuno André