The Wayback Machine - https://web.archive.org/web/20201127231453/https://github.com/python-attrs/attrs/issues/598
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No mention of how to use eq/order in narrative docs #598

Open
wsanchez opened this issue Nov 12, 2019 · 5 comments
Open

No mention of how to use eq/order in narrative docs #598

wsanchez opened this issue Nov 12, 2019 · 5 comments
Labels

Comments

@wsanchez
Copy link

@wsanchez wsanchez commented Nov 12, 2019

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.

@wsanchez
Copy link
Author

@wsanchez wsanchez commented Nov 12, 2019

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)
@euresti
Copy link
Contributor

@euresti euresti commented Nov 12, 2019

Hi. There are 2 issues here.

  1. That error shouldn't have been there. It's just deprecated not an error. This has been fixed on mypy master.
  2. 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?

@hynek
Copy link
Member

@hynek hynek commented Nov 12, 2019

By stubs you mean stubs in typeshed? Is that for us to decide?

@wsanchez
Copy link
Author

@wsanchez wsanchez commented Nov 12, 2019

@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.

@euresti
Copy link
Contributor

@euresti euresti commented Nov 12, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.