-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
390e788
commit 13895ee
Showing
1 changed file
with
25 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,30 @@ | ||
cssselect2: CSS selectors for Python ElementTree | ||
================================================ | ||
cssselect2: unmaintained and incomplete experiments with CSS selectors for Python | ||
================================================================================= | ||
|
||
cssselect2 is a straightforward implementation of `CSS3 Selectors`_ for | ||
`ElementTree`_-compatible documents (including cElementTree, lxml_, etc.) | ||
Unlike cssselect_, it does not translate selectors to XPath_ | ||
and therefore does not have all the correctness corner cases | ||
that are hard or impossible to fix in cssselect. | ||
`cssselect`_ implements `CSS Selectors`_ by converting them to XPath_, | ||
and then relying on lxml_’s XPath implementation. | ||
|
||
.. _ElementTree: http://docs.python.org/3/library/xml.etree.elementtree.html | ||
.. _CSS3 Selectors: http://www.w3.org/TR/2011/REC-css3-selectors-20110929/ | ||
.. _lxml: http://lxml.de/ | ||
.. _cssselect: http://packages.python.org/cssselect/ | ||
.. _XPath: http://www.w3.org/TR/xpath/ | ||
At first, converting simple selectors seems easy enough. | ||
But the two languages are different enough that I’m not even convinced that | ||
some more complex selectors even have a correct translation. | ||
See `issue 12`_ for an example. | ||
|
||
As such, I believe the XPath approach is fundamentally flawed. | ||
So I started in this repository to implement Selectors without XPath, | ||
by traversing a document tree directly. | ||
It mostly works, but I got stuck on `deciding what kind of tree to support`_. | ||
|
||
Since then, I’ve moved on to other things and I’m not very interested in pushing this further. | ||
Please consider this project abandonned. | ||
I will not publish it on PyPI or accept contributions. | ||
|
||
Quick facts: | ||
Feel free to use the code per the license if you find it useful. | ||
If you make a proper library out of it I’m willing to give away the `cssselect2` name on PyPI | ||
(file an issue on this repository to let me know). | ||
|
||
* Free software: BSD licensed | ||
* Compatible with Python 2.6+ and 3.2+ | ||
* Source, issues and pull requests `on Github | ||
<https://github.com/SimonSapin/cssselect2/>`_ | ||
* Releases `on PyPI <http://pypi.python.org/pypi/cssselect2>`_ | ||
* Install with ``pip install cssselect2`` | ||
.. _cssselect: https://github.com/scrapy/cssselect | ||
.. _CSS Selectors: https://drafts.csswg.org/selectors/ | ||
.. _XPath: http://www.w3.org/TR/xpath/ | ||
.. _lxml: http://lxml.de/ | ||
.. _issue 12: https://github.com/scrapy/cssselect/issues/12 | ||
.. _deciding what kind of tree to support: https://github.com/SimonSapin/cssselect2/issues/1 |