Commit Graph

21 Commits

Author SHA1 Message Date
Hynek Schlawack 73374ba65e
Remove spurious changes 2023-08-17 09:23:41 +02:00
Hynek Schlawack 16dfa9f713
Stop using nodeenv (#1178)
Constant downloading of Node & Pyright is flaky and a waste of resources.
2023-08-17 09:20:45 +02:00
Hynek Schlawack c824bbe103
Allow subclassing of AttrsInstance and Protocol at once (#1172) 2023-08-06 21:33:03 +02:00
Lanqing Huang c4c6fdd658
Add literal string support to include and exclude filters (#1068)
* Add literal string support to includer and exclude filters

* Add docs and changelog for new feature

* Fix typo in `typing_example`

* Add a note to document typo issues while using literal name strings as filter args

* Add more docs

* Add code mark for `AttributeError`

* Fix grammar error and upgrade `versionchanged` info

* Improve docs and examples from
hynek's comments

* Keep example cases the same

* More examples

* Apply suggestions from code review

Co-authored-by: chrysle <fritzihab@posteo.de>

---------

Co-authored-by: Hynek Schlawack <hs@ox.cx>
Co-authored-by: chrysle <fritzihab@posteo.de>
2023-04-14 08:54:31 +00:00
Hynek Schlawack 2812fab78f
Ignore local helper Justfile 2022-12-01 10:22:41 +01:00
Hynek Schlawack 6c46bb19a0
Start building Dash/Zeal docsets for docs (#1056) 2022-11-25 08:30:34 +01:00
Hynek Schlawack fbcae2a8b0
Switch to 1% static packaging configuration (#998)
* Switch to 1% static packaging configuration

* Add shim for @pganssle

* Not worth interpolation

* Kill extra line
2022-08-10 14:15:32 +02:00
Hynek Schlawack 95e0c423ca Update .gitignore 2022-07-30 13:23:03 +02:00
Hynek Schlawack d74434fefa Ignore pip-wheel-metadata 2019-02-27 08:26:29 +01:00
Chad Dombrova de104e016b Add PEP484 stubs (#238)
* Add PEP484 stubs

* Deploy .pyi stubs alongside .py files.

This is the recommended approach for 3rd party stubs.
See: https://github.com/python/typing/issues/84#issuecomment-317217346

* Add support for the new type argument.

* Add tests for stubs and address a few issues.

* Improve declaration of private vs public objects in stubs

* More stub tests

* Separate the stub tests into their own tox env

it does not make sense to test the stubs in multiple python *runtime* environments (e.g. python 3.5, 3.6, pypy3) because the results of static analysis wrt attrs is not dependent on the runtime.  Moreover, mypy is not installing correctly in pypy3 which has nothing to do with attrs.

* Update the manifest with stub files

* Remove mypy from the dev requirements

* Allow _CountingAttr to be instantiated, but not Attribute.

* Incorporate defaults into attr.ib typing

* Fix a bug with validators.and_

* Add more tests

* Remove _CountingAttr from public interface

It is crucial to ensure that make_class() works with attr.ib(), as a result we no longer have any functions that care about _CountingAttr.

* Lie about return type of Factory

this allows for an abbreviated idiom: `x: List[int] = Factory(list)`

* Add tox stubs env to travis

* used the wrong comment character in mypy tests

* Improve overloads using PyCharm order-based approach

overloads are pretty broken in mypy.  the best we can do for now is target PyCharm, which is much more forgiving.

* Remove features not yet working in mypy. Document remaining issues.

* Test stubs against euresti fork of mypy with attrs plugin

Copied the pytest plugin from mypy for testing annotations: It is not an officially supported API and using the plugin from mypy could break after any update.

* Add some types and TypeVars to some types. Make tests pass

* Suppress warnings about named attribute access from fields()

e.g.  fields(C).x
Eventually it would be good to add support for returning NamedTuple from the mypy plugin

* Add WIP mypy-doctest plugin

* Deal with a few remaining type issues in the docs

* sphinx doctest: don't turn warnings into errors.

doing so makes the tests abort after the first failed group.

* Update "type: ignore" comments to reflect issues fixed in mypy plugin

* doctest2: improve output formatting

* Update manifest

* static tests: use inline error declarations

* More tests

* Tests passing (with notes about remaining issues)

* Attempt to get latest plugin from euresti working

* Issues fixed.

Had to place calls to attr.ib under a class definition.

* Deal with a PyCharm bug

* Minor test improvements

* Make tests prettier

* Use 2 decorators instead of 3

* doctest2: add support for skipping mypy tests

* Add tests for inheritance, eq, and cmp

* Add fixmes and todos

* Rename convert to converter

* Attribute.validator is always a single validator

* Conform stubs to typeshed coding style

And add auto_attrib kw

* backport style fixes from typeshed

* Add test cases to cover forward references and Any

* Add fixes for forward references and Any

* Address typeshed review notes

* Use Sequence instead of List/Tuple for validator arg

list and tuple are invariant and so prevent passing subtypes of _ValidatorType

* backports changes from typeshed #1914

* backport changes from typeshed #1933

* Prevent mypy tests from getting picked up

Evidently the discovery rules changed recently for pytest.

* make our doctest extension compatible with latest sphinx

* Adjustments to the tests

* Fix flake and manifest tests (hopefully)

* Fix tests on pypy3 (hopefully)

* Update stubs from typeshed

Also update tests.

* Make PEP 561-compliant

* minor cleanup

* Consolidate stub support files into stub directory

In preparation for removing them from the pyi_stubs branch.

* Get tests passing

This is a final test of the current stubs before moving the stub tests to a new branch.

* Revert stub test additions

Replace with a simple mypy pass/fail test

* get pre-commit passing

* Address review feedback

* Move typing test up in tox envlist
2018-07-12 12:19:24 +02:00
ngie-eign f5298627e6 Ignore build/ (#350) 2018-03-03 14:50:31 +01:00
Hynek Schlawack 538d75f60c Retain order if these or make_class are passed an ordered dict (#343)
* Retain order if these or make_class are passed an ordered dict

Fixes #339

* Add newsfragment

* Another newsfragment

Fixes #300

* Docs and change tags

* Disable coverage and explain why

* PyPy has ordered dicts too

* Import OrderedDict only when necessary
2018-02-17 12:24:23 +01:00
inso 1b419e304b Add attr.astuple
Fixes #77 and fixes #78
2016-09-11 08:55:30 +02:00
Hynek Schlawack e833e0c1cd coverage 4.2 doesn't need a coverage erase anymore 2016-07-31 14:43:02 +02:00
Hynek Schlawack 4c39a185ad Move package into src directory
Prevents accidental imports when running tests.
2015-10-16 15:11:10 +02:00
Hynek Schlawack f0b142382b Add Python 3.5 2015-09-22 10:41:38 +02:00
Hynek Schlawack fcd6e19932 Don't use setup.py test & pytest-cov
Mainly because the former doesn't use pip to install it's dependencies which
makes stuff potentially slow (no wheel caching) and litters the current directory.
2015-07-26 13:06:57 +02:00
Hynek Schlawack d28336c28a Ignore dist dir 2015-02-03 12:40:12 +01:00
Hynek Schlawack 8bb430cf18 Add basic support for zope.interface 2015-01-29 19:04:23 +01:00
Hynek Schlawack 8f98b38136 Increase branch coverage
And a lot of under the hood work.
2015-01-29 17:31:49 +01:00
Hynek Schlawack 9560908555 Initial commit
Docs aren't there yet
2015-01-27 17:53:17 +01:00