-
Notifications
You must be signed in to change notification settings - Fork 133
Upgrade deprecated types #501
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
Conversation
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #501 +/- ##
==========================================
- Coverage 79.86% 79.85% -0.01%
==========================================
Files 187 187
Lines 16828 16822 -6
Branches 2213 2213
==========================================
- Hits 13440 13434 -6
Misses 2661 2661
Partials 727 727 ☔ View full report in Codecov by Sentry. |
|
Thanks @jscanvic for the thorough analysis and I will review this over the next couple of weeks. What do you think about using |
|
Thanks @Andrewwango! I don't know much about mypy but it seems like a neat piece of software. It'd be interesting to experiment with it and see how we could use it for the library! |
Andrewwango
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this!
So does your ruff command work?
ruff check --target-version "py39" --select "UP006"
And the the set of errors it brought up is exactly the set of errors you fix here?
If yes, then let's include it in CI!
I have moved the mypy suggestion to #536.
|
It does most of the work the only thing it does not catch is types in docstrings so I handled them manually. It's added! |
Fixes #500
From what I witnessed, black does not flag use of deprecated
typing.Ttypes, e.g.,typing.Dictinstead ofdict, but ruff does with the rule UP006.On a tangential note, maybe it'll be worth integrating a stronger linter like ruff into the CI pipeline at some point. We probably don't want to enforce all of the default rules to avoid making contributing overly painful, but for specific things I believe it might be worth having.
Find offending lines
(See ruff.txt for the output)
Fix
Apparently, ruff is able to fix the code automatically but it requires using the option
--unsafe-fixesso I'm not sure if it can be trusted. It's what I've used for this PR.After doing that, there remained occurrences of the deprecated types 1) in imports, and 2) in docstrings. I got rid of them both manually using this command to find their presence:
ruff.txt (download, excerpt below)
Checks to be done before submitting your PR
python3 -m pytest tests/runs successfully.black .runs successfully.make htmlruns successfully (in thedocs/directory).