-
Notifications
You must be signed in to change notification settings - Fork 35
Missing Type Annotations #78
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
Comments
Submitted PR #87 to address |
closed by #87 |
@FoamyGuy while working on #94 I saw there are still 42 mypy errors in To reproduce, you can apply this diff to the pre-commit config on diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 1b9fadc..f6745f9 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -40,3 +40,10 @@ repos:
files: "^tests/"
args:
- --disable=missing-docstring,consider-using-f-string,duplicate-code
+- repo: https://github.com/pre-commit/mirrors-mypy
+ rev: v0.930
+ hooks:
+ - id: mypy
+ files: ^(adafruit_requests.py)
+ additional_dependencies:
+ - types-ujson and then run:
I saw that the number of errors decreases to 42 after #94. |
@kevincon thanks for the heads up. It is okay for the library not to completely pass mypy testing at this point. The main ones that we are looking to take care with the current effort are the "function missing type annotation" warnings. We have not added mypy to the CI checks yet. When the time comes to do that (once we have most of the typing "low hanging fruit" done accross all libraries) then we'll have a discussion amongst the team to determine what settings and configuration we'll use for mypy when we add it to CI which may change which specific mypy warnings and how many of them we'll see on any given library. |
There are missing type annotations for some functions in this library.
The
typing
module does not exist on CircuitPython devices so the import needs to be wrapped in try/except to catch the error for missing import. There is an example of how that is done here:Once imported the typing annotations for the argument type(s), and return type(s) can be added to the function signature. Here is an example of a function that has had this done already:
If you are new to Git or Github we have a guide about contributing to our projects here: https://learn.adafruit.com/contribute-to-circuitpython-with-git-and-github
There is also a guide that covers our CI utilities and how to run them locally to ensure they will pass in Github Actions here: https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/check-your-code In particular the pages:
Sharing docs on ReadTheDocs
andCheck your code with pre-commit
contain the tools to install and commands to run locally to run the checks.If you are attempting to resolve this issue and need help, you can post a comment on this issue and tag both @FoamyGuy and @kattni or reach out to us on Discord: https://adafru.it/discord in the
#circuitpython-dev
channel.The following locations are reported by mypy to be missing type annotations:
The text was updated successfully, but these errors were encountered: