No mention of how to use eq/order in narrative docs
I'm getting a new handy error from mypy:
src/ims/application/_main.py:74:2: error: cmp is deprecated, use eq and order [misc]
In order to make sure I'm using those correctly, I went to attrs.org and looked for some documentation on these new options, but I see no mention of either of the eq or order options, except for some mentions of eq in the section on hashing.
With a deprecation notice like this, a link to some documentation for how to fix your code would be very helpful.
Changing cmp=False to eq=False gives me a more glorious error:
src/ims/application/_main.py:74:2: error: No overload variant of "attrs" matches argument types "bool", "bool", "bool", "bool" [call-overload]
@attrs(frozen=True, auto_attribs=True, kw_only=True, eq=False)
^
src/ims/application/_main.py:74:2: note: Possible overload variants:
src/ims/application/_main.py:74:2: note: def [_C <: type] attrs(maybe_cls: _C, these: Optional[Dict[str, Any]] = ..., repr_ns: Optional[str] = ..., repr: bool = ..., cmp: bool = ..., hash: Optional[bool] = ..., init: bool = ..., slots: bool = ..., frozen: bool = ..., weakref_slot: bool = ..., str: bool = ..., auto_attribs: bool = ..., kw_only: bool = ..., cache_hash: bool = ..., auto_exc: bool = ...) -> _C
src/ims/application/_main.py:74:2: note: def attrs(maybe_cls: None = ..., these: Optional[Dict[str, Any]] = ..., repr_ns: Optional[str] = ..., repr: bool = ..., cmp: bool = ..., hash: Optional[bool] = ..., init: bool = ..., slots: bool = ..., frozen: bool = ..., weakref_slot: bool = ..., str: bool = ..., auto_attribs: bool = ..., kw_only: bool = ..., cache_hash: bool = ..., auto_exc: bool = ...) -> Callable[[_C], _C]
Found 14 errors in 12 files (checked 1 source file)
Hi. There are 2 issues here.
- That error shouldn't have been there. It's just deprecated not an error. This has been fixed on mypy master.
- The attrs stubs that are shipped with mypy are old. You should install attrs into the environment from which you run mypy.
I don't know what to do about 2. We could update the stubs or we could delete them. Anybody have opinions?
By stubs you mean stubs in typeshed? Is that for us to decide?
@euresti For #2, should it be enough to simply install attrs? In Tox, I turned off skip_install so that dependencies are installed:
wsanchez$ ./.tox/mypy/bin/pip freeze | grep '^attrs'
attrs==19.1.0
…but I still get the same errors. And it's fixed if I update to attrs==19.3.0.
Leaving this comment here for the next developer's benefit.
I think it's for us to decide. We decided to give me permission to add the stubs to attrs. :)
eq and order are new in 19.3(?) so it makes sense that it would fail unless you add them.