Commit Graph

6 Commits

Author SHA1 Message Date
Hynek Schlawack 7373d88f9b
Restore basic functionality on 3.14[sic] (#1329)
* Restore basic functionality on 3.14[sic]

Essentially switch to PEP 649 / 749 for annotations. Some tests need to
be skipped for now, but the rest is working.

Fixes #1326

* Add news fragment

* We have not 3.14 CI yet

* Use imprerative xfails instead of skips
2024-08-06 13:37:35 +02:00
diabolo-dan 597c3a8adb
Add support for cached_properties to slotted attrs classes. (#1200)
* Add support for cached_properties to slotted attrs classes.

* Remove locking from implementation

* Add test for multiple cached properties and fix bug

* Add changelog file

* Document slotted cached properties

* Add cached_property hypothesis check.

* Only run cached_property imports on python 3.8+

* Use cached _obj_setattr instead of `object.__setattr__`

* Correctly resolve mro for __getattr__ in cached properties

* Use _get_annotations rather than branching on class dict entry

* Optimise __getattr__ code by front loading branching, and injecting locasl variables

* Remove unnecessary `__attrs_original_getattr__` from class dictionary.

---------

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2023-12-08 18:24:25 +00: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
Michał Górny 03dd7136cf
Do not require cloudpickle for PyPy (#892)
* Do not require cloudpickle for PyPy

The cloudpickle package relies on CPython implementation details,
and does not even import on PyPy:

```
ImportError while importing test module '/tmp/attrs/tests/test_3rd_party.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/pypy3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_3rd_party.py:7: in <module>
    import cloudpickle
.tox/pypy3/lib/pypy3.8/site-packages/cloudpickle/__init__.py:4: in <module>
    from cloudpickle.cloudpickle import *  # noqa
.tox/pypy3/lib/pypy3.8/site-packages/cloudpickle/cloudpickle.py:57: in <module>
    from .compat import pickle
.tox/pypy3/lib/pypy3.8/site-packages/cloudpickle/compat.py:13: in <module>
    from _pickle import Pickler  # noqa: F401
E   ModuleNotFoundError: No module named '_pickle'
```

Disable the dependency for PyPy and make the test handle missing
cloudpickle gracefully.

* Enable testing on pypy-3.8

* add a news entry

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2021-12-29 09:43:19 +01:00
Hynek Schlawack 046beaaaaa Apply SPDX IDs 2021-12-27 09:29:09 +01:00
Hynek Schlawack cf24de8e9b Rename for clarity 2021-11-21 15:16:28 +01:00