lxml-stubs
Type annotations for the lxml package
What it is and what it does
lxml-stubs is a package of external type annotations for lxml, the popular XML and HTML processing library. It allows developers using mypy or other PEP 484-compatible type checkers to catch type errors in code that uses lxml. The stubs were originally part of typeshed but were extracted into a separate repository because lxml's annotations are still incomplete and the maintainers wanted to avoid false positives from partial annotations.
The package installs as a wheel with no runtime dependencies and integrates automatically with mypy. However, the repository is now archived and abandoned, with the last commit on 2026-05-13 and no releases for 947 days. This means type annotations may not reflect recent changes to lxml itself, and gaps in coverage are unlikely to be filled.
Use it for:
- Enable mypy type checking on projects that depend on lxml for XML/HTML parsing
- Catch type errors in lxml API calls during development rather than at runtime
- Integrate lxml into a fully typed codebase without treating it as untyped
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides type annotations for the lxml package to enable static type checking with mypy and other type checkers.
Yes, if you are actively using mypy with lxml and can tolerate incomplete type coverage and no ongoing maintenance. The permissive license and zero runtime dependencies make installation safe. However, be aware that the abandoned status means type annotations will not be updated for new lxml features or API changes.
Install
lxml-stubs on PyPI
pip
pip install lxml-stubsuv
uv add lxml-stubspoetry
poetry add lxml-stubsInstalling lxml-stubs
Before you install
Low install friction with no runtime dependencies. However, the repository is archived and abandoned as of the last commit on 2026-05-13, with no releases for 947 days.
License in practice
Licensed under Apache Software License (permissive), allowing use in commercial and private projects with minimal restrictions.
Quickstart
pip install lxml-stubs
Then mypy will automatically use the type annotations when checking code that imports lxml.
Verify before relying
- Current completeness of type annotations relative to lxml's full API surface
- Compatibility with recent lxml versions and mypy releases
- Whether the abandoned status affects ongoing type stub maintenance
Package facts
| License | not declared (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 947 days since the last release |
| Last repo commit | (repository archived) |
| First released | |
| Downloads | 4,546,897/month — #2,283 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: lxml_stubs-0.5.1-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
types-lxmlProvides complete external type annotations for…
permissive · top 5,000 on PyPI
sqlalchemy2-stubsProvides PEP-484 typing stubs for SQLAlchemy…
permissive · top 5,000 on PyPI
django-filter-stubsProvides PEP-484 type stubs for django-filter…
permissive · top 15,000 on PyPI
types-networkxProvides type stubs for networkx to enable…
permissive · top 5,000 on PyPI
types-FlaskProvides PEP 561 type stubs for Flask to enable…
permissive · top 5,000 on PyPI
types-attrsProvides PEP 561 type stubs for the attrs…
permissive · top 15,000 on PyPI
pyspark-stubsProvides type stubs for PySpark to enable…
permissive · top 15,000 on PyPI
types-beautifulsoup4Provides type hints for beautifulsoup4 code via…
permissive · top 5,000 on PyPI
types-MarkupSafeProvides type stubs for MarkupSafe, enabling…
permissive · top 5,000 on PyPI
dargsValidates, normalizes, and documents structured…
copyleft · top 15,000 on PyPI