./devel/py-attrs, Attributes without boilerplate

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


Branch: CURRENT, Version: 17.2.0, Package name: py27-attrs-17.2.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
life!


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

Required to build:
[pkgtools/cwrappers]

Master sites:

SHA1: ca1688772851a6dabc4d41a4aa444cdcd9495ecf
RMD160: 015436d6b06c7b8394bff62857716a3b4fd998bb
Filesize: 72.005 KB

Version history: (Expand)


CVS history: (Expand)


   2017-09-03 10:37:04 by Thomas Klausner | Files touched by this commit (182)
Log message:
Comment out dead MASTER_SITES/HOMEPAGEs.
   2017-05-24 21:41:34 by Adam Ciarcinski | Files touched by this commit (2)
Log message:
Changes 17.2.0:
Validators are hashable again. Note that validators may become frozen in the \ 
future, pending availability of no-overhead frozen classes.
   2017-05-20 08:01:46 by Adam Ciarcinski | Files touched by this commit (3)
Log message:
Changes 17.1.0:
Backward-incompatible changes:
* attrs will set the __hash__() method to None by default now. The way hashes \ 
were handled before was in conflict with Python’s specification. This may \ 
break some software although this breakage is most likely just surfacing of \ 
latent bugs. You can always make attrs create the __hash__() method using \ 
@attr.s(hash=True).
* Correspondingly, attr.ib‘s hash argument is None by default too and \ 
mirrors the cmp argument as it should.

Deprecations:
* attr.assoc() is now deprecated in favor of attr.evolve() and will stop working \ 
in 2018.

Changes:
Fix default hashing behavior. Now hash mirrors the value of cmp and classes are \ 
unhashable by default.
Added attr.evolve() that, given an instance of an attrs class and field changes \ 
as keyword arguments, will instantiate a copy of the given instance with the \ 
changes applied. evolve() replaces assoc(), which is now deprecated. evolve() is \ 
significantly faster than assoc(), and requires the class have an initializer \ 
that can take the field values as keyword arguments (like attrs itself can \ 
generate).
FrozenInstanceError is now raised when trying to delete an attribute from a \ 
frozen class.
Frozen-ness of classes is now inherited.
__attrs_post_init__() is now run if validation is disabled.
Added attr.validators.in_(options) that, given the allowed options, checks \ 
whether the attribute value is in it. This can be used to check constants, \ 
enums, mappings, etc.
Added attr.validators.and_() that composes multiple validators into one.
For convenience, the validator argument of @attr.s now can take a list of \ 
validators that are wrapped using and_().
Accordingly, attr.validators.optional() now can take a list of validators too.
Validators can now be defined conveniently inline by using the attribute as a \ 
decorator. Check out the examples to see it in action!
attr.Factory() now has a takes_self argument that makes the initializer to pass \ 
the partially initialized instance into the factory. In other words you can \ 
define attribute defaults based on other attributes.
Default factories can now also be defined inline using decorators. They are \ 
always passed the partially initialized instance.
Conversion can now be made optional using attr.converters.optional().
attr.make_class() now accepts the keyword argument bases which allows for \ 
subclassing.
Metaclasses are now preserved with slots=True.
   2017-02-13 19:57:06 by Adam Ciarcinski | Files touched by this commit (3)
Log message:
Changes 16.3.0:
* Attributes now can have user-defined metadata which greatly improves \ 
attrs‘s extensibility.

* Allow for a __attrs_post_init__ method that – if defined – will get \ 
called at the end of the attrs-generated __init__ method.

* Add @attr.s(str=True) that will optionally create a __str__ method that is \ 
identical to __repr__. This is mainly useful with Exceptions and other classes \ 
that rely on a useful __str__ implementation but overwrite the default one \ 
through a poor own one. Default Python class behavior is to use __repr__ as \ 
__str__ anyways.

If you tried using attrs with Exceptions and were puzzled by the tracebacks: \ 
this option is for you.

* Don’t overwrite __name__ with __qualname__ for attr.s(slots=True) classes.
   2016-06-01 14:30:46 by Thomas Klausner | Files touched by this commit (3)
Log message:
Fix MASTER_SITES.
   2016-04-14 13:06:27 by Leonardo Taccari | Files touched by this commit (4)
Log message:
Import py-attrs-15.2.0 as devel/py-attrs

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
life!