Commit Graph

93 Commits

Author SHA1 Message Date
Hynek Schlawack a18b3957d5
Add support for Python 3.11 (#969)
* Add support for Python 3.11

Co-authored-by: Tin Tvrtković <tinchester@gmail.com>

* Tin/py311 (#973)

* Fix test_slots::TestPickle::test_no_getstate_setstate_for_dict_classes

* Fix annotations

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Tweak tests for 3.10

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Tweak tests some more

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

Co-authored-by: Tin Tvrtković <tinchester@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-06-24 11:37:40 +02:00
Hynek Schlawack 0f08b84f3f Unpin towncrier & update template 2022-04-07 07:25:20 +02:00
Hynek Schlawack 980c8b04f5
Drop Python 2.7 (#936)
* Drop Python 2.7

The tooling situation around Python 2 has deteriorate to such a degree that
upholding compatibility is not tenable anymore for a volunteer-run project.

Signed-off-by: Hynek Schlawack <hs@ox.cx>

* Add newsfragment

* Run Python 3.5 under coverage to make up for Python 2.7

* Wait for py35 in parallel

* Remove fullmatch kludge

* Remove Python 2-specific code

* Revert empty slot test

Also disable pyupgrade on that file.

Signed-off-by: Hynek Schlawack <hs@ox.cx>

* We DO run under 3.5

* Remove __qualname__ workarounds

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update changelog.d/936.breaking.rst

Co-authored-by: Tin Tvrtković <tinchester@gmail.com>

* Compare methods using is

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tin Tvrtković <tinchester@gmail.com>
2022-03-21 08:47:47 +01:00
Hynek Schlawack 9f09614678 Block mypy 0.940
It breaks test_mypy.

See also https://github.com/python/mypy/issues/12339
2022-03-14 15:07:19 +01:00
Hynek Schlawack 45c263755f Move docs to 3.10 2021-11-29 09:04:06 +01:00
Hynek Schlawack 649a196877 Shuffle tox environments and Python versions a bit 2021-11-23 09:49:41 +01:00
Hynek Schlawack 675afb8f73 Don't run pre-commit in CI
We've got pre-commit.ci which is much better and faster.
2021-11-20 16:20:07 +01:00
Hynek Schlawack 9bb97cb58e
Repo Janitoring (#868)
* Use proper pypy versions

* Python 3.10 as main, better/more expressive names

Signed-off-by: Hynek Schlawack <hs@ox.cx>

* Ditch Codecov

Signed-off-by: Hynek Schlawack <hs@ox.cx>

* Don't need this anymore

* Streamline tox.ini

Signed-off-by: Hynek Schlawack <hs@ox.cx>
2021-11-19 14:51:46 +01:00
Hynek Schlawack 322e1904c1 Move docs to 3.8
This is the latest version currently supported by RTD.
2021-11-11 05:58:46 +01:00
Hynek Schlawack 2ca7aada70 Run pypy on pypy2 2021-08-07 08:53:10 +02:00
David Euresti fb154878eb
Fix mypy tests on 3.10 (#771)
Looks like this was a bug fixed upstream
2021-06-14 17:58:33 +00:00
Hynek Schlawack 6731eea0ed
Run Python 3.10 under coverage (#818)
Since the matching code is Python 3.10-specific, we run it under coverage.
2021-05-18 11:28:21 +02:00
Karthikeyan Singaravelan 8613af97bb
Add __match_args__ to support match case destructuring in Python 3.10 (#815)
* Add support to generate __match_args__ for Python 3.10.

* Add versionadded directive.

* Update stubs.

* Update changelog and add a test to typing examples.

* Fix error regarding new-style classes in Python 2.

* Fix lint error regarding line length.

* Fix lint error regarding trailing whitespace.

* Add docstrings for interrogate.

* Use _has_own_attribute instead of cls.__dict__ contains check.

* Update docs as per review comments.

* Revert mistaken changelog update.

* Add Python 3.10 pattern matching syntax test cases.

* Update define signature with match_args.

* Fix conftest formatting.

* Fix isort formatting.

* Bump to Python 3.10 to parse syntax.

* Bump basepython of lint to Python 3.10 for parsing.

* Move lint to py310

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2021-05-18 07:02:06 +02:00
Hynek Schlawack c5ae43f7f2 Pin towncrier
Currently the title is either not rendered at all, or rendered twice

cf.

- https://github.com/twisted/towncrier/issues/346
- https://github.com/twisted/towncrier/issues/340
2021-05-06 10:16:57 +02:00
Hynek Schlawack f41db43541 Unpin pyright & minor docs polish
ref #796
2021-05-05 16:06:09 +02:00
Alex Ford 7e372c56a2
Implement pyright support via dataclass_transforms (#796)
* Add __dataclass_transform__ decorator.

* Add doc notes for pyright dataclass_transform support.

* Fix docs build error.

* Expand docs on dataclass_transform

* Add changelog

* Fix docs build

* Fix lint

* Add note on __dataclass_transform__ in .pyi

* Add baseline test of pyright support via tox

* Add pyright tests to tox run configuration

* Fix test errors, enable in tox.

* Fixup lint

* Move pyright to py39

* Add test docstring.

* Fixup docs.

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2021-05-05 10:24:53 +02:00
Hynek Schlawack 03d3fc7a71
Add Python 3.10 support (#763)
* Add Python 3.10 support

Python 3.10 has string types everywhere and that has unmasked a bunch of
bugs/edge cases in our code.

Especially the hooks code need a resolving helper for string types. I'm leaving
that for a separate PR.

Fixes #716

* More robust quote handling

* Use resolve_types decorator where possible

* Use a helper for __init__ annotations

* Add test for various ClassVars
2021-02-22 12:56:44 +01:00
Hynek Schlawack 68b5e048da mypy has caught up! Uncomment NG type tests 2021-01-29 10:29:17 +01:00
Hynek Schlawack 48755905ee
Don't reset custom __setattr__ in slotted classes (#681)
* Don't reset custom __setattr__ in slotted classes

Fixes #680

Signed-off-by: Hynek Schlawack <hs@ox.cx>

* Simplify

Signed-off-by: Hynek Schlawack <hs@ox.cx>

* Be defensive about __bases__

Signed-off-by: Hynek Schlawack <hs@ox.cx>

* _Classes_ always have a __dict__

* Tighten xfail

* Clarify what need to be reset and when

Signed-off-by: Hynek Schlawack <hs@ox.cx>

* Reset __attrs_own_setattr__ along with __setattr__

Signed-off-by: Hynek Schlawack <hs@ox.cx>

* Update src/attr/_make.py

Co-authored-by: Paul Ganssle <paul@ganssle.io>

* Differentiate between own (= attrs) and custom (= user) __setattrs__

Signed-off-by: Hynek Schlawack <hs@ox.cx>

* We've always used __bases__ in our call to type()

So no reason for being defensive.

* Update tests/test_setattr.py

Co-authored-by: Paul Ganssle <paul@ganssle.io>

Co-authored-by: Paul Ganssle <paul@ganssle.io>
2020-09-05 09:46:06 +02:00
Hynek Schlawack 1f67eefb4f Use pre-commit for interrogate 2020-08-25 12:37:54 +02:00
Hynek Schlawack 3a5b5a2052 Use interrogate's pyproject.toml support 2020-08-25 09:54:28 +02:00
Hynek Schlawack d4150f2114
Run CI against 3.9 pre-release (#664) 2020-08-13 13:58:58 +02:00
Hynek Schlawack 2f6fd8516c
Add on_setattr hooks to attr.s and attr.ib (#660)
* Add on_setattr hooks to attr.s and attr.ib

Signed-off-by: Hynek Schlawack <hs@ox.cx>

* Add PR newsfragment

* Fix attr.s doc sig

* Make _DisableType private

* Mark setters.frozen as NoReturn

* Rename setters.DISABLE to setters.NO_OP to clarify its purpose

DISABLE sounds less purposeful and doesn't convey its meaning as well.

* Fix type

* Loosen up type for convert even further

* Tighten type a tiny bit
2020-07-20 12:43:10 +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 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 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 495968281c
Officially drop Python 3.4 (#608) 2020-01-06 12:32:28 +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 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 0023e5bdce Ah, why not. pytest & tox are related 2019-10-17 12:46:22 +02:00
Hynek Schlawack 7b49d375c7 Rename _version.py into _version_info.py
Makes a lot more sense.
2019-10-02 16:12:03 +02:00
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