Commit Graph

542 Commits

Author SHA1 Message Date
Ryan Gabbard 659aa48f53 Improve documentation of safety constraints on hashable objects (#505)
* Clarify documentation for hashing

Makes clear that hashable objects need to be deeply immutable, in
practice even if not in theory.

Closes #503 .

* Use simple past tense in docs
2019-02-14 18:06:19 +01:00
Hynek Schlawack 7b37354aa4
Add Python 2 statement (#498) 2019-02-10 07:32:19 +01:00
Hynek Schlawack 2f63f2c5fe
Use isolated builds (#499)
* Use isolated builds

* try to upgrade all the things

* Try to upgrade only setuptools
2019-02-09 18:36:30 +01:00
Hynek Schlawack f8f4aef5a8 Revert isolated builds because they break mypy 2019-02-09 14:48:06 +01:00
Hynek Schlawack d4a002f64d try to fix build 2019-02-09 14:28:01 +01:00
Hynek Schlawack d21eed5165 Use isolated builds 2019-02-09 13:59:26 +01:00
Hynek Schlawack bb9b83ceac
Clarify that annotation-only doesn't work w/ decorators (#486)
Fixes #466
2019-02-09 13:55:48 +01:00
Hynek Schlawack 2e2748aee3
Clarify execution order in init (#488)
* Clarify execution order in init

Fixes #461

* Clarify attributes are processed in the order of declaration

* Simple past is good enough
2019-02-09 13:34:48 +01:00
Hynek Schlawack 87b2bb2e48
Add warning about subclassing behavior (#485)
Fixes #483
2019-02-05 06:45:27 +01:00
Hynek Schlawack 3421b4bd97 Split test and fix warning
message is deprecated.
2019-02-02 14:36:56 +01:00
Hynek Schlawack 40edb30d3a Make nicer link 2019-02-02 14:33:29 +01:00
Ryan Gabbard d2be76c964 Clear cache hash on de-serialization (#489)
* Don't cache hash codes across deserialization.

 Because the hash code cache field gets serialized and deserialized by
 Pickle, previously when you deserialize a cache_hash=True attrs object, the
 hashcode will be the hashcode the object had at serialization-time.
 However, if your object had fields with hash codes which were not
 deterministic between interpreter runs, then on a new interpreter run
 your deserialized object would have a hash code which differs from a
 newly created identical object.

 This commit fixes that by clearing the cache on deserialization. It
 needs to override the __setstate__ method to do so, so this commit
 also forbids using a custom __setstate__ on a cache_hash=True object.

Closes #482 .

* Improve exception type

* Minor tweaks to comments formatting

* Fix test for Python 2.7

* Fix error in comment

* Make nomenclature consistent for slotted/dict classes

* Remove hasattr()

* Improve comments and error message for custom __setstate__ + cache_hash=True

* Drop use of  for test classes for cache hash serialization

* Make changelog note this is a breaking change

* Make exception message point to tracking issue

* Fix test classes for Python 2.7
2019-02-02 14:32:01 +01:00
Hynek Schlawack 1a90857109 Use new flake8 pre-commit 2019-01-31 08:19:26 +01:00
Hynek Schlawack af35f2a57e RTD uses 3.5, so should we
We split up building of docs and doctest because RTD doesn't allow newer than
3.5 but we need up to date Python versions for our doctests.
2019-01-17 10:46:14 +01:00
Steven Loria e60d8efa82 Remove sudo: false from .travis.yml (#484)
Travis CI has already migrated their infrastructure:
https://blog.travis-ci.com/2018-11-19-required-linux-infrastructure-migration
2019-01-17 08:17:37 +01:00
Hynek Schlawack 02b583b375 update pre-commit-hooks 2019-01-16 13:24:36 +01:00
Hynek Schlawack 0c8797da86 There won't be a 18.3.0
RDR2 ¯\_(ツ)_/¯
2019-01-15 19:47:28 +01:00
jimbo1qaz deb90f9b6f Fix grammar error in docs (#477)
"You should avoid $foo, in order to instantiate frozen slotted classes..."
2018-12-24 07:07:00 +01:00
Hynek Schlawack 55642b3343 Only test -dev for latest release 2018-12-15 09:38:27 +01:00
Hynek Schlawack 2b31a30f87 Just put everything into the sdist so everyone is happy 2018-12-07 11:36:25 +01:00
Hynek Schlawack 95fec953a9 Better wording 2018-12-07 11:36:25 +01:00
Stavros Korokithakis 9bed98c35d Improve sentence parsing (#470)
I've always parsed this sentence as "attrs comes with serious, business aliases". I just realized you probably meant srs bzns aliases and figured I'd clarify.
2018-12-07 06:55:14 +01:00
Hynek Schlawack 6a3458f2c2 Add explicit isort arguments from black's docs 2018-11-26 17:51:55 +01:00
Hynek Schlawack 403178e1c1 Typo 2018-11-26 17:34:26 +01:00
Hynek Schlawack cfac7463c1 Fix deprecation warning for PyPI description check 2018-11-26 17:30:27 +01:00
Hynek Schlawack 3f59f08625 Fix double entry in pre-commit config 2018-11-26 12:58:39 +01:00
Hynek Schlawack a7db21a273 More pre-commit, more 3.7, more linting, more stages 2018-11-24 13:36:20 +01:00
Hynek Schlawack 8379adfacb Tune markup 2018-11-24 13:05:58 +01:00
Ryan Gabbard e114561a06 450 kwonly before init false (#459)
* Allow init=False attributes to follow kw_only attributes

Closes #450

* Fix changelog typo

* Update reference text for exception message

* Remove type annotations from tests

* Fix long docstring lines

* Add test with literal default
2018-11-24 13:03:27 +01:00
Hynek Schlawack 7bfd0e4061 Python 3.7 doesn't need sudo anymore 2018-11-23 08:35:30 +01:00
Matt Bullock 336d052ec9 Some new validators (#425)
* initial implementation of deep validators for iterables and dictionaries

* initial implementation of is_callable validator

* add versionadded for deep validators

* add versionadded for is_callable validator

* add tests for is_callable validator

* tweak _DeepIterable repr

* add tests for deep_iterable

* add to _DeepDictionary an initial validation that the top-level value is in fact a dictionary

* add tests for deep_dictionary validator

* apply precommit hooks

* refactor deep_dictionary to deep_mapping with optional mapping validator

* move is_callable validator up in module to allow deep validators to use it

* complete conversion from "deep dictionary" to "deep mapping"

* add changelog.d entry for #425

* fix rst formatting and normalize to semantic newlines

* add "instance_of", "deep_iterable", and "deep_mapping" validators to docs/api.rst

* add "serve-docs" tox environment to preview rendered sphinx docs

* bump versionadded for is_callable and deep validators to 18.3.0

* linting cleanup

* Revert "add "serve-docs" tox environment to preview rendered sphinx docs"

This reverts commit a2df89b788fdc31b54e604095c166b6a37c56f19.

* fix error message broken in linting fix
2018-11-07 19:33:52 -08:00
Theodore Dubois 9f4302a154 Add missing word (#456) 2018-10-28 08:10:08 +01:00
Steven Loria fdf053c3c5 Fix typo (#455) 2018-10-26 12:52:42 +02:00
William Jamir Silva 1a095d1620 Add python_requires in setup.py (#454)
This PR adds `python_requires` into `setup.py` to prevent `pip` from installing `attrs` in unsupported python versions.

I know that currently `attrs` supports a wide range of python versions but I think that it's always good to have some sanity check =)
2018-10-25 12:50:37 +02:00
Hynek Schlawack 4202dcbce0 Unpin pytest, pacify new flake8 2018-10-24 12:13:44 +02:00
Hynek Schlawack 290cf2a3f0 Quench a bunch of warnings 2018-10-19 10:48:09 +02:00
Hynek Schlawack dcfcf5e022 Add newsfragment 2018-10-19 10:21:43 +02:00
Paul Colomiets a216a114fc Fixes generics in mypy types (#443)
This removes errors in attrs library when using
mypy setting: `disallow_any_generics = True`

Fixes #441
2018-10-19 10:11:41 +02:00
Hynek Schlawack 87099af3ea Update PR template
- mention that attr.s() has to be updated by hand
- encourage to tick boxes that do not apply
2018-10-08 10:59:05 +02:00
Hynek Schlawack 25bf9c0019 Add missing return statement in extending docs
Fix by @AXGKl, fixes #447
2018-10-05 16:49:46 +02:00
Hynek Schlawack d73628a6da Due doesn't belong to the beginning of a sentence 2018-10-05 14:41:46 +02:00
Hynek Schlawack 4c0e7ca72e update black 2018-10-04 15:15:28 +02:00
Sagi c17ae9da7a Added Core function parameter in func defintion (#446) 2018-09-17 16:45:53 +02:00
Hynek Schlawack c2bc831957 Start new cycle 2018-09-01 06:52:08 +02:00
Hynek Schlawack aaeba93b06 Prepare 18.2.0 2018-09-01 06:44:34 +02:00
Hynek Schlawack 839a6054b2 Changelog polishes 2018-09-01 06:38:15 +02:00
Hynek Schlawack 15643ae8e2 Link types docs from attr.ib's type argument docs
Fixes #439
2018-09-01 06:28:39 +02:00
Hynek Schlawack ad16cd36bf Get rid of slangy anymore 2018-09-01 06:01:44 +02:00
David Euresti 5b866d34cb Fix note in stubs (#440)
Fixes #415
2018-08-29 20:20:11 +02:00
Hynek Schlawack 73ae718ec5
Consistently use "base class" and "subclass" (#436)
Thanks to ABCs, "base class" is more Python than "superclass" and the latter is
also slightly confusing by alluding to "super" and/or being judgy.
2018-08-29 18:52:47 +02:00