Closed souliane closed 4 months ago
I overlooked that you already use pyright... so this is duplicating. We can close this or:
tests
folder.WDTY?
Also, I think that it should also run on the tests folder.
I'm not convinced about that. I'd say it's likely to make tests harder to write, while not necessarily make them catch more bugs. Do you have a usecase where running mypy on tests results in better code quality ?
keep the type hints that have been added and remove the mypy pre-commit hook.
I'd go for this one.
update pyright config so that it does the same as mypy strict mode
I've tried, and it complains a lot on the Yaml parser func pre_commit_config_roundtrip
. Either I'm going to cast a lot, or ignore type, but that's probably going to be ugly. ruamel.yaml
seems not very stric-type-compatible.
I've pushed my attempt to https://github.com/ewjoachim/poetry-to-pre-commit/compare/strict-pyright?expand=1
Also, I think that it should also run on the tests folder.
I'm not convinced about that. I'd say it's likely to make tests harder to write, while not necessarily make them catch more bugs. Do you have a usecase where running mypy on tests results in better code quality ?
It might not improve the runtime code, but it makes IMHO the tests easier to read, prevent some pitfalls and enables a better code analysis / autocompletion etc. in your editor.
I've pushed my attempt to https://github.com/ewjoachim/poetry-to-pre-commit/compare/strict-pyright?expand=1
Could you please double check? It seems like you forgot to push your commit, as I only see the one from this PR.
Could you please double check? It seems like you forgot to push your commit, as I only see the one from this PR.
Sorry, I meant https://github.com/ewjoachim/poetry-to-pre-commit/pull/14 and especially https://github.com/ewjoachim/poetry-to-pre-commit/pull/14/files#diff-755fbd773f19725441edb1b9a61dc22f2e846468785c65a39651d2b253f73ba9
Sorry, I meant #14 and especially https://github.com/ewjoachim/poetry-to-pre-commit/pull/14/files#diff-755fbd773f19725441edb1b9a61dc22f2e846468785c65a39651d2b253f73ba9
I don't know how to configure pyright, but it looks good - especially the github integration :-D
Well the point is: if we activate strict mode, we get the errors linked above. Do you see a way to get rid of errors that doesn't include a bunch of # type: ignore
?
Well the point is: if we activate strict mode, we get the errors linked above. Do you see a way to get rid of errors that doesn't include a bunch of
# type: ignore
?
The best I can do is here: https://github.com/souliane/poetry-to-pre-commit/commit/c21d5aeb7d13d4d08ec64103dfb37f9b38764114
I also removed mypy
from the config files. I don't like to ignore reportUnknownMemberType
globally, but this is still better than without strict mode... Another solution would be to ignore it at the top of the concerned file only with:
# pyright: reportUnknownMemberType=false
mypy strict mode actually does not trigger these errors, but if it was, we could ignore it for the ruaml
package only with something like this:
[[tool.mypy.overrides]]
module = ["ruaml"]
disable_error_code = ["import-untyped"]
Ok, I made a PR there #15
Successful PR Checklist:
PR label(s):