From e9d5696d1835b16f784f643c8e2113efbc4d69985c97ff21085d61482d4fc9c2 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Mon, 28 Oct 2024 22:40:48 +0000 Subject: [PATCH] - update to 24.1.2: * Fix {meth}`BaseConverter.register_structure_hook` and {meth}`BaseConverter.register_unstructure_hook` type hints. * Fix {meth}`BaseConverter.register_structure_hook_factory` and {meth}`BaseConverter.register_unstructure_hook_factory` type hints. * **Potentially breaking**: Unstructuring hooks for `typing.Any` are consistent now: values are unstructured using their runtime type. * Introduce {meth}`BaseConverter.get_structure_hook` and {meth}`BaseConverter.get_unstructure_hook` methods. * Enhance the {func}`cattrs.cols.is_mapping` predicate function to also cover virtual subclasses of `abc.Mapping`. * Introduce the _msgspec_ {mod}`preconf converter `. * Add support for PEP 695 type aliases. * Add support for PEP 696 `TypeVar`s with defaults. * Add support for named tuples with type metadata (`typing.NamedTuple`). * Add support for optionally un/unstructuring named tuples using dictionaries. * PEP 695 generics are now tested. * Imports are now sorted using Ruff. * Tests are run with the pytest-xdist plugin by default. * Rework the introductory parts of the documentation, introducing the Basics section. * The documentation has been significantly reworked. * The docs now use the Inter font. * Make type annotations for `include_subclasses` and `tagged_union` strategies more lenient. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cattrs?expand=0&rev=9 --- .gitattributes | 23 +++++ .gitignore | 1 + cattrs-23.2.3.tar.gz | 3 + cattrs-24.1.2.tar.gz | 3 + python-cattrs.changes | 204 ++++++++++++++++++++++++++++++++++++++++++ python-cattrs.spec | 86 ++++++++++++++++++ 6 files changed, 320 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 cattrs-23.2.3.tar.gz create mode 100644 cattrs-24.1.2.tar.gz create mode 100644 python-cattrs.changes create mode 100644 python-cattrs.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/cattrs-23.2.3.tar.gz b/cattrs-23.2.3.tar.gz new file mode 100644 index 0000000..5dc0ac2 --- /dev/null +++ b/cattrs-23.2.3.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a934090d95abaa9e911dac357e3a8699e0b4b14f8529bcc7d2b1ad9d51672b9f +size 610215 diff --git a/cattrs-24.1.2.tar.gz b/cattrs-24.1.2.tar.gz new file mode 100644 index 0000000..ae2d41a --- /dev/null +++ b/cattrs-24.1.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8028cfe1ff5382df59dd36474a86e02d817b06eaf8af84555441bac915d2ef85 +size 426462 diff --git a/python-cattrs.changes b/python-cattrs.changes new file mode 100644 index 0000000..8e75396 --- /dev/null +++ b/python-cattrs.changes @@ -0,0 +1,204 @@ +------------------------------------------------------------------- +Mon Oct 28 22:38:02 UTC 2024 - Dirk Müller + +- update to 24.1.2: + * Fix {meth}`BaseConverter.register_structure_hook` and + {meth}`BaseConverter.register_unstructure_hook` type hints. + * Fix {meth}`BaseConverter.register_structure_hook_factory` and + {meth}`BaseConverter.register_unstructure_hook_factory` type + hints. + * **Potentially breaking**: Unstructuring hooks for + `typing.Any` are consistent now: values are unstructured + using their runtime type. + * Introduce {meth}`BaseConverter.get_structure_hook` and + {meth}`BaseConverter.get_unstructure_hook` methods. + * Enhance the {func}`cattrs.cols.is_mapping` predicate function + to also cover virtual subclasses of `abc.Mapping`. + * Introduce the _msgspec_ {mod}`preconf converter + `. + * Add support for PEP 695 type aliases. + * Add support for PEP 696 `TypeVar`s with defaults. + * Add support for named tuples with type metadata + (`typing.NamedTuple`). + * Add support for optionally un/unstructuring named tuples + using dictionaries. + * PEP 695 generics are now tested. + * Imports are now sorted using Ruff. + * Tests are run with the pytest-xdist plugin by default. + * Rework the introductory parts of the documentation, + introducing the Basics section. + * The documentation has been significantly reworked. + * The docs now use the Inter font. + * Make type annotations for `include_subclasses` and + `tagged_union` strategies more lenient. + +------------------------------------------------------------------- +Mon Apr 8 10:41:21 UTC 2024 - Dirk Müller + +- add sle15_python_module_pythons + +------------------------------------------------------------------- +Thu Dec 14 09:18:25 UTC 2023 - Petr Gajdos + +- update to 23.2.3: + * Fix a regression when unstructuring dictionary values typed + as `Any`. + * (#453 #462) + * Fix a regression when unstructuring unspecialized generic + classes. + * (#465 #466) + * Optimize function source code caching. + * (#445 #464) + * Generate unique files only in case of linecache enabled. + * (#445 #441) + * ## 23.2.2 (2023-11-21) + * Fix a regression when unstructuring `Any | None`. + * (#453 #454) + * ## 23.2.1 (2023-11-18) + * Fix unnecessary `typing_extensions` import on Python 3.11. + * (#446 #447) + * ## 23.2.0 (2023-11-17) + * **Potentially breaking**: skip _attrs_ fields marked as + `init=False` by default. This change is potentially breaking + for unstructuring. + * See here for instructions on how to restore the old behavior. + * (#40 #395) + * **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. + * (#410 #411) + * **Potentially breaking**: The default union structuring + strategy will also use fields annotated as `typing.Literal` + to help guide structuring. + * See here for instructions on how to restore the old behavior. + * (#391) + * Python 3.12 is now supported. Python 3.7 is no longer + supported; use older releases there. + * (#424) + * Implement the `union passthrough` strategy, enabling much + richer union handling for preconfigured converters. Learn + more here. + * Introduce the `use_class_methods` strategy. Learn more here. + * (#405) + * 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. + * (#331 #441) + * Add support for `date` to preconfigured converters. + * (#420) + * Add support for `datetime.date`s to the PyYAML preconfigured + converter. + * (#393) + * Fix {py:func}`format_exception() ` + parameter working for recursive calls to + {py:func}`transform_error `. + * (#389) + * _attrs_ aliases are now supported, although aliased fields + still map to their attribute name instead of their alias by + default when un/structuring. + * (#322 #391) + * Fix TypedDicts with periods in their field names. + * (#376 #377) + * Optimize and improve unstructuring of `Optional` (unions of + one type and `None`). + * (#380 #381) + * Fix {py:func}`format_exception ` + and {py:func}`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. + * (#384) + * Improve handling of TypedDicts with forward references. + * Speed up generated _attrs_ and TypedDict structuring + functions by changing their signature slightly. + * (#388) + * Fix copying of converters with function hooks. + * (#398 #399) + * Broaden {py:func}`loads' + ` type + definition for the preconf orjson converter. + * (#400) + * {py:class}`AttributeValidationNote + ` and + {py:class}`IterableValidationNote + ` are now picklable. + * (#408) + * Fix structuring `Final` lists. + * (#412) + * Fix certain cases of structuring `Annotated` types. + * (#418) + * Fix the tagged union strategy to work with + `forbid_extra_keys`. + * (#402 #443) + * Use PDM instead of Poetry. + * _cattrs_ is now linted with Ruff. + * Remove some unused lines in the unstructuring code. + * (#416) + * Fix handling classes inheriting from non-generic protocols. + * (#374 #436) + * The documentation Makefile now supports the `htmlview` and + `htmllive` targets. (#442) + * _cattrs_ is now published using PyPI Trusted Publishers, and + `main` branch commits are automatically deployed to Test + PyPI. + * ## 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 `cattrs.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) + +------------------------------------------------------------------- +Mon May 8 21:15:51 UTC 2023 - Ben Greiner + +- Slim down build requirement to poetry-core +- Explicitily require a bunch of test dependencies instead + +------------------------------------------------------------------- +Mon Jan 23 04:22:53 UTC 2023 - Steve Kowalik + +- Initial release of 22.2.0. + diff --git a/python-cattrs.spec b/python-cattrs.spec new file mode 100644 index 0000000..ce069b9 --- /dev/null +++ b/python-cattrs.spec @@ -0,0 +1,86 @@ +# +# spec file for package python-cattrs +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%{?sle15_python_module_pythons} +Name: python-cattrs +Version: 24.1.2 +Release: 0 +Summary: Composable complex class support for attrs and dataclasses +License: MIT +URL: https://github.com/python-attrs/cattrs +Source: https://files.pythonhosted.org/packages/source/c/cattrs/cattrs-%{version}.tar.gz +Requires: python-exceptiongroup +BuildRequires: %{python_module hatch-vcs} +BuildRequires: %{python_module hatchling} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module poetry-core >= 1.1} +BuildRequires: python-rpm-macros +# SECTION test requirements +BuildRequires: %{python_module attrs >= 20} +BuildRequires: %{python_module PyYAML} +BuildRequires: %{python_module cbor2} +BuildRequires: %{python_module hypothesis} +BuildRequires: %{python_module immutables} +BuildRequires: %{python_module msgpack >= 1.0.2} +BuildRequires: %{python_module msgspec} +BuildRequires: %{python_module orjson} +BuildRequires: %{python_module pymongo} +BuildRequires: %{python_module pytest-benchmark} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module tomlkit} +BuildRequires: %{python_module typing_extensions} +BuildRequires: %{python_module ujson} +# /SECTION +BuildRequires: fdupes +Requires: python-attrs >= 20 +Requires: python-cbor2 +Requires: python-typing_extensions +Suggests: python-ujson +Suggests: python-orjson +Suggests: python-msgpack +Suggests: python-PyYAML +Suggests: python-tomlkit +Suggests: python-cbor2 +Suggests: python-pymongo +BuildArch: noarch +%python_subpackages + +%description +Composable complex class support for attrs and dataclasses. + +%prep +%autosetup -p1 -n cattrs-%{version} + +%build +%pyproject_wheel + +%install +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +%pytest + +%files %{python_files} +%doc README.md HISTORY.md CONTRIBUTING.md +%license LICENSE +%{python_sitelib}/cattr +%{python_sitelib}/cattrs +%{python_sitelib}/cattrs-%{version}.dist-info + +%changelog