-
-
Notifications
You must be signed in to change notification settings - Fork 118
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
Add slotscheck #1233
Add slotscheck #1233
Conversation
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!
@@ -73,6 +80,7 @@ flake8-pyi = "^20.10" | |||
# correctly with Python 3.10. That lib is a dependency of `nitpick`! | |||
nitpick = { version = "^0.29", python = "<3.10" } | |||
codespell = "^2.1" | |||
slotscheck = "^0.5.1" |
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.
slotscheck = "^0.5.1" | |
slotscheck = "^0.5" |
require-subclass = true | ||
require-superclass = true | ||
exclude-modules = 'returns\.contrib\.mypy' | ||
exclude-classes = 'returns\.primitives\.exceptions:UnwrapFailedError' |
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.
Why do we exclude it? 🤔
I think it has __slots__
: https://github.com/dry-python/returns/blob/master/returns/primitives/exceptions.py#L12
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.
BaseException
(Python stdlib) doesn't have slots (see questions in 'open questions' in top comment)
Let's go with
I think having a |
|
Codecov Report
@@ Coverage Diff @@
## master #1233 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 79 79
Lines 2434 2434
Branches 211 211
=========================================
Hits 2434 2434 Continue to review full report at Codecov.
|
@ariebovenberg it is unrelated, I broke it recently somehow (sphinx 😒 ). Fix in a separate PR is highly appreciated. |
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 again!
An issue is a start: #1234 |
I have made things!
@sobolevn kindly invited me to add slotscheck to the CI.
Checklist
I have created at least one test case for the changes I have maden/aCHANGELOG.md
Related issues
related: #1147, #1144
Open questions
test_slots.py
. This meansreturns.contrib.mypy
is not checked. We can either:a) add slots to
mypy
plugin classesb) keep the current ignore
c) run
slotscheck
on this part of the code with more relaxed settings (there is an issue open multi-setting support if you have an opinion)UnwrapFailedError
class reports an error. This is becauseBaseException
actually has a__dict__
. We can either:a) remove slots from
UnwrapFailedError
b) keep the current ignore