./devel/py-cattrs, Composable complex class support for attrs and dataclasses

[ CVSweb ] [ Homepage ] [ RSS ] [ Required by ] [ Add to tracker ]


Branch: CURRENT, Version: 23.2.3, Package name: py311-cattrs-23.2.3, Maintainer: pkgsrc-users

cattrs is an open source Python library for structuring and
unstructuring data. cattrs works best with attrs classes, dataclasses
and the usual Python collections, but other kinds of classes are
supported by manually registering converters.

Python has a rich set of powerful, easy to use, built-in data types
like dictionaries, lists and tuples. These data types are also the
lingua franca of most data serialization libraries, for formats
like json, msgpack, yaml or toml.

Data types like this, and mappings like dict s in particular,
represent unstructured data. Your data is, in all likelihood,
structured: not all combinations of field names or values are valid
inputs to your programs. In Python, structured data is better
represented with classes and enumerations. attrs is an excellent
library for declaratively describing the structure of your data,
and validating it.

When you're handed unstructured data (by your network, file system,
database...), cattrs helps to convert this data into structured data.
When you have to convert your structured data into data types other
libraries can handle, cattrs turns your classes and enumerations
into dictionaries, integers and strings.


Master sites:

Filesize: 595.913 KB

Version history: (Expand)


CVS history: (Expand)


   2023-12-01 13:58:12 by Adam Ciarcinski | Files touched by this commit (2) | Package updated
Log message:
py-cattrs: updated to 23.2.3

23.2.3 (2023-11-30)

- Fix a regression when unstructuring dictionary values typed as `Any`.
- Fix a regression when unstructuring unspecialized generic classes.
- Optimize function source code caching.
- Generate unique files only in case of linecache enabled.
   2023-11-22 12:43:01 by Adam Ciarcinski | Files touched by this commit (2) | Package updated
Log message:
py-cattrs: updated to 23.2.2

23.2.2 (2023-11-21)

- Fix a regression when unstructuring `Any | None`.
   2023-11-19 15:09:31 by Thomas Klausner | Files touched by this commit (3) | Package updated
Log message:
py-cattrs: update to 23.2.1.

## 23.2.1 (2023-11-18)

- Fix unnecessary `typing_extensions` import on Python 3.11.

## 23.2.0 (2023-11-17)

- **Potentially breaking**: skip _attrs_ fields marked as `init=False` by \ 
default. This change is potentially breaking for unstructuring.
- **Potentially breaking**: {py:func}`cattrs.gen.make_dict_structure_fn` and \ 
{py:func}`cattrs.gen.typeddicts.make_dict_structure_fn` will use the values for \ 
the `detailed_validation` and `forbid_extra_keys` parameters from the given \ 
converter by default now.
  If you're using these functions directly, the old behavior can be restored by \ 
passing in the desired values directly.
- **Potentially breaking**: The default union structuring strategy will also use \ 
fields annotated as `typing.Literal` to help guide structuring.
- Python 3.12 is now supported. Python 3.7 is no longer supported; use older \ 
releases there.
- Implement the `union passthrough` strategy, enabling much richer union \ 
handling for preconfigured converters.
- Introduce the `use_class_methods` strategy.
- The `omit` parameter of {py:func}`cattrs.override` is now of type `bool | \ 
None` (from `bool`).
  `None` is the new default and means to apply default _cattrs_ handling to the \ 
