Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release notes for 1.2.0 #131

Merged
merged 6 commits into from Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -195,7 +195,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 @@ -204,7 +204,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 @@ -235,7 +235,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