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

Replace deprecated attrs "cmp" argument #20

Merged
merged 2 commits into from
Dec 16, 2019

Conversation

rayjolt
Copy link
Contributor

@rayjolt rayjolt commented Dec 15, 2019

The "cmp" argument was deprecated in attrs 19.2.0 in favour of "eq" (see
the changelog at [1]), so switch to using "eq" and update the minimum
required attrs version.

At the moment, several deprecation warnings are displayed when running
the tests. This pull request fixes all of those warnings.

[1] https://www.attrs.org/en/stable/changelog.html

@rayjolt
Copy link
Contributor Author

rayjolt commented Dec 15, 2019

It seems that the attrs MyPy stubs are picky about what overloads are allowed for attrib(). I'll see if I can find something that works.

@rayjolt
Copy link
Contributor Author

rayjolt commented Dec 15, 2019

I've worked out the immediate reason for the failure - the "eq" parameter isn't included in the overrides listed in the error message. However, in the stub file for the version of attrs listed in poetry.lock - 19.3.0 - both the "eq" and "order" parameters are included. I guess pre-commit must somehow be using an older version of attrs, but I'm not sure exactly how that works.

@rayjolt
Copy link
Contributor Author

rayjolt commented Dec 15, 2019

I just tried using the latest version of MyPy (0.750) locally, and that works fine. Just updating MyPy to 0.750 in .pre-commit-config.yaml doesn't work though. It must be the attrs stub file that is out of date, but I haven't worked out where MyPy is getting it from yet.

The "cmp" argument was deprecated in attrs 19.2.0 in favour of "eq" (see
the changelog at [1]), so switch to using "eq" and update the minimum
required attrs version.

We also need to update the attrs version that MyPy depends upon in the
pre-commit config, so while we are at it update the other pre-commit
package versions as well.

[1] https://www.attrs.org/en/stable/changelog.html
@rayjolt
Copy link
Contributor Author

rayjolt commented Dec 15, 2019

Solved it by manually specifying the attrs version in the pre-commit config.

@ducminh-phan ducminh-phan added this to the v1.0.2 milestone Dec 16, 2019
@ducminh-phan ducminh-phan merged commit ec19f9c into ducminh-phan:develop Dec 16, 2019
@rayjolt rayjolt deleted the attrs-cmp-warning branch December 17, 2019 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants