cssselect
cssselect parses CSS3 Selectors and translates them to XPath 1.0
Install
cssselect on PyPI
pip
pip install cssselectuv
uv add cssselectpoetry
poetry add cssselectPackage facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 17 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: cssselect-1.5.0-py3-none-any.whl
About cssselect
from the package's own PyPI description — quoted content, verbatim
=================================== cssselect: CSS Selectors for Python ===================================
.. image:: https://img.shields.io/pypi/v/cssselect.svg :target: https://pypi.python.org/pypi/cssselect :alt: PyPI Version
.. image:: https://img.shields.io/pypi/pyversions/cssselect.svg :target: https://pypi.python.org/pypi/cssselect :alt: Supported Python Versions
.. image:: https://github.com/scrapy/cssselect/actions/workflows/tests-ubuntu.yml/badge.svg :target: https://github.com/scrapy/cssselect/actions/workflows/tests-ubuntu.yml :alt: Tests
.. image:: https://img.shields.io/codecov/c/github/scrapy/cssselect/master.svg :target: https://codecov.io/github/scrapy/cssselect?branch=master :alt: Coverage report
cssselect is a BSD-licensed Python library to parse CSS3 selectors and
translate them to XPath 1.0 expressions.
XPath 1.0 expressions can be used in lxml or another XPath engine to find
the matching elements in an XML or HTML document.
Find the cssselect online documentation at https://cssselect.readthedocs.io.
Quick facts:
- Source, issues and pull requests
on GitHub <https://github.com/scrapy/cssselect>_ - Releases...
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
cssselect parses CSS3 selectors and translates them to XPath 1.0 expressions, enabling you to find matching elements in XML or HTML documents using familiar CSS selector syntax.
Installs cleanly with no runtime dependencies. Actively maintained with a recent release (17 days ago) and steady development on GitHub.
BSD-3-Clause is permissive and imposes minimal restrictions; you may use, modify, and distribute cssselect freely in commercial or private projects provided you retain the license notice.
Usage
pip install cssselect
from cssselect import GenericTranslator
translator = GenericTranslator()
xpath = translator.css_to_xpath('div.content > p')
print(xpath)
Requires Python 3.10 or later.
Verdict: cssselect is a lightweight, well-maintained library with zero dependencies and no known vulnerabilities. Its permissive BSD-3-Clause license and active development make it a reliable choice for converting CSS selectors to XPath in web scraping or XML processing workflows.
Needs verification
- Whether the package is actively used in production by the Scrapy project or other major dependents.
- Performance characteristics when handling large or complex CSS selector expressions.
Similar packages
permissive · top 1,000 on PyPI
Protegopermissive · top 1,000 on PyPI
rdflibpermissive · top 1,000 on PyPI
soupsievepermissive · top 100 on PyPI
et-xmlfilepermissive · top 1,000 on PyPI
lxmlpermissive · top 1,000 on PyPI
xmltodictpermissive · top 1,000 on PyPI
jsonpath-pythonpermissive · top 1,000 on PyPI
boolean.pypermissive · top 1,000 on PyPI
isodurationpermissive · top 1,000 on PyPI