Commit Graph

54 Commits

Author SHA1 Message Date
Hynek Schlawack 8b490b8586 Stop setting attributes on class bodies (#253)
* Stop setting attributes on class bodies

This behavior has been deprecated since 16.1 and can now be removed in
accordance with our backward-compatibility policy.

* We don't need iterkeys anymore
2017-10-02 12:14:37 +02:00
Chad Dombrova 566ada9848 Basic type support (#239)
* Add support for passing a type to attr.ib() and gathering the type from PEP526-style annotations.

* Address review notes.

* More review notes.

* A few more review changes.

* Quick final fix to the changelog.
2017-09-17 16:22:49 +02:00
Hynek Schlawack e31cbe5cfd Add more docs about __attrs_post_init__ (#235)
* Add more docs about __attrs_post_init__

* Grammer
2017-08-18 20:43:38 +02:00
Hynek Schlawack 04e171aa4c Document validator syntax more prominently 2017-05-22 16:42:40 -07:00
Hynek Schlawack 8ed593b954 Better way to fix evolve docs 2017-05-22 16:23:18 -07:00
Hynek Schlawack b7919d0ddd Fix doc build on sphinx 1.6.1 2017-05-22 16:16:12 -07:00
Andre Dieb 461e1b2aab [RFC] Enhancement/one of validator (#181) 2017-05-16 10:36:42 +02:00
Hynek Schlawack a328e67169 Add takes_self to Factory and @_CountingAttr.default (#189)
* Add takes_self to Factory and @_CountingAttr.default

Fixes #165

* Add dark @Tinche magic
2017-05-16 09:36:39 +02:00
Hynek Schlawack fbe0bd5967 Make optional support lists of validators (#186) 2017-05-12 23:02:07 +02:00
Timothy Emiola fdfd51e249 Allow optional conversion (#173)
Fixes #105
2017-05-10 15:37:50 +02:00
Tin Tvrtković b79a49e9a4 Fix evolve (cont) (#182) 2017-05-04 13:20:39 +02:00
Hynek Schlawack 6509da85e1 Add docstring to _CountingAttr.validator 2017-03-24 08:54:02 +01:00
Hynek Schlawack 96fc8cb815 Stop living in the past
...and move all aux tests to 3.6.
2017-03-04 07:52:33 +01:00
Hynek Schlawack f560500886 Fix hashing behavior (#142) 2017-02-19 09:51:43 +01:00
Hynek Schlawack 37d38c4dc3 Allow inline definitions of validators using a decorator
Also make previous changes for multiple validators backward-compatible.
2017-02-11 16:56:56 +01:00
Hynek Schlawack 735ba4121b Move assoc to deprecated section 2017-02-03 11:03:16 +01:00
Tin Tvrtković 0d3cf3f624 Evolve and docs. (#135)
assoc is now deprecated in favor of evolve.
2017-01-21 17:11:45 +01:00
Hynek Schlawack b0942e1b2e Add str argument to @attr.s
Fixes #112
2016-11-20 15:52:11 +01:00
Tin Tvrtković 0fac9215b8 Introduce attribute metadata. (#96) 2016-11-19 09:47:03 +01:00
inso 1b419e304b Add attr.astuple
Fixes #77 and fixes #78
2016-09-11 08:55:30 +02:00
Hynek Schlawack 62cb2e7347 Document new method of accessing attributes 2016-09-10 19:55:27 +02:00
Hynek Schlawack adfdbf9560 Stop using deprecated APIs (#86)
Also use nicer exceptions that subclass the old ones.
2016-09-10 19:14:34 +02:00
Hynek Schlawack 41d8cce09d Add a philosophy section (#73)
Also expand the example class a little bit to stress that we're not just
about data containers.
2016-08-30 12:12:02 +02:00
Hynek Schlawack cfa6d2e99f Implement immutability (#60) 2016-08-20 18:45:15 +02:00
Hynek Schlawack 24e60944ec Add better serious business aliases 2016-08-16 12:18:03 +02:00
JesseWeinstein 2f9826c8dd Doc typo fixes (#56)
Native English speaker fixes
2016-08-15 10:00:23 +02:00
Hynek Schlawack 28204bef92 Deprecate Attribute instances on decorated classes
The changelog deprecation error explains it best.  It's to avoid
confusing errors if some attribute hasn't been initialized for whatever
reason (usually `init=False` + typo).
2016-08-08 12:11:06 +02:00
Tin Tvrtkovic cfc42ef222 Add slots docs. 2016-03-28 21:05:00 +02:00
Christopher Armstrong 20357d4368 fix doctests and lint 2015-11-19 13:59:25 +01:00
Samuel A. Falvo II 765a97466d Review feedback 2015-07-26 11:29:54 +02:00
Hynek Schlawack d964845899 Make __attrs_attrs__ a tuple
Having a mutable and rather heavy data structure for something that is supposed
to be immutable doesn't seem to make sense.
2015-03-23 09:17:54 +01:00
Hynek Schlawack 2a91800150 Add include and exclude filter helpers 2015-02-20 16:34:21 +01:00
Hynek Schlawack fba942270b Stay happy and positive
Closes #6
2015-02-20 13:29:47 +01:00
Hynek Schlawack a185bbfdfb Add option to disable validators globally 2015-02-20 11:30:46 +01:00
Hynek Schlawack 445b6b2e00 Add these argument to attr.s
Useful for third party classes and when using properties.

Based on feedback by @econchick & @hawkowl
2015-02-08 16:31:16 +01:00
Hynek Schlawack c8c7a60389 Rename valid to validate
valid kind of implies a boolean return code.
2015-02-02 14:04:47 +01:00
Hynek Schlawack 2cab907370 Add attr.valid 2015-02-02 12:13:11 +01:00
Hynek Schlawack e7ebf4bf81 Allow single attributes to be excluded 2015-01-30 17:48:34 +01:00
Hynek Schlawack 5753281838 Add attrs.make_class 2015-01-30 08:57:33 +01:00
Hynek Schlawack f61fb5d185 Eliminate factory field
Instead, have only one default field.  If the default value is an instance of
attr.Factory, use it as a factory.
2015-01-29 23:10:56 +01:00
Hynek Schlawack 717dcdadca Short default_value to default 2015-01-29 22:32:41 +01:00
Hynek Schlawack 9cb48a5814 Shorten default_factory to factory 2015-01-29 22:29:37 +01:00
Hynek Schlawack 16d9c464e3 Rename ls to fields 2015-01-29 21:55:25 +01:00
Hynek Schlawack b79c3afec3 Rename to_dict to asdict
For stdlib compatability.
2015-01-29 21:50:07 +01:00
Hynek Schlawack 7aaab84091 Add assoc 2015-01-29 20:50:42 +01:00
Hynek Schlawack 8bb430cf18 Add basic support for zope.interface 2015-01-29 19:04:23 +01:00
Hynek Schlawack 692e4613a0 Add instance_of validator 2015-01-29 12:20:17 +01:00
Hynek Schlawack 69a460d336 Add no-nonsense aliases for attr.s and attr.ib
I like the original ones but let's not give haters extra ammunition. :)
2015-01-29 10:17:08 +01:00
Hynek Schlawack 3f2fd8317d More doc polishing 2015-01-28 16:55:45 +01:00
Hynek Schlawack d5d3dfcdb5 Some minor doc polish 2015-01-28 16:02:18 +01:00