Type annotations for lxml striving for completeness
Project description
This repository contains external type annotations for lxml
. It can be used by type-checking tools (currently supporting mypy
and pyright
) to check code that uses lxml
, or used within IDEs like VSCode or PyCharm to facilitate development.
Improvements
There are lots of enhancements on top of lxml-stubs:
- Main goal ① Completes annotation for at least 90% of publicly used
lxml
API. Besides various completed classes and methods, here are currently implemented extra submodules:-
lxml.builder
-
lxml.html.builder
-
lxml.html.clean
-
lxml.html.html5parser
-
lxml.html.soupparser
-
lxml.sax
- Check out project page for future plans and progress
-
- Main goal ② All existing contributions reviewed thoroughly, bringing coherency of annotation across the whole package
- Guarantees error free for
pyright
basic checking mode as well - Much more extensive test cases
- Guarantees error free for
- Modernize package building infrastructure
Installation
From PyPI
This is the normal choice for most people:
pip install -U types-lxml
If there is plan to use html submodule for external libraries (mainly lxml.html.html5parser
and lxml.html.soupparser
), please install extra
dependencies instead:
pip install -U types-lxml[extra]
From downloaded wheel file
Head over to latest release in GitHub and download wheel file (with extension .whl
), which can be installed in the same way as PyPI package:
pip install -U types-lxml*.whl
Bleeding edge from GitHub
pip install -U git+https://github.com/abelcheung/types-lxml.git
Special notes
There are two special stub-only classes that do not exist as concrete class in lxml
:
lxml.etree.ParserTarget
lxml.etree.SmartStr
They are intended as helpers when writing code, wrapped under
if TYPE_CHECKING: ...
. Please consult their docstring in stub files for detail,
or if you are using IDEs, the docstring might have been formatted nicely for reference.
History
Type annotations for lxml
were initially included in typeshed, but as it was still incomplete, it was decided to be ripped out as a separate project.
The code was extracted by Jelle Zijlstra and moved to lxml-stubs
repository using git filter-branch
.
types-lxml
is a fork of lxml-stubs
that strives for completeness, so that most people would at least find it usable; while the the original lxml-stubs
aims to be stable.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for types_lxml-2023.2.11-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89a8a7c7540f0ac87354f510c80b1a3bf853ec403c96b7999e01ee9cd1a642fe |
|
MD5 | 1a6c28ec57ec5d94866eb2319a173d75 |
|
BLAKE2b-256 | f02922c5aded4b127c7665823ad334528d975324dfd122a29d830373d2c718e4 |