Path to this page:
Subject: CVS commit: pkgsrc/devel/py-attrs
From: Adam Ciarcinski
Date: 2024-08-04 08:40:25
Message id: 20240804064025.D78BCFC74@cvs.NetBSD.org
Log Message:
py-attrs: updated to 24.1.0
24.1.0
Backwards-incompatible Changes
- `attrs.evolve()` doesn't accept the *inst* argument as a keyword argument anymore.
Pass it as the first positional argument instead.
- `attrs.validators.provides()` has been removed.
The removed code is available as a \
[gist](https://gist.github.com/hynek/9eaaaeb659808f3519870dfa16d2b6b2) for \
convenient copy and pasting.
- All packaging metadata except from `__version__` and `__version_info__` has \
been removed from the `attr` and `attrs` modules (for example, `attrs.__url__`).
Please use \
[`importlib.metadata`](https://docs.python.org/3/library/importlib.metadata.html) \
or [*importlib_metadata*](https://pypi.org/project/importlib-metadata/) instead.
- Speed up the generated `__eq__` methods significantly by generating a chain of \
attribute comparisons instead of constructing and comparing tuples.
This change arguably makes the behavior more correct,
but changes it if an attribute compares equal by identity but not value, like \
`float('nan')`.
Deprecations
- The *repr_ns* argument to `attr.s` is now deprecated.
It was a workaround for nested classes in Python 2 and is pointless in Python 3.
- The *hash* argument to `@attr.s`, `@attrs.define`, and `make_class()` is now \
deprecated in favor of *unsafe_hash*, as defined by PEP 681.
Changes
- Allow original slotted `functools.cached_property` classes to be cleaned by \
garbage collection.
Allow `super()` calls in slotted cached properties.
- Our type stubs now use modern type notation and are organized such that VS \
Code's quick-fix prefers the `attrs` namespace.
- Preserve `AttributeError` raised by properties of slotted classes with \
`functools.cached_properties`.
- It is now possible to wrap a converter into an `attrs.Converter` and get the \
current instance and/or the current field definition passed into the converter \
callable.
Note that this is not supported by any type checker, yet.
- `attrs.make_class()` now populates the `__annotations__` dict of the generated \
class, so that `attrs.resolve_types()` can resolve them.
- Added the `attrs.validators.or_()` validator.
- The combination of a `__attrs_pre_init__` that takes arguments, a kw-only \
field, and a default on that field does not crash anymore.
- `attrs.validators.in_()` now transforms certain unhashable options to tuples \
to keep the field hashable.
This allows fields that use this validator to be used with, for example, \
`attrs.filters.include()`.
- If a class has an *inherited* method called `__attrs_init_subclass__`, it is \
now called once the class is done assembling.
This is a replacement for Python's `__init_subclass__` and useful for \
registering classes, and similar.
Files: