./devel/py-attrs, Attributes without boilerplate

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

Branch: CURRENT, Version: 23.1.0, Package name: py310-attrs-23.1.0, Maintainer: pkgsrc-users

attrs is an MIT-licensed Python package with class decorators that ease the
chores of implementing the most common attribute-related object protocols.

You just specify the attributes to work with and attrs gives you:

* a nice human-readable __repr__,
* a complete set of comparison methods,
* an initializer,
* and much more

without writing dull boilerplate code again and again.

This gives you the power to use actual classes with actual types in your code
instead of confusing tuples or confusingly behaving namedtuples.

So put down that type-less data structures and welcome some class into your

Required to run:
[devel/py-setuptools] [lang/python37]

Required to build:

Master sites:

Filesize: 207.889 KB

Version history: (Expand)

CVS history: (Expand)

   2023-04-30 15:14:49 by Thomas Klausner | Files touched by this commit (3) | Package updated
Log message:
py-attrs: update to 23.1.0.

##  - 2023-04-16

### Backwards-incompatible Changes

- Python 3.6 has been dropped and packaging switched to static package data using .

### Deprecations

- The support for *zope-interface* via the `attrs.validators.provides` validator \ 
is now deprecated and will be removed in, or after, April 2024.

  The presence of a C-based package in our developement dependencies has caused \ 
headaches and we're not under the impression it's used a lot.

  Let us know if you're using it and we might publish it as a separate package.

### Changes

- `attrs.filters.exclude()` and `attrs.filters.include()` now support the \ 
passing of attribute names as strings.

- `attrs.has()` and `attrs.fields()` now handle generic classes correctly.

- Fix frozen exception classes when raised within e.g. \ 
`contextlib.contextmanager`, which mutates their `__traceback__` attributes.

- `@frozen` now works with type checkers that implement .

- Restored ability to unpickle instances pickled before 22.2.0.

- `attrs.asdict()`'s and `attrs.astuple()`'s type stubs now accept the \ 
`attrs.AttrsInstance` protocol.

- Fix slots class cellvar updating closure in CPython 3.8+ even when `__code__` \ 
introspection is unavailable.

- `attrs.resolve_types()` can now pass `include_extras` to \ 
`typing.get_type_hints()` on Python 3.9+, and does so by default.

- Added instructions for pull request workflow to `CONTRIBUTING.md`.

- Added *type* parameter to `attrs.field()` function for use with \ 

  Please note that type checkers ignore type metadata passed into \ 
`make_class()`, but it can be useful if you're wrapping _attrs_.

- It is now possible for `attrs.evolve()` (and `attr.evolve()`) to change fields \ 
named `inst` if the instance is passed as a positional argument.

  Passing the instance using the `inst` keyword argument is now deprecated and \ 
will be removed in, or after, April 2024.

- `attrs.validators.optional()` now also accepts a tuple of validators (in \ 
addition to lists of validators).

##  - 2022-12-21

### Backwards-incompatible Changes

- Python 3.5 is not supported anymore.

### Deprecations

- Python 3.6 is now deprecated and support will be removed in the next release.

### Changes

- `attrs.field()` now supports an *alias* option for explicit `__init__` \ 
argument names.

  Get `__init__` signatures matching any taste, peculiar or plain!
  The  *alias* option can be use to override private attribute name mangling, or \ 
add other arbitrary field argument name overrides.

- `attrs.NOTHING` is now an enum value, making it possible to use with e.g. .

- Added missing re-import of `attr.AttrsInstance` to the `attrs` namespace.

- Fix slight performance regression in classes with custom `__setattr__` and \ 
speedup even more.

- Class-creation performance improvements by switching performance-sensitive \ 
templating operations to f-strings.

  You can expect an improvement of about 5% -- even for very simple classes.

- `attrs.has()` is now a  for `AttrsInstance`.
  That means that type checkers know a class is an instance of an `attrs` class \ 
if you check it using `attrs.has()` (or `attr.has()`) first.

- Made `attrs.AttrsInstance` stub available at runtime and fixed type errors \ 
related to the usage of `attrs.AttrsInstance` in *Pyright*.

- On Python 3.10 and later, call  on dict classes after creation.
  This improves the detection of abstractness.

- *attrs*'s pickling methods now use dicts instead of tuples.
  That is safer and more robust across different versions of a class.