attribute, which is to omit the attribute if it's marked as `init=False`, and \ 
keep it otherwise.
- Converters can now be initialized with custom fallback hook factories for \ 
un/structuring.
- Add support for `date` to preconfigured converters.
- Add support for `datetime.date`s to the PyYAML preconfigured converter.
- Fix {py:func}`format_exception() <cattrs.v.format_exception>` parameter \ 
working for recursive calls to {py:func}`transform_error \ 
<cattrs.transform_error>`.
- _attrs_ aliases are now supported, although aliased fields still map to their \ 
attribute name instead of their alias by default when un/structuring.
- Fix TypedDicts with periods in their field names.
- Optimize and improve unstructuring of `Optional` (unions of one type and `None`).
- Fix {py:func}`format_exception <cattrs.v.format_exception>` and \ 
{py:func}`transform_error <cattrs.transform_error>` type annotations.
- Improve the implementation of `cattrs._compat.is_typeddict`. The \ 
implementation is now simpler, and relies on fewer private implementation \ 
details from `typing` and typing_extensions.
- Improve handling of TypedDicts with forward references.
- Speed up generated _attrs_ and TypedDict structuring functions by changing \ 
their signature slightly.
- Fix copying of converters with function hooks.
- Broaden {py:func}`loads' <cattrs.preconf.orjson.OrjsonConverter.loads>` \ 
type definition for the preconf orjson converter.
- {py:class}`AttributeValidationNote <cattrs.AttributeValidationNote>` and \ 
{py:class}`IterableValidationNote <cattrs.IterableValidationNote>` are now \ 
picklable.
- Fix structuring `Final` lists.
- Fix certain cases of structuring `Annotated` types.
- Fix the tagged union strategy to work with `forbid_extra_keys`.
- Use PDM instead of Poetry.
- _cattrs_ is now linted with Ruff.
- Remove some unused lines in the unstructuring code.
- Fix handling classes inheriting from non-generic protocols.
- The documentation Makefile now supports the `htmlview` and `htmllive` targets.
- _cattrs_ is now published using PyPI Trusted Publishers, and `main` branch \ 
commits are automatically deployed to Test PyPI.
   2023-10-28 21:57:26 by Thomas Klausner | Files touched by this commit (516) | Package updated
Log message:
python/wheel.mk: simplify a lot, and switch to 'installer' for installation

This follows the recommended bootstrap method (flit_core, build, installer).

However, installer installs different files than pip, so update PLISTs
for all packages using wheel.mk and bump their PKGREVISIONs.
   2023-06-06 10:09:47 by Thomas Klausner | Files touched by this commit (3) | Package updated
Log message:
py-cattrs: update to 23.1.2.

23.1.2 (2023-06-02)

    Improve typing_extensions version bound. (#372)

23.1.1 (2023-05-30)

    Add typing_extensions as a direct dependency on 3.10. (#369 #370)

23.1.0 (2023-05-30)

    Introduce the tagged_union strategy. (#318 #317)
    Introduce the cattrs.transform_error helper function for formatting \ 
validation exceptions. (258 342)
    Add support for typing.TypedDict and typing_extensions.TypedDict. (#296 #364)
    Add support for typing.Final. (#340 #349)
    Introduce override.struct_hook and override.unstruct_hook. Learn more here. \ 
(#326)
    Fix generating structuring functions for types with angle brackets \ 
(<>) and pipe symbols (|) in the name. (#319 #327)
    pathlib.Path is now supported by default. (#81)
    Add cbor2 serialization library to the cattr.preconf package.
    Add optional dependencies for cattrs.preconf third-party libraries. (#337)
    All preconf converters now allow overriding the default \ 
unstruct_collection_overrides in make_converter. (#350 #353)
    Subclasses structuring and unstructuring is now supported via a custom \ 
include_subclasses strategy. (#312)
    Add support for typing_extensions.Annotated when the python version is less \ 
than 3.9. (#366)
    Add unstructuring and structuring support for the standard library deque. (#355)
   2023-05-05 14:49:57 by Jonathan Perkin | Files touched by this commit (1)
Log message:
py-cattrs: More stupid python nonsense.
   2023-05-05 11:34:11 by Thomas Klausner | Files touched by this commit (4)
Log message:
devel/py-cattrs: import py-cattrs-22.2.0

cattrs is an open source Python library for structuring and
unstructuring data. cattrs works best with attrs classes, dataclasses
and the usual Python collections, but other kinds of classes are
supported by manually registering converters.

Python has a rich set of powerful, easy to use, built-in data types
like dictionaries, lists and tuples. These data types are also the
lingua franca of most data serialization libraries, for formats
like json, msgpack, yaml or toml.

Data types like this, and mappings like dict s in particular,
represent unstructured data. Your data is, in all likelihood,
structured: not all combinations of field names or values are valid
inputs to your programs. In Python, structured data is better
represented with classes and enumerations. attrs is an excellent
library for declaratively describing the structure of your data,
and validating it.

When you're handed unstructured data (by your network, file system,
database...), cattrs helps to convert this data into structured data.
When you have to convert your structured data into data types other
libraries can handle, cattrs turns your classes and enumerations
into dictionaries, integers and strings.