cssselect2
CSS selectors for Python ElementTree
Install
cssselect2 on PyPI
pip
pip install cssselect2uv
uv add cssselect2poetry
poetry add cssselect2Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — tinycss2, webencodings |
| Maintenance | aging — 182 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: cssselect2-0.9.0-py3-none-any.whl
Keywords: css, elementtree
About cssselect2
from the package's own PyPI description — quoted content, verbatim
cssselect2 is a straightforward implementation of CSS4 Selectors for markup documents (HTML, XML, etc.) that can be read by ElementTree-like parsers (including cElementTree, lxml, html5lib, etc.)
- Free software: BSD license
- For Python 3.10+, tested on CPython and PyPy
- Documentation: https://doc.courtbouillon.org/cssselect2
- Changelog: https://github.com/Kozea/cssselect2/releases
- Code, issues, tests: https://github.com/Kozea/cssselect2
- Code of conduct: https://www.courtbouillon.org/code-of-conduct.html
- Professional support: https://www.courtbouillon.org
- Donation: https://opencollective.com/courtbouillon
cssselect2 has been created and developed by Kozea (https://kozea.fr/). Professional support, maintenance and community management is provided by CourtBouillon (https://www.courtbouillon.org/).
Copyrights are retained by their contributors, no copyright assignment is required to contribute to cssselect2. Unless explicitly stated otherwise, any contribution intentionally submitted for inclusion is licensed under the BSD 3-clause license, without any additional terms or conditions. For full authorship information, see the version control history.
Read as markdown · JSON record · Source repository · Homepage · Docs
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
cssselect2 parses and matches CSS4 selectors against markup documents (HTML, XML) using ElementTree-like parsers, enabling programmatic element selection and styling queries.
Low friction: pure Python wheel with only two lightweight runtime dependencies (tinycss2, webencodings). Maintenance is aging—last release 182 days ago—but the repository remains active and the package is marked Production/Stable.
Permissive BSD license allows commercial and private use with minimal restrictions; contributions are accepted under the same BSD 3-clause terms without assignment.
Usage
pip install cssselect2
import cssselect2
from xml.etree import ElementTree as ET
tree = ET.parse('doc.xml')
matcher = cssselect2.compile_selector_list('div.class')
for el in matcher.match(tree.getroot()):
print(el)
Requires Python 3.10 or later; ElementTree-compatible parser (stdlib, lxml, html5lib, etc.) needed to provide the document tree.
Verdict: cssselect2 is a stable, low-friction CSS selector library suitable for production use in document processing pipelines. No known vulnerabilities, permissive licensing, and broad Python 3.10+ support make it a straightforward choice; the aging maintenance status (182 days since last release) is typical for a mature, feature-complete tool.
Needs verification
- Whether the 182-day release cadence reflects active maintenance or dormancy relative to the project's scope and user base.
- Performance characteristics and memory footprint when matching large documents or complex selector lists.
Similar packages
permissive · top 1,000 on PyPI
lxmlpermissive · top 1,000 on PyPI
tinycss2permissive · top 1,000 on PyPI
et-xmlfilepermissive · top 1,000 on PyPI
defusedxmlpermissive · top 1,000 on PyPI
tinyhtml5permissive · top 1,000 on PyPI
pydyfpermissive · top 1,000 on PyPI
weasyprintpermissive · top 1,000 on PyPI
pyphencopyleft · top 1,000 on PyPI
docutilsunclear · top 1,000 on PyPI