Commit Graph

916 Commits

Author SHA1 Message Date
Vitaliy Yelnik 9de675f4b4
Fix: TypeError when using properties, super(), and slots=True (#652) (#747) 2021-01-11 07:44:16 +01:00
Hynek Schlawack 72f94a3b03 Update isort URL 2021-01-04 13:24:43 +01:00
Hynek Schlawack aa3842f264 Add newsfragment for #710 2021-01-04 13:23:58 +01:00
Hynek Schlawack 446386a36d Don't set pygments style
c.f. https://github.com/pradyunsg/furo/issues/68#issuecomment-752606308
2020-12-31 10:45:33 +01:00
Alex Ford 2fdf92997c
Clarify next-gen auto_attribs inference rules (#742)
* Clarify next-gen auto_attribs inference rules

The next-gen auto_attribs api documentation does not clearly describe
cases where (a) only a subset of attributes are annotated and (b)
`field` definitions are provided for a subset of fields. Update
docstring to reflect current, desirable, behavior.

Add tests to clarify `.define` behavior focused on fully-annotated
classes with partially-defined fields, which is commonly used to add
non-default behavior to a subset of a classes fields. For example:

```python

@attr.define
class NewSchool:
    x: int
    y: list = attr.field()

    @y.validator
    def _validate_y(self, attribute, value):
        if value < 0:
            raise ValueError("y must be positive")

```

The previous docstring *could* be read to imply that:

* The new-school API will not infer auto_attribs if there are any
  unannotated attributes.
* The new-school API will not infer auto_attribs if *any* attr.ib are
  defined, even if those attr.ibs are type annotated.

* Update test to match PR example

* Fix lint error

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2020-12-30 12:53:43 +01:00
Hynek Schlawack 345fb0bcac Add versionchanged for #732 2020-12-30 12:39:03 +01:00
Hynek Schlawack 4ce3778fbe There won't be a 20.4 2020-12-30 12:38:47 +01:00
David Euresti 6b84ad2db2
Move some of the mypy tests over. (#738)
* First pass

* Fix the tests

* trim

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2020-12-28 07:50:29 +01:00
Tal Einat 1fc27c0d85
Rename SECURITY.yml to SECURITY.md (#743) 2020-12-28 07:19:26 +01:00
Hynek Schlawack f132c07e55
Make NOTHING falsey (#732)
* Make NOTHING falsey

Fixes #720

* Add newsfragment

* Python 2
2020-12-21 06:39:58 +01:00
David Euresti 3d274d0bfa
WIP: Add mypy tests (#737)
* Add basic mypy tests

* Only run mypy on 3.6+

* No pypy

* Fix things

* Oooh parametrized
2020-12-21 06:21:28 +01:00
Hynek Schlawack 1c81e3ef7e Minor wordsmithing 2020-12-13 17:24:25 +01:00
Andrei Bodrov 1f627dd3d5
Fixed slots inheritance (#718)
* Fixed slots inheritance

* Added changelog

* Added a separate test

* Restored backwards-compatibility and added a test for it

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2020-12-13 17:22:34 +01:00
Nicholas Coltharp e09b1d6423
Infer type annotations from converters (#710)
* Infer annotations from converters

* Use semantic newlines

* Add 787.change.rst

* Don't let type annotations override converters

* Make pipe() infer type annotations

* Use PY2 instead of sys.versioninfo >= (3, 3)

* Avert crashing with a nullary converter

* Small doc change

* Add type inference for optional()

* Make pipe() annotations actually work

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2020-12-13 16:30:06 +01:00
Hynek Schlawack 612700c3ea pre-commit autoupdate 2020-12-07 07:37:37 +01:00
Hynek Schlawack 1e0e5664fb
Use "official" build & check-wheel-contents (#721) 2020-11-25 09:53:37 +01:00
Hynek Schlawack 108c792ec8 Fix long description 2020-11-20 10:13:38 +01:00
Hynek Schlawack eeecd338d8
Steal shamelessly from urllib3 2020-11-20 10:03:39 +01:00
Tobias Bieniek c5eb24ef0b
logo: Split `path` into multiple paths (#719)
Passing SVG files through `svgo` often makes them harder to edit for applications like InkScape or Sketch. This commit splits the single `path` in the files into multiple paths to resolve this issue. The file is now slightly larger, but should be a lot more maintainable. If more compression is needed then svgo should be applied in a build step, but the repository should contain the raw source file.
2020-11-20 08:36:07 +01:00
Hynek Schlawack 32fb12789e Add white logo for dark mode
Run both through svgo (saved 17.2% for white and 23% for black).
2020-11-16 07:52:35 +01:00
Hynek Schlawack 3119e96931 Start new cycle 2020-11-05 11:32:32 +01:00
Hynek Schlawack f3762ba07b Prepare 20.3.0 2020-11-05 11:00:48 +01:00
Hynek Schlawack 3d66e5727b Exclude GitHub issues from linkcheck to avoid rate limits 2020-11-05 10:51:23 +01:00
Hynek Schlawack 06d0f8eda6 Add funding URLs to metadata 2020-11-05 10:42:13 +01:00
Hynek Schlawack d23924f765 Add provisional notice 2020-11-05 10:02:41 +01:00
Alex Chan cd2f886d63
Use 'i' and 'k' to better distinguish variables in an example (#713) 2020-11-04 11:52:42 +01:00
Hynek Schlawack f2dabeae82
Fix exception chaining on PyPy (#712)
* Fix exception chaining on PyPy

Fixes #703

* Add newsfragment

* Blankly exclude PyPy from coverage reporting

* Manually add default no cover marker
2020-11-04 11:02:15 +01:00
Hynek Schlawack 6b4a1f1ce6 Tighten up mypy configuration
To prevent 9f7d11e in the future.

Add type annotations to typing example to make it pass too.
2020-11-04 08:40:16 +01:00
Hynek Schlawack 9f7d11e415 Add types to collect_by_mro annotations m(
Ref #711
2020-11-03 12:58:00 +01:00
Hynek Schlawack 7020c8b5b5 pre-commit autoupdate 2020-11-03 10:11:39 +01:00
Hynek Schlawack 56c73081c5 Add missing collect_by_mro to typing stubs
Fixes #711
2020-11-03 10:10:43 +01:00
Hynek Schlawack 48157a5741 isort 5 doesn't need seed-isort anymore 2020-11-02 13:44:10 +01:00
Hynek Schlawack e770594afc
Update setup-python action 2020-10-21 12:50:15 +02:00
Hynek Schlawack 08a589a1c0
Use 3.0 proper in CI 2020-10-21 08:49:18 +02:00
Zac Hatfield-Dodds f6ffab7be0
Refactor Hypothesis strategy for self-tests (#706)
* Ease Hypothesis shrinking

This is a tiny performance improvement for shrinking.

Unconditionally drawing and conditionally *using* these boolean flags minimises the impact of mutating other parts of an input on the structure here, which in turn means more attempts will be valid.

* Refactor Hypothesis strategy

Using the composite decorator allows for a much clearer imperative description of how the class is constructed.
2020-10-21 07:04:12 +02:00
Andrei Bodrov bc527b9f29
[RFC] kw_only python 2 backport (#700)
* Added kw_only support for py2

* Docs update

* Added changelog

* Better exception message, moved code to function

* Moved py2-only functions under if PY2:

* Tested fancy error message for unexpected kw-only argument

* Tested fancy error message for unexpected kw-only argument

* Fixed line length

* Added versionchanged

* Updated docs

* Moved functions back under if PY2 - seems codecov doesn't like them in module scope

* Blacked

* Fixed changelog.d

* Removed redundant brackets in test

* Added assertion to the _unpack_kw_only_lines_py2 - hope it will increase code coverage

* List comprehension -> for loop

* lines.extend? I do not like for-loops

* Fix code

* Fixed style/added comment

* Fixed docs (removed python2 mention)

* Fix lint

* Better docstring

* Rewritten docstring and added example code

* Added quotes

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2020-10-19 11:00:00 +02:00
Hynek Schlawack 0e6c74ac17
Treat frozensets like sets in asdict/astuple (#704)
* Treat frozensets like sets in asdict/astuple

Fixes #657

* Add newsfragment
2020-10-19 10:17:25 +02:00
Hynek Schlawack 577691c405 pre-commit autoupdate 2020-10-17 13:40:56 +02:00
Hynek Schlawack ae51f34681 Attribute.assoc → evolve 2020-10-17 07:27:36 +02:00
Hynek Schlawack 83fef48b2d Ensure objects live long enough in hash test 2020-10-16 08:35:42 +02:00
Hynek Schlawack 9f2a7857dc Furo works with SVG!
Fixes #674
2020-10-16 08:19:09 +02:00
Stefan Scherfke 0eae613ce1
Add hooks for field transformation and for asdict serialization (#653) 2020-10-15 09:33:59 +02:00
Hynek Schlawack 0343927ecd Fix theme dependency 2020-10-05 06:39:48 +01:00
Hynek Schlawack ffe49c8241
Switch to furo
Now everything is @pradyunsg's fault! 🎉

Signed-off-by: Hynek Schlawack <hs@ox.cx>
2020-10-05 06:35:40 +01:00
Kyle Altendorf d684e86857
Fix to plural arguments in attr.s on_setattr docs (#699) 2020-10-05 04:42:12 +01:00
Hynek Schlawack f67c1273d7 Add missing word 2020-10-02 10:00:34 +01:00
Hynek Schlawack 6aca10f2a7 Beef up glossary and urge people more to read it
Ref #691
2020-09-28 11:27:37 +01:00
Hynek Schlawack b0d2d92787 Clarify __subclasses__ behavior in slotted classes
Ref #691,#407
2020-09-28 11:16:30 +01:00
Hynek Schlawack a5fe89ccd9 pre-commit autoupdate 2020-09-18 13:27:38 +02:00
Hynek Schlawack 57e7a6bcda Looks like we don't need this workaround anymore 2020-09-18 11:16:58 +02:00