Skip to content

Conversation

@penguinland
Copy link
Contributor

I started looking at this due to the obvious errors in the type annotations mentioned in #23.

When I started this branch, running mypy main.py gave 150ish errors. Between this PR and viamrobotics/viam-python-sdk#846, it's down to 100ish errors. So, there's more to do, but this is at least a start. When there are no errors, we should add another CI check that running mypy (or any other type checker, if you want something else) has no errors.

@penguinland penguinland requested a review from bhaney February 11, 2025 21:51
max_value=1e5,
default_value=1e3,
max_value=100000,
default_value=1000,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This surprised me, but 1e5 is a float, not an int!

Copy link
Collaborator

@bhaney bhaney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This look good! an optional change: if Image.Image is used anywhere else in the python image.py file, I'd prefer from PIL.Image import Image to be used, so that the type annotation can just be Image. but if the type annotation is the only place it shows up, you can leave it as it is

I see we use Image.Open in this file, it's all right to keep the annotation Image.Image

@penguinland
Copy link
Contributor Author

Rebased to fix merge conflicts. Will take one last look and then merge...

@penguinland penguinland merged commit 40cecba into viam-modules:main Feb 26, 2025
@penguinland penguinland deleted the mypy branch February 26, 2025 18:48
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.

2 participants