Commit Graph

60 Commits

Author SHA1 Message Date
Hynek Schlawack 955d622493
Add attr.__version_info__ (#580)
* Add attr.__version_info__

This allows users to check for features and avoid deprecation warnings without
breaking backward compatibility.

* Add newsfragment

* Stay ASCII

* Typo

* Add stubs for _version.py

* Address David's feedback

* Handle PY2 better in comparability test

* drop the ing
2019-10-01 16:06:36 +02:00
David Euresti 08bbaabaca Fix some typing issues (#581)
* Typecheck stubs in CI and fix type errors.  Fixes #578

* Add overloads to instance_of definition.

Improves #576
2019-09-26 06:49:15 +02:00
Julian Berman 8824dc26c2 Add default_role for Sphinx. (#571)
* Add default_role for Sphinx.

Fix a bunch of broken refs along the way, which become
errors now via -W if you have default_role set.

In theory you can catch those via sphinx-build -n (i.e.
nitpick mode), which IMHO is a decent idea anyhow, but it's
a longer diff to enable that because it'd involve fixing a
bunch of the places that try to reference types that don't
exist (e.g. :type foo: Any value). But obviously can be done.

Also didn't actually use this anywhere yet (the any role),
but will do so in a follow-up if this is acceptable.

* Remove the roles from builtin objects to demo any.

* Style.

* Add z.i to intersphinx.

Enables the link to z.i.Interface.

* Enable nitpick mode.

Fix the remaining broken links or whitelist them via nitpick_ignore.

* Kill all :func:s.

* Kill all :class:es.

* Kill all :doc:s.

* Kill all :ref:s.

Except one, that probably meant :func:, and which
is a duplicate ref.

* Kill :exc: and :data:.

* Kill :mod:s.

* Kill new explicit refs from the merge.
2019-09-09 15:02:16 +02:00
Hynek Schlawack 4d03c7d69f Be explicit about 3.8 2019-06-04 11:09:42 +02:00
Hynek Schlawack 776d09dcc4 Run py38 under coverage too 2019-06-04 10:39:33 +02:00
Hynek Schlawack d6ca77a3ba Nicer env handling 2019-05-31 10:31:45 +02:00
Hynek Schlawack 729681b5a8
[WIP] Set up CI with Azure Pipelines (#510)
* Set up CI with Azure Pipelines

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update setup.py

* Update tox.ini

* Update setup.py

* Update azure-pipelines.yml

* Update setup.py

* Update azure-pipelines.yml

* Update azure-pipelines.yml for Azure Pipelines

* Delete .travis.yml

* Update README.rst

* Update azure-pipelines.yml

* Update azure-pipelines.yml
2019-05-08 16:13:55 -04:00
Hynek Schlawack de84609505 This is not accurate 2019-05-02 16:50:31 -04:00
Hynek Schlawack a35d8fb4c4 fix and simplify docs CI 2019-02-25 16:41:46 +01:00
Hynek Schlawack aa9f62f244 Use 3.7 for RTD 2019-02-25 16:28:53 +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 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
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 290cf2a3f0 Quench a bunch of warnings 2018-10-19 10:48:09 +02: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 2d71759098
Run on 3.7 proper (#405) 2018-07-05 07:39:16 +02:00
Hynek Schlawack e65ba7594d Remove lying comment 2018-06-23 12:02:51 +02:00
Hynek Schlawack 9278f8f942 Pull lint to the front for faster feedback
Also extras make no sense with skip_install=true
2018-06-16 10:41:45 +02:00
Hynek Schlawack a372d51b7b
Fade to Black (#392) 2018-06-10 19:40:07 +02:00
Łukasz Langa 29cc2abac8 Use `\\` instead of a single `\` in docstrings (#375)
* Use `\\` instead of a single `\` in docstrings

The latter is not an invalid escape and Python 3.6+ complains about it.  I also
updated tox.ini so that those warnings are visible in the future.

Fixes #351

* Make the config "forgetful dumbass"-proof
2018-04-28 23:42:00 +02:00
Hynek Schlawack 209c57993c Use tox's extras feature 2018-01-04 09:29:57 +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 ef9a062022
Use isort so we can stop thinking about imports (#297) 2017-11-26 22:18:07 +01:00
Hynek Schlawack 55ae1945b3 Move changelog to towncrier (#236) 2017-08-20 07:58:08 +02:00
Tin Tvrtković 47583a9459 Bugfix/slot super (#226) 2017-08-03 17:04:48 +02:00
Hynek Schlawack f8dab9b7ac Use VIRTUALENV_NO_DOWNLOAD in tox (#200) 2017-06-01 09:20:30 +02:00
Hynek Schlawack 617e443cef Use a docs-requirements.txt for RTD 2017-05-16 18:24:48 +02:00
Hynek Schlawack b988a85895 Pin sphinx to <1.6
1.6.1 fails with very confusing errors.  At this point not even sure it's our
fault.
2017-05-16 18:15:11 +02:00
Hynek Schlawack 96fc8cb815 Stop living in the past
...and move all aux tests to 3.6.
2017-03-04 07:52:33 +01:00
Hynek Schlawack 10cd1950cb We have a logo! 2017-02-20 13:41:20 +01:00
Tin Tvrtković 0d3cf3f624 Evolve and docs. (#135)
assoc is now deprecated in favor of evolve.
2017-01-21 17:11:45 +01:00
Hynek Schlawack cdfac7c400 Only run py27 and py35 under coverage
Hypothesis & Coverage together are a handbrake.
2016-09-12 07:54:22 +02:00
Hynek Schlawack adfdbf9560 Stop using deprecated APIs (#86)
Also use nicer exceptions that subclass the old ones.
2016-09-10 19:14:34 +02:00
Hynek Schlawack dd36808a5a Don't run PyPy under coverage
It's too slow and keeps breaking the tests.
2016-09-05 14:50:08 +02:00
Hynek Schlawack e833e0c1cd coverage 4.2 doesn't need a coverage erase anymore 2016-07-31 14:43:02 +02:00
Tin Tvrtković d10e5c41d6 asdict - propagate dict_factory properly (#45)
* asdict - propagate dict_factory properly. Hypothesis tests.

* Disable Hypothesis health checks on Travis/PyPy.

* Tox - pass the HYPOTHESIS_PROFILE environment variable.

* Shut up pytest again.
2016-06-02 15:40:15 -07:00
Tin Tvrtkovic f3ee6da7fc Try fixing Travis by removing a tox comment. 2016-05-16 22:55:55 +02:00
Hynek Schlawack 38bd2a7d0d Fix coverage reporting for Python 2 2016-02-20 09:40:26 +01:00
Hynek Schlawack 89b542331d Drop support for legacy Python versions
Keep 2.7 and PyPy though.
2016-02-17 12:51:02 +01:00
Hynek Schlawack 27cc283bed readme has been renamed 2016-01-06 14:03:55 +01:00
Hynek Schlawack 1f66134c0e Janitoring 2015-12-19 13:05:30 +01:00
Hynek Schlawack e6a2b99cd8 More janitoring 2015-12-08 16:00:06 +01:00
Hynek Schlawack 5d66e482d8 Repo janitoring 2015-12-08 15:47:03 +01:00
Hynek Schlawack 4c085a7dda Allow for posargs in tox 2015-10-18 11:53:46 +02:00
Hynek Schlawack a0c74621e8 Minor style 2015-10-16 15:18:18 +02:00