Skip to content

Commit

Permalink
Merge pull request #131 from scrapy/relnotes-1.2
Browse files Browse the repository at this point in the history
Release notes for 1.2.0
  • Loading branch information
wRAR committed Oct 27, 2022
2 parents 60c6146 + 2c7c1ea commit cfa2959
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "3.11.0-rc.2"]
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
Expand Down
32 changes: 31 additions & 1 deletion CHANGES
@@ -1,13 +1,43 @@
Changelog
=========

Version 1.x.x
Version 1.2.0
-------------

Unreleased.

* Drop support for Python 2.7, 3.4-3.6, add support for Python 3.7-3.11.

* Add type annotations (PEP 484 and PEP 561).

* More features from the CSS Selectors Level 4:

* The ``:is()`` pseudo-class.

* The ``:where()`` pseudo-class.

* The ``:has()`` pseudo-class, with some limitations.

* Fix parsing ``:scope`` after a comma.

* Add parentheses to fix condition precedence in some cases.

* Private API changes related to the removal of the Python 2 support:

* Remove ``_unicode`` and ``_unichr`` aliases from ``csselect.parser``.

* Remove ``_basestring`` and ``_unicode`` aliases from ``csselect.xpath``.

* Deprecate ``csselect.xpath._unicode_safe_getattr()`` and change it to just
call ``getattr()``.

* Include tests in the PyPI tarball.

* Many CI additions and improvements.

* Improve the test coverage.


Version 1.1.0
-------------

Expand Down
2 changes: 1 addition & 1 deletion cssselect/parser.py
Expand Up @@ -519,7 +519,7 @@ def parse(css: str) -> List[Selector]:
you can skip this and use :meth:`~GenericTranslator.css_to_xpath`.
:param css:
A *group of selectors* as an Unicode string.
A *group of selectors* as a string.
:raises:
:class:`SelectorSyntaxError` on invalid selectors.
:returns:
Expand Down
6 changes: 3 additions & 3 deletions cssselect/xpath.py
Expand Up @@ -207,7 +207,7 @@ def css_to_xpath(self, css: str, prefix: str = "descendant-or-self::") -> str:
about "real" elements.
:param css:
A *group of selectors* as an Unicode string.
A *group of selectors* as a string.
:param prefix:
This string is prepended to the XPath expression for each selector.
The default makes selectors scoped to the context node’s subtree.
Expand All @@ -216,7 +216,7 @@ def css_to_xpath(self, css: str, prefix: str = "descendant-or-self::") -> str:
:class:`ExpressionError` on unknown/unsupported selectors,
including pseudo-elements.
:returns:
The equivalent XPath 1.0 expression as an Unicode string.
The equivalent XPath 1.0 expression as a string.
"""
return " | ".join(
Expand Down Expand Up @@ -247,7 +247,7 @@ def selector_to_xpath(
:raises:
:class:`ExpressionError` on unknown/unsupported selectors.
:returns:
The equivalent XPath 1.0 expression as an Unicode string.
The equivalent XPath 1.0 expression as a string.
"""
tree = getattr(selector, "parsed_tree", None)
Expand Down
18 changes: 14 additions & 4 deletions docs/index.rst
Expand Up @@ -99,19 +99,29 @@ These applicable pseudo-classes are not yet implemented:
you specify an element type, but not with ``*``

On the other hand, *cssselect* supports some selectors that are not
in the Level 3 specification:
in the Level 3 specification.

These parts of the Level 4 specification are supported (note that a large part
of the Level 4 additions is not applicable to cssselect similarly to ``:hover``
or not representable in XPath 1.0 so the complete specification is unlikely to
be implemented):

* The ``:scope`` pseudo-class. Limitation: it can only be used at a start of a
selector.
* The ``:is()``, ``:where()`` and ``:has()`` pseudo-classes. Limitation:
``:has()`` cannot contain nested ``:has()`` or ``:not()``.

These are non-standard extensions:

* The ``:contains(text)`` pseudo-class that existed in `an early draft`_
but was then removed.
* The ``!=`` attribute operator. ``[foo!=bar]`` is the same as
``:not([foo=bar])``
``:not([foo=bar])``.
* ``:not()`` accepts a *sequence of simple selectors*, not just single
*simple selector*. For example, ``:not(a.important[rel])`` is allowed,
even though the negation contains 3 *simple selectors*.
* ``:scope`` allows to access immediate children of a selector: ``product.css(':scope > div::text')``, simillar to XPath ``child::div``. Must be used at the start of a selector. Simplified version of `level 4 reference`_.

.. _an early draft: http://www.w3.org/TR/2001/CR-css3-selectors-20011113/#content-selectors
.. _level 4 reference: https://developer.mozilla.org/en-US/docs/Web/CSS/:scope

..
The following claim was copied from lxml:
Expand Down

0 comments on commit cfa2959

Please sign in to comment.