Skip to content

Commit

Permalink
Merge branch 'main' into error-import
Browse files Browse the repository at this point in the history
  • Loading branch information
Tinche authored Jul 4, 2022
2 parents 9754625 + 38205da commit be42812
Show file tree
Hide file tree
Showing 32 changed files with 901 additions and 626 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
name: "Python ${{ matrix.python-version }}"
runs-on: "ubuntu-latest"
env:
USING_COVERAGE: "3.7,3.8,3.9"
USING_COVERAGE: "3.7,3.8,3.9,3.10,pypy-3.8"

strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10.0"]
python-version: ["3.7", "3.8", "3.9", "3.10", "pypy-3.8"]

steps:
- uses: "actions/checkout@v2"
Expand All @@ -41,7 +41,7 @@ jobs:
python-version: "3.9"

- name: "Upload coverage to Codecov"
if: "contains(env.USING_COVERAGE, matrix.python-version)"
# if: "contains(env.USING_COVERAGE, matrix.python-version)"
uses: "codecov/codecov-action@v1"
with:
fail_ci_if_error: true
Expand Down
10 changes: 10 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ History
* ``cattrs.Converter`` has been renamed to ``cattrs.BaseConverter``, and ``cattrs.GenConverter`` to ``cattrs.Converter``.
The ``GenConverter`` symbol is still available for backwards compatibility, but is deprecated.
If you were depending on functionality specific to the old ``Converter``, change your import to ``from cattrs import BaseConverter``.
* `NewTypes <https://docs.python.org/3/library/typing.html#newtype>`_ are now supported by the ``cattrs.Converter``.
(`#255 <https://github.com/python-attrs/cattrs/pull/255>`_, `#94 <https://github.com/python-attrs/cattrs/issues/94>`_)
* PyPy support (and tests, using a minimal Hypothesis profile) restored.
(`#253 <https://github.com/python-attrs/cattrs/issues/253>`_)
* Fix propagating the `detailed_validation` flag to mapping and counter structuring generators.
* Fix ``typing.Set`` applying too broadly when used with the ``GenConverter.unstruct_collection_overrides`` parameter on Python versions below 3.9. Switch to ``typing.AbstractSet`` on those versions to restore the old behavior.
(`#264 <https://github.com/python-attrs/cattrs/issues/264>`_)
* Uncap the required Python version, to avoid problems detailed in https://iscinumpy.dev/post/bound-version-constraints/#pinning-the-python-version-is-special (`#275 <https://github.com/python-attrs/cattrs/issues/275>`_)
* Fix `Converter.register_structure_hook_factory` and `cattrs.gen.make_dict_unstructure_fn` type annotations.
(`#281 <https://github.com/python-attrs/cattrs/issues/281>`_)

22.1.0 (2022-04-03)
-------------------
Expand Down
4 changes: 2 additions & 2 deletions docs/customizing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Customizing class un/structuring
This section deals with customizing the unstructuring and structuring processes in `cattrs`.

Using ``cattr.Converter``
********************************
*************************

The default ``Converter``, upon first encountering an ``attrs`` class, will use
the generation functions mentioned here to generate the specialized hooks for it,
Expand All @@ -20,7 +20,7 @@ them for types using :py:attr:`Converter.register_structure_hook <cattrs.Convert
flexible but also requires the most amount of boilerplate.

Using ``cattrs.gen`` generators
******************************
*******************************

`cattrs` includes a module, :mod:`cattrs.gen`, which allows for generating and
compiling specialized functions for unstructuring ``attrs`` classes.
Expand Down
6 changes: 6 additions & 0 deletions docs/structuring.rst
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,11 @@ To support arbitrary unions, register a custom structuring hook for the union
`PEP 593`_ annotations (``typing.Annotated[type, ...]``) are supported and are
matched using the first type present in the annotated type.
``typing.NewType``
~~~~~~~~~~~~~~~~~~
`NewTypes`_ are supported and are structured according to the rules for their underlying type.
``attrs`` classes and dataclasses
---------------------------------
Expand Down Expand Up @@ -479,3 +484,4 @@ Here's a small example showing how to use factory hooks to apply the `forbid_ext
A complex use case for hook factories is described over at :ref:`Using factory hooks`.
.. _`PEP 593` : https://www.python.org/dev/peps/pep-0593/
.. _`NewTypes`: https://docs.python.org/3/library/typing.html#newtype
8 changes: 8 additions & 0 deletions docs/unstructuring.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ from ``typing`` on older Python versions.
Fields marked as ``typing.Annotated[type, ...]`` are supported and are matched
using the first type present in the annotated type.

``typing.NewType``
------------------

`NewTypes`_ are supported and are unstructured according to the rules for their underlying type.


``attrs`` classes and dataclasses
---------------------------------

Expand Down Expand Up @@ -200,3 +206,5 @@ Here's a small example showing how to use factory hooks to skip unstructuring


A complex use case for hook factories is described over at :ref:`Using factory hooks`.

.. _`NewTypes`: https://docs.python.org/3/library/typing.html#newtype
Loading

0 comments on commit be42812

Please sign in to comment.