Commit Graph

18 Commits

Author SHA1 Message Date
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 b6bd8c8d2b Remove .coveragerc from MANIFEST.in 2020-01-06 15:53:51 +01:00
Hynek Schlawack a9a32a21a1 Get rid of setup.cfg
I don't mind having a pytest.ini and I know I could fold it into tox.ini.
I just don't want to have two general purpose config files.
2019-10-17 10:31:11 +02:00
Hynek Schlawack 2b31a30f87 Just put everything into the sdist so everyone is happy 2018-12-07 11:36:25 +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
Hynek Schlawack b196adccbf
Use codecov.yml to stop comments (#397)
We get enough information from the CI status.
2018-06-19 12:47:10 +02:00
Hynek Schlawack a372d51b7b
Fade to Black (#392) 2018-06-10 19:40:07 +02:00
Hynek Schlawack 2133157187 Use extra requirements for docs in RTD 2017-12-30 08:42:38 +01:00
Hynek Schlawack c601faf994 Use extras_require instead of dev-requirements.txt (#318)
* Use extras_require instead of dev-requirements.txt

* Better phrasing

* Make names reflects dir names, add docs

Keep docs-requirements.txt for now, but the plan is to get rid of it.

* Explain docs building
2017-12-29 16:11:47 +01:00
Hynek Schlawack ea99d26666 Clean up main directory a bit 2017-12-27 13:32:32 +01:00
Hynek Schlawack 1bb8fbd5ef Add and use SVG version of our logo 2017-11-01 14:28:52 +01:00
Hynek Schlawack 55ae1945b3 Move changelog to towncrier (#236) 2017-08-20 07:58:08 +02:00
Hynek Schlawack b7919d0ddd Fix doc build on sphinx 1.6.1 2017-05-22 16:16:12 -07:00
Hynek Schlawack 617e443cef Use a docs-requirements.txt for RTD 2017-05-16 18:24:48 +02:00
Hynek Schlawack 5424521708 Add PULL_REQUEST_TEMPLATE.md 2017-03-24 09:34:51 +01:00
Hynek Schlawack 10cd1950cb We have a logo! 2017-02-20 13:41:20 +01:00
Hynek Schlawack 01cdff398f Move conftest.py out of tests 2015-02-16 16:30:05 +01:00
Hynek Schlawack 9560908555 Initial commit
Docs aren't there yet
2015-01-27 17:53:17 +01:00