Commit Graph

713 Commits

Author SHA1 Message Date
Hynek Schlawack cab4557e5b
Document how to write aliases that are recognized by mypy (#650)
Co-authored-by: David Euresti <david@euresti.com>
2020-07-20 10:10:03 +02:00
Hynek Schlawack 3e3d84216c Use latest setup-python 2020-07-01 09:42:06 +02:00
Hynek Schlawack 5d7a6ce92e Add FUNDING.yml 2020-07-01 07:33:11 +02:00
Jürgen Gmach cf0adc5d12
Fix typo in `setup.py` (#656)
This typo was noticed when copy/pasting the `read` function into my own
`setup.py`.

Thanks a lot, Hynek!

modified:   setup.py
2020-06-27 14:43:38 +02:00
Hynek Schlawack 77914a4b27 Better name for functional tests 2020-06-10 08:38:52 +02:00
Hynek Schlawack 01899794ef
Fix newsfragment typo 2020-05-18 07:20:30 +02:00
Hynek Schlawack 277a5c1d45
Add control to generate __[sg]etstate__ (#642)
* Add control to generate __[sg]etstate__

Pass *getstate_setstate* to attr.s to control the generation.  Mostly
interesting for disabling it in slotted classes.

Fixes #512,#513

* Update glossary.rst
2020-05-11 07:11:24 +02:00
Hynek Schlawack 784179bab6
Use interrogate to enforce test docstrings
Signed-off-by: Hynek Schlawack <hs@ox.cx>
2020-05-03 12:24:28 +02:00
Hynek Schlawack be71c30792 Add more explicit test 2020-05-02 14:04:40 +02:00
Hynek Schlawack 5a0491c3e1
Fix test name 2020-04-30 17:56:26 +02:00
Hynek Schlawack 6fcdc3d78f Fix docs for Sphinx 3 2020-04-28 09:21:19 +02:00
Hynek Schlawack 33b61316f8
Fix attribute collection (#635)
Co-Authored-By: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
2020-04-06 11:41:52 +02:00
Hynek Schlawack f8f3f598a3 Tune down strategies a bit
It takes too much time, these changes cut the test times in half and shouldn't
affect the coverage negatively.
2020-03-30 11:17:38 +02:00
Hynek Schlawack 2a1e8cf4da Remove intersphinx mapping to zope.interface
One link is not worth a broken CI.
2020-03-29 14:40:25 +02:00
Hynek Schlawack d3ca25550d Save an indentation level and make code more clear 2020-03-29 14:22:33 +02:00
Hynek Schlawack 048c2666c6 Fix typo 2020-03-22 09:23:26 +01:00
Hynek Schlawack 196d948613
Add auto-detection of self-implemented methods (#607)
* Implement auto_detect

Fixes #324

* Add test demonstrating total_ordering

* Ensure the order of applying total_ordering does not matter

* Warn if a method is missing

* Revert "Warn if a method is missing"

This reverts commit 590ef43458040e0a1b9f3644ba22b4229f7d6990.

* Add stern warning that nobody will read
2020-03-16 13:03:12 +01:00
Hynek Schlawack 94ad4f3917
Allow API-based rebuilds 2020-03-14 11:43:42 +01:00
Hynek Schlawack 26f8c998cc That's weird syntax 2020-03-13 11:44:53 +01:00
Hynek Schlawack c6e836ee9d Allow on-demand builds 2020-03-13 11:40:49 +01:00
Hynek Schlawack 618373e335
Move to GitHub Actions (#633)
* Create main.yml

* Update tox.ini

* Update .readthedocs.yml

* Delete azure-pipelines.yml

* Update README.rst

* Update .pre-commit-config.yaml

* Update CONTRIBUTING.rst

* Update tox.ini
2020-03-13 11:07:31 +01:00
Hynek Schlawack 57cb2378b4 Fix hypothesis warning 2020-03-13 09:50:20 +01:00
smarie 07810aec7b
Fix issue 589 (#590)
* from parsyfiles development (https://github.com/smarie/python-simple-file-collection-parsing-framework):
* added new 'chain' validator to allow users to chain their custom validators with, for example, 'instance_of'
* added utility methods to get the declared attribute type (by inspecting its validators) and to check if it is optional

* from parsyfiles development (https://github.com/smarie/python-simple-file-collection-parsing-framework):
* added tests
* fixed bug with optional validator to pass tests :)

* from parsyfiles development (https://github.com/smarie/python-simple-file-collection-parsing-framework):
* completed doc api.rst
* small mod in tests

* Fixed issue with empty cell in closure when slots are used. Fixed #589

* Removed api.rst mods erroneously injected from another branch.

* Removed api.rst mods erroneously injected from another branch.

* noqa so that flake8 is happy

* Fixed lint error

* Added towncrier changelog entry

* Attempt to fix linter error

* Update tests/test_slots.py

* Last lint fix

* Update changelog.d/590.change.rst

Co-Authored-By: Hynek Schlawack <hs@ox.cx>

* Added extensive doc in the new test

* Update tests/test_slots.py

* last lint error

Co-authored-by: Sylvain MARIE <sylvain.marie@se.com>
Co-authored-by: Hynek Schlawack <hs@ox.cx>
2020-03-13 06:06:14 +01:00
Antonio Botelho 4bd6827091
Wrapped __ne__ in a _make_ne function #626 (#632)
* Wrapped __ne__ in a _make_ne function to guarantee that each attrs class gets a new instance of the __ne__ function

* Changed _make_eq to return just __eq__ instead of __eq__ and __ne__

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2020-03-09 14:56:09 +01:00
Hynek Schlawack 609b10e84f Refactor docs and switch to RTD theme
Our API docs are much more readable on it.

Remove testimonials, they don't serve that much and take up space.

Slightly refactor main docs page.
2020-03-08 07:46:56 +01:00
Hynek Schlawack 9e14962988 Make changlog more flashy 2020-03-06 13:57:12 +01:00
Simone Robutti 4dea97e633
added first doc stub (#506)
* added first doc stub

* fixed test

* review

* added newsfragment

* improved docs

Co-authored-by: Simone Robutti <simone.robutti@teraki.com>
2020-03-06 13:54:27 +01:00
Nativ Issac 9fcfe3479f Add and_ converter (#618)
* Add and_ converter

* update _make

* Refactored code according to review

* fixed some linting errors

* minor refactor

* fixed CR comments

* fixed CR comment #2

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2020-03-06 10:34:11 +01:00
Paul Ganssle d6a65fb89f
Use a wrapper class for cache hash to prevent cache serialization (#620)
* Use an self-clearing subclass to store hash cache

Rather than attempting to remove the hash cache from the object state on
deserialization or serialization, instead we store the hash cache in an
object that reduces to None, thus clearing itself when pickled or
copied.

This fixes GH #494 and #613.

Co-authored-by: Matt Wozniski <godlygeek@gmail.com>

* Add test for two-argument __reduce__

I couldn't think of any way to make a useful and meaningful class that
has no state and also has no custom __reduce__ method, so I went
minimalist with it.

* Improve test for hash clearing behavior.

Previously, there was some miniscule risk of hash collision, and also it
was relying on the implementation details of `pickle` (the assumption
that `hash()` is never called as part of `pickle.loads`).

* Add improved testing around cache_hash

* Update src/attr/_make.py

Co-Authored-By: Ryan Gabbard <gabbard@isi.edu>

* Update comment in slots_setstate

Since the cached hash value is not actually serialized in __getstate__,
__setstate__ is not actually "clearing" it on deserialization - it's
initializing the value to None.

* Add changelog entry

* Remove changelog for #611

This change was overshadowed by a more fundamental change in #620.

Co-authored-by: Matt Wozniski <godlygeek@gmail.com>
Co-authored-by: Ryan Gabbard <gabbard@isi.edu>
2020-02-10 17:16:07 +01:00
Hynek Schlawack 8c00f755f9 Explain how to find out the next version 2020-01-25 12:27:44 +01:00
Paul Ganssle 9b5e988ccc Fixed frozen and cache_hash incompatibility (#612)
* Add xfailing test for frozen/cache_hash issue

This is a failing test for GH issue #611, with the xfail decorator to be
removed when the issue is fixed.

* Fix incompatibility between frozen and cache_hash

Fixes GH issue #611: serialization of a class with frozen=True and
cache_hash=True will now succeed rather than raising a
FrozenInstanceError.

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2020-01-13 08:46:11 +01:00
Hynek Schlawack ac541fbe55 Add version constraints for coverage 2020-01-09 12:34:38 +01:00
Hynek Schlawack 7edae2e070 Parallel is set by config 2020-01-08 22:02:39 +01:00
Hynek Schlawack b6bd8c8d2b Remove .coveragerc from MANIFEST.in 2020-01-06 15:53:51 +01:00
Hynek Schlawack 44289f2548 Add missing exception to API docs 2020-01-06 12:34:58 +01:00
Hynek Schlawack 495968281c
Officially drop Python 3.4 (#608) 2020-01-06 12:32:28 +01:00
Hynek Schlawack 8fc636dae3 Add missing optional dep 2020-01-06 11:41:01 +01:00
Hynek Schlawack 7063a9f922 Unpin coverage when reporting too 2020-01-06 11:36:50 +01:00
Hynek Schlawack e07503ff32 Remove 3.4 which is missing on AP 2020-01-06 09:17:23 +01:00
Hynek Schlawack 71cd8af3be Use AP's cached 3.8 2020-01-06 09:15:49 +01:00
Hynek Schlawack 6fcb759862 Put coverage config into pyproject.toml 2020-01-06 09:14:24 +01:00
Hynek Schlawack e67cc51930 Unpin coverage
The problem was fixed in coverage 5.0.2.
2020-01-06 08:45:50 +01:00
Hynek Schlawack 62a173edeb Limit coverage in CI too 2020-01-03 16:03:56 +01:00
Kyle Altendorf 3fff9ee352 Mention attr.fields() after __attrs_attrs__ in 'How does it work' (#605)
* Mention attr.fields() after __attrs_attrs__ in 'How does it work'

The mentioning of __attrs_attrs__ in a 'how does it work' document makes sense but it seems important to mention that there are good non-dunder ways to access the data.

* Correct how-does-it-work.rst change to use semantic newlines

* it's attr not attrs...

* Simplify attr.fields link
2020-01-03 15:37:39 +01:00
Hynek Schlawack aa55c68efd Pin coverage to <5.0 for now
Getting

```
Coverage.py warning: Module attr was previously imported, but not measured (module-not-measured)
```

and missing coverage for some reason. Google is not helpful.
2020-01-03 11:17:20 +01:00
Hynek Schlawack fff74ec6d2 There won't be a 19.4 2019-12-30 15:28:56 +01:00
Hynek Schlawack 43177cc99c pre-commit autoupdate 2019-12-30 14:01:39 +01:00
Hynek Schlawack b78720245a Simplify expression
Thanks, flake8-bugbear.
2019-12-05 15:00:09 +01:00
Tim Gates 311816bb80 Fix simple typo: passses -> passes (#601) 2019-11-19 15:13:45 +01:00
Hynek Schlawack 38d21a7ce6 Remove unnecessary newsfragment 2019-11-18 08:54:43 +01:00