lxml
Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API.
Install
lxml on PyPI
pip
pip install lxmluv
uv add lxmlpoetry
poetry add lxmlPackage facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 87 days since the last release |
| Last repo commit | |
| First released | |
| Popularity | one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-13) |
Evidence: lxml-6.1.1-cp310-cp310-macosx_10_9_universal2.whl; lxml-6.1.1-cp310-cp310-macosx_10_9_x86_64.whl; lxml-6.1.1-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; lxml-6.1.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; lxml-6.1.1-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; lxml-6.1.1-cp310-cp310-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl; lxml-6.1.1-cp310-cp310-manylinux_2_28_i686.whl; lxml-6.1.1-cp310-cp310-manylinux_2_31_armv7l.whl; lxml-6.1.1-cp310-cp310-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl; lxml-6.1.1-cp310-cp310-musllinux_1_2_aarch64.whl; lxml-6.1.1-cp310-cp310-musllinux_1_2_armv7l.whl; lxml-6.1.1-cp310-cp310-musllinux_1_2_riscv64.whl; lxml-6.1.1-cp310-cp310-musllinux_1_2_x86_64.whl; lxml-6.1.1-cp310-cp310-win32.whl; lxml-6.1.1-cp310-cp310-win_amd64.whl; lxml-6.1.1-cp310-cp310-win_arm64.whl; lxml-6.1.1-cp311-cp311-macosx_10_9_universal2.whl; lxml-6.1.1-cp311-cp311-macosx_10_9_x86_64.whl; lxml-6.1.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; lxml-6.1.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
About lxml
from the package's own PyPI description — quoted content, verbatim
lxml is a Pythonic, mature binding for the libxml2 and libxslt libraries. It provides safe and convenient access to these libraries using the ElementTree API.
It extends the ElementTree API significantly to offer support for XPath, RelaxNG, XML Schema, XSLT, C14N and much more.
To contact the project, go to the project home page <https://lxml.de/>_
or see our bug tracker at https://launchpad.net/lxml
In case you want to use the current in-development version of lxml, you can get it from the github repository at https://github.com/lxml/lxml . Note that this requires Cython to build the sources, see the build instructions on the project home page.
After an official release of a new stable series, bug fixes may become available at
https://github.com/lxml/lxml/tree/lxml-6.1 .
Running pip install https://github.com/lxml/lxml/archive/refs/heads/lxml-6.1.tar.gz
will install the unreleased branch state as soon as a maintenance branch has been established.
Note that this requires Cython to be installed at an appropriate version for the build.
6.1.1 (2026-05-18)
Bugs fixed
- The known link attributes in
lxml.html.defs.link_attrswere...
Read as markdown · JSON record · Source repository · Homepage
AI interpretation — verify before relying
AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page
lxml is a Pythonic binding for libxml2 and libxslt that provides XML and HTML processing with support for XPath, XSLT, XML Schema, and RelaxNG validation through the ElementTree API.
Medium install friction due to compiled C extensions; wheels are widely available for Python 3.8–3.14 across Linux, macOS, and Windows architectures. The project is actively maintained with a recent release (87 days old) and strong repository signals (3045 stars, last commit 2026-08-13).
BSD-3-Clause permissive license allows commercial and private use with minimal restrictions, requiring only preservation of copyright and license notices in distributions.
Usage
pip install lxml
from lxml import etree
root = etree.fromstring(b'<root><child>text</child></root>')
print(root[0].text)
Requires a C compiler and libxml2/libxslt development headers at build time if installing from source; pre-built wheels eliminate this for most platforms.
Verdict: lxml is a production-stable, actively maintained XML/HTML processing library with broad platform coverage and no known vulnerabilities. Medium install friction is offset by wheel availability and strong maintenance signals. Suitable for production use in XML-heavy applications.
Needs verification
- Whether the xlink:href security fix in 6.1.1 affects existing deployments using lxml.html.defs
- Performance characteristics compared to alternative XML libraries for specific use cases
Similar packages
permissive · top 1,000 on PyPI
defusedxmlpermissive · top 1,000 on PyPI
cssselectpermissive · top 1,000 on PyPI
beautifulsoup4permissive · top 100 on PyPI
et-xmlfilepermissive · top 1,000 on PyPI
MarkupSafepermissive · top 100 on PyPI
zeeppermissive · top 1,000 on PyPI
duckdbpermissive · top 1,000 on PyPI
fonttoolspermissive · top 1,000 on PyPI
jsonpath-pythonpermissive · top 1,000 on PyPI