Skip to content

Commit

Permalink
Release notes for 0.21.0 (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gallaecio authored Aug 27, 2024
1 parent 8c606af commit 7a5f88c
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 3 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@
Changelog
=========

0.21.0 (unreleased)
===================

* The new :func:`~zyte_common_items.processors.images_processor`, used by
default in ``images`` fields, can convert a string, a list of strings or a
list of dicts into an :class:`~zyte_common_items.Image` list. Strings become
:attr:`Image.url <zyte_common_items.Image.url>`. Dicts get their ``url`` key
mapped as :attr:`Image.url <zyte_common_items.Image.url>`.

* :func:`~zyte_common_items.processors.brand_processor` now converts strings
into :class:`~zyte_common_items.Brand` objects with the input string as
:attr:`Brand.name <zyte_common_items.Brand.name>`.

* :func:`~zyte_common_items.processors.price_processor` and
:func:`~zyte_common_items.processors.simple_price_processor` now convert
numeric values into strings with 2 decimal positions.

* :func:`~zyte_common_items.processors.metadata_processor` no longer assumes
that the input metadata is not ``None``.

0.20.0 (2024-06-19)
===================

Expand Down
4 changes: 4 additions & 0 deletions docs/reference/field-processors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ Built-in field processors

.. autofunction:: zyte_common_items.processors.gtin_processor

.. autofunction:: zyte_common_items.processors.images_processor

.. autofunction:: zyte_common_items.processors.metadata_processor

.. autofunction:: zyte_common_items.processors.price_processor

.. autofunction:: zyte_common_items.processors.rating_processor
Expand Down
2 changes: 2 additions & 0 deletions docs/usage/field-processors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Field Default processor
``description`` (excluding articles) :func:`~.description_processor`
``descriptionHtml`` :func:`~.description_html_processor`
``gtin`` :func:`~.gtin_processor`
``images`` :func:`~.images_processor`
``metadata`` :func:`~.metadata_processor`
``price`` :func:`~.price_processor`
``regularPrice`` :func:`~.simple_price_processor`
==================================== ====================================
Expand Down
4 changes: 3 additions & 1 deletion zyte_common_items/pages/article.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from zyte_common_items.components import Audio, Author, Breadcrumb, Image, Video
from zyte_common_items.fields import auto_field
from zyte_common_items.items import Article, ArticleMetadata
from zyte_common_items.processors import breadcrumbs_processor
from zyte_common_items.processors import breadcrumbs_processor, images_processor

from .base import BasePage, Page
from .mixins import HasMetadata
Expand All @@ -17,13 +17,15 @@ class BaseArticlePage(BasePage, Returns[Article], HasMetadata[ArticleMetadata]):

class Processors(BasePage.Processors):
breadcrumbs = [breadcrumbs_processor]
images = [images_processor]


class ArticlePage(Page, Returns[Article], HasMetadata[ArticleMetadata]):
""":class:`Page` subclass for :class:`Article`."""

class Processors(Page.Processors):
breadcrumbs = [breadcrumbs_processor]
images = [images_processor]


@attrs.define
Expand Down
8 changes: 7 additions & 1 deletion zyte_common_items/pages/business_place.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
)
from zyte_common_items.fields import auto_field
from zyte_common_items.items import BusinessPlace, BusinessPlaceMetadata
from zyte_common_items.processors import description_processor, rating_processor
from zyte_common_items.processors import (
description_processor,
images_processor,
rating_processor,
)

from .base import BasePage, Page
from .mixins import HasMetadata
Expand All @@ -30,6 +34,7 @@ class BaseBusinessPlacePage(
class Processors(BasePage.Processors):
aggregateRating = [rating_processor]
description = [description_processor]
images = [images_processor]


class BusinessPlacePage(
Expand All @@ -40,6 +45,7 @@ class BusinessPlacePage(
class Processors(Page.Processors):
aggregateRating = [rating_processor]
description = [description_processor]
images = [images_processor]


@attrs.define
Expand Down
4 changes: 3 additions & 1 deletion zyte_common_items/pages/real_estate.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from zyte_common_items.fields import auto_field
from zyte_common_items.items import RealEstate, RealEstateMetadata

from ..processors import breadcrumbs_processor, description_processor
from ..processors import breadcrumbs_processor, description_processor, images_processor
from .base import BasePage, Page
from .mixins import HasMetadata

Expand All @@ -26,6 +26,7 @@ class BaseRealEstatePage(
class Processors(BasePage.Processors):
breadcrumbs = [breadcrumbs_processor]
description = [description_processor]
images = [images_processor]


class RealEstatePage(Page, Returns[RealEstate], HasMetadata[RealEstateMetadata]):
Expand All @@ -34,6 +35,7 @@ class RealEstatePage(Page, Returns[RealEstate], HasMetadata[RealEstateMetadata])
class Processors(Page.Processors):
breadcrumbs = [breadcrumbs_processor]
description = [description_processor]
images = [images_processor]


@attrs.define
Expand Down

0 comments on commit 7a5f88c

Please sign in to comment.