- Added `attrs.validators.not_(wrapped_validator)` to logically invert \ 
*wrapped_validator* by accepting only values where *wrapped_validator* rejects \ 
the value with a `ValueError` or `TypeError` (by default, exception types \ 

- The type stubs for `attrs.cmp_using()` now have default values.

- To conform with ` now accept *unsafe_hash* in addition to *hash*.

##  - 2022-07-28

### Backwards-incompatible Changes

- Python 2.7 is not supported anymore.

  Dealing with Python 2.7 tooling has become too difficult for a volunteer-run \ 

  We have supported Python 2 more than 2 years after it was officially \ 
discontinued and feel that we have paid our dues.
  All version up to 21.4.0 from December 2021 remain fully functional, of course.

- The deprecated `cmp` attribute of `attrs.Attribute` has been removed.
  This does not affect the *cmp* argument to `attr.s` that can be used as a \ 
shortcut to set *eq* and *order* at the same time.

### Changes

- Instantiation of frozen slotted classes is now faster.

- If an `eq` key is defined, it is also used before hashing the attribute.

- Added `attrs.validators.min_len()`.

- `attrs.validators.deep_iterable()`'s *member_validator* argument now also \ 
accepts a list of validators and wraps them in an `attrs.validators.and_()`.

- Added missing type stub re-imports for `attrs.converters` and `attrs.filters`.

- Added missing stub for `attr(s).cmp_using()`.

- `attrs.validators._in()`'s `ValueError` is not missing the attribute, expected \ 
options, and the value it got anymore.

- Python 3.11 is now officially supported.
   2023-04-30 14:12:52 by Thomas Klausner | Files touched by this commit (1)
Log message:
py-attrs: add test status, comment out test dependency

py-ZopeInterface will shortly stop supporting python 2.x, and it's an
optional here.
   2022-08-24 11:25:57 by Thomas Klausner | Files touched by this commit (17)
Log message:
*: use coverage from versioned_dependencies.mk
   2022-02-26 14:39:07 by Thomas Klausner | Files touched by this commit (1)
Log message:
py-attrs: fix PLIST for python 2.x
   2022-02-23 12:43:41 by Adam Ciarcinski | Files touched by this commit (3) | Package updated
Log message:
py-attrs: updated to 21.4.0

21.4.0 (2021-12-29)


- Fixed the test suite on PyPy3.8 where ``cloudpickle`` does not work.
- Fixed ``coverage report`` for projects that use ``attrs`` and don't set a \ 


21.3.0 (2021-12-28)

Backward-incompatible Changes

- When using ``@define``, converters are now run by default when setting an \ 
attribute on an instance -- additionally to validators.
  I.e. the new default is ``on_setattr=[attrs.setters.convert, \ 

  This is unfortunately a breaking change, but it was an oversight, impossible \ 
to raise a ``DeprecationWarning`` about, and it's better to fix it now while the \ 
APIs are very fresh with few users.
- ``import attrs`` has finally landed!
  As of this release, you can finally import ``attrs`` using its proper name.

  Not all names from the ``attr`` namespace have been transferred; most notably \ 
``attr.s`` and ``attr.ib`` are missing.
  See ``attrs.define`` and ``attrs.field`` if you haven't seen our \ 
next-generation APIs yet.
  A more elaborate explanation can be found `On The Core API Names \ 

  This feature is at least for one release **provisional**.
  We don't *plan* on changing anything, but such a big change is unlikely to go \ 
perfectly on the first strike.

  The API docs have been mostly updated, but it will be an ongoing effort to \ 
change everything to the new APIs.
  Please note that we have **not** moved -- or even removed -- anything from \ 

  Please do report any bugs or documentation inconsistencies!


- ``attr.asdict(retain_collection_types=False)`` (default) dumps \ 
collection-esque keys as tuples.
- ``__match_args__`` are now generated to support Python 3.10's
  `Structural Pattern Matching \ 
  This can be controlled by the ``match_args`` argument to the class decorators \ 
on Python 3.10 and later.
  On older versions, it is never added and the argument is ignored.
- If the class-level *on_setattr* is set to ``attrs.setters.validate`` (default \ 
in ``@define`` and ``@mutable``) but no field defines a validator, pretend that \ 
it's not set.
- The generated ``__repr__`` is significantly faster on Pythons with f-strings.
- Attributes transformed via ``field_transformer`` are wrapped with \ 
``AttrsClass`` again.
- Generated source code is now cached more efficiently for identical classes.
- Added ``attrs.converters.to_bool()``.
- ``attrs.resolve_types()`` now resolves types of subclasses after the parents \ 
are resolved.
- Added new validators: ``lt(val)`` (< val), ``le(va)`` (≤ val), \ 
``ge(val)`` (≥ val), ``gt(val)`` (> val), and ``maxlen(n)``.
- ``attrs`` classes are now fully compatible with `cloudpickle \ 
<https://github.com/cloudpipe/cloudpickle>`_ (no need to disable ``repr`` \ 
- Added new context manager ``attrs.validators.disabled()`` and functions \ 
  They deprecate ``attrs.(set|get)_run_validators()``.
  All functions are interoperable and modify the same internal state.
  They are not – and never were – thread-safe, though.
- ``attrs.validators.matches_re()`` now accepts pre-compiled regular expressions \ 
in addition to pattern strings.

21.2.0 (2021-05-07)

Backward-incompatible Changes

- We had to revert the recursive feature for ``attr.evolve()`` because it broke \ 
some use-cases -- sorry!
- Python 3.4 is now blocked using packaging metadata because ``attrs`` can't be \ 
imported on it anymore.
  To ensure that 3.4 users can keep installing  ``attrs`` easily, we will `yank \ 
<https://pypi.org/help/#yanked>`_ 21.1.0 from PyPI.
  This has **no** consequences if you pin ``attrs`` to 21.1.0.

21.1.0 (2021-05-06)


- The long-awaited, much-talked-about, little-delivered ``import attrs`` is \ 
finally upon us!

  Since the NG APIs have now been proclaimed stable, the **next** release of \ 
``attrs`` will allow you to actually ``import attrs``.
  We're taking this opportunity to replace some defaults in our APIs that made \ 
sense in 2015, but don't in 2021.

  So please, if you have any pet peeves about defaults in ``attrs``'s APIs, \ 
*now* is the time to air your grievances in 487!
  We're not gonna get such a chance for a second time, without breaking our \ 
backward-compatibility guarantees, or long deprecation cycles.
  Therefore, speak now or forever hold you peace!
- The *cmp* argument to ``attr.s()`` and `attr.ib()` has been **undeprecated**
  It will continue to be supported as syntactic sugar to set *eq* and *order* in \ 
one go.

  I'm terribly sorry for the hassle around this argument!
  The reason we're bringing it back is it's usefulness regarding customization \ 
of equality/ordering.

  The ``cmp`` attribute and argument on ``attr.Attribute`` remains deprecated \ 
and will be removed later this year.


- It's now possible to customize the behavior of ``eq`` and ``order`` by passing \ 
in a callable.
- The instant favorite next-generation APIs are not provisional anymore!

  They are also officially supported by Mypy as of their `0.800 release \ 

  We hope the next release will already contain an (additional) importable \ 
package called ``attrs``.
- If an attribute defines a converter, the type of its parameter is used as type \ 
annotation for its corresponding ``__init__`` parameter.

  If an ``attr.converters.pipe`` is used, the first one's is used.
- Fixed the creation of an extra slot for an ``attr.ib`` when the parent class \ 
already has a slot with the same name.
- ``__attrs__init__()`` will now be injected if ``init=False``, or if \ 
``auto_detect=True`` and a user-defined ``__init__()`` exists.

  This enables users to do "pre-init" work in their ``__init__()`` \ 
(such as ``super().__init__()``).

  ``__init__()`` can then delegate constructor argument processing to \ 
``self.__attrs_init__(*args, **kwargs)``.
- ``bool(attr.NOTHING)`` is now ``False``.
- It's now possible to use ``super()`` inside of properties of slotted classes.
- Allow for a ``__attrs_pre_init__()`` method that -- if defined -- will get \ 
called at the beginning of the ``attrs``-generated ``__init__()`` method.
- Added forgotten ``attr.Attribute.evolve()`` to type stubs.
- ``attrs.evolve()`` now works recursively with nested ``attrs`` classes.
- Python 3.10 is now officially supported.
- ``attr.resolve_types()`` now takes an optional *attrib* argument to work \ 
inside a ``field_transformer``.
- ``ClassVar``\ s are now also detected if they come from `typing-extensions \ 
- To make it easier to customize attribute comparison, we have added the \ 
``attr.cmp_with()`` helper.

  See the `new docs on comparison \ 
<https://www.attrs.org/en/stable/comparison.html>`_ for more details.
- Added **provisional** support for static typing in ``pyright`` via the \ 
`dataclass_transforms specification \ 
  Both the ``pyright`` specification and ``attrs`` implementation may change in \ 
future versions of both projects.
   2022-01-04 21:55:40 by Thomas Klausner | Files touched by this commit (1595)
Log message:
*: bump PKGREVISION for egg.mk users

They now have a tool dependency on py-setuptools instead of a DEPENDS
   2021-10-26 12:20:11 by Nia Alarie | Files touched by this commit (3016)
Log message:
archivers: Replace RMD160 checksums with BLAKE2s checksums

All checksums have been double-checked against existing RMD160 and
SHA512 hashes

Could not be committed due to merge conflict:

The following distfiles were unfetchable (note: some may be only fetched

./devel/pvs/distinfo pvs-3.2-solaris.tgz
./devel/eclipse/distinfo eclipse-sourceBuild-srcIncluded-3.0.1.zip
   2021-10-07 15:44:44 by Nia Alarie | Files touched by this commit (3017)
Log message:
devel: Remove SHA1 hashes for distfiles