Skip to content

2024.08.07

Latest
Compare
Choose a tag to compare
@github-actions github-actions released this 07 Aug 08:04
· 1 commit to main since this release
2024.08.07
9187118

Breaking changes

  • Multiple builds available, with the alternative build enhancing multiple XML subclassing scenario. See relevant README section for detail. Thanks to @scanny for the driving force behind #51.
  • Mypy 1.11 required, which introduced backward incompatible @typing.overload changes.
  • lxml.html.clean stub depreated, lxml 5.2.0 completely removes the submodule due to multiple security issues. Corresponding code and type definitions are split into a new independent repo.

Features

  • (#56) Replace typing.TypeGuard with typing.TypeIs
  • Use callback protocol for more precise element and ElementMaker factory function typing
  • lxml.etree.ICONV_COMPILED_VERSION exported since 5.2.2
  • Special handling for ObjectifiedElement and HTMLElement in lxml.cssselect.CSSSelector and various cssselect() methods
  • html.builder shorthands return more precise element type for certain HTML elements. For example, html.builder.LABEL(), corresponding to <LABEL> tag, yields LabelElement.
  • More precise etree.Extension() annotation depending on supplied namespace
  • Stricter namespace argument type in _Element ElementPath methods
  • For lxml.builder.ElementMaker class:
    • Provide better hint in __call__() argument
    • Accepts namespace tuple in nsmap argument
    • Export private properties
  • For lxml.sax module:
    • Export private properties in various classes
    • Explicitly list all inherited methods in ElementTreeContentHandler class, as method arguments names are different from superclass ones
  • Alert etree.HTMLParser users to remove deprecated strip_cdata argument

Bug fix and small changes

  • Some _Element related input arguments fixed to use typing.Sequence instead of Interable, as _Element is already an Iterable itself. Supplying _Element where a proper Iterable is expected would cause problem.
  • Similar situation arises for str or byte in tag selector argument; use typing.Collection to alert user more clearly.
  • None can't be used as etree.strip_*() argument
  • Some etree.DocInfo read-only properties can't be None
  • Fix etree.Resolver method return types
  • Avoid exception raising arg combinations in html.html5parser.HTMLParser

Internal changes

  • The usual static stub to runtime test migration:
    • Part of basic _Element tests and its find*() methods
    • More extensive _Attrib tests
  • Use ruff to replace black and isort as code formatter
  • Migrate stub tests to support pytest-mypy-plugins ⩾ 2.0
  • Use pdm-backend as build backend due to its more versatile versioning support