Skip to content
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

Python 3.8, 3.10, and 3.12 support #404

Merged
merged 4 commits into from
Sep 25, 2024
Merged

Python 3.8, 3.10, and 3.12 support #404

merged 4 commits into from
Sep 25, 2024

Conversation

mahnunchik
Copy link
Contributor

I'm working on adding support for python 3.8, 3.10, and 3.12.

Motivation: Home Assistant addon uses python 3.11, so I decided to make mqtt-io working with latest 3.12 too.

I successfully upgraded to 3.10. But to work on 3.12, I had to update pylint and mypy packages. I fixed most of the lint errors but I need a help to figure it out last two errors:

poetry run mypy --show-error-codes --strict --no-warn-unused-ignores mqtt_io
mqtt_io/modules/gpio/gpiozero.py:99: error: Argument 1 has incompatible type "bool"; expected "list[Any]"  [arg-type]
mqtt_io/modules/gpio/gpiozero.py:101: error: Argument 1 has incompatible type "bool"; expected "list[Any]"  [arg-type]
Found 2 errors in 1 file (checked 61 source files)

Sources:

self._in_pins[pin].when_activated = partial(callback, True)
if edge in (InterruptEdge.BOTH, InterruptEdge.FALLING):
self._in_pins[pin].when_deactivated = partial(callback, False)

CI: https://github.com/mahnunchik/mqtt-io/actions/runs/11000870597

@mahnunchik
Copy link
Contributor Author

@flyte @mschlenstedt @BenjiU could you please help me to solve last two issues with mypy linting.

@mahnunchik
Copy link
Contributor Author

@flyte @mschlenstedt @BenjiU I was able to resolve the last type validation error: to support any list of arguments Callable should have signature [Callable[..., None]] instead of Callable[[List[Any], Dict[Any, Any]].

Summary of this PR:

  • mypy updated to support python 3.11+
  • pylint updated to support python 3.9+
  • backoff updated to support typing out of the box
  • Updated github action
  • Many typing fixes

I'd like to request to review my PR.

@mahnunchik mahnunchik mentioned this pull request Sep 25, 2024
Copy link
Collaborator

@BenjiU BenjiU left a comment

Choose a reason for hiding this comment

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

Thanks for this great contribution

@BenjiU BenjiU merged commit 4191b17 into flyte:develop Sep 25, 2024
6 checks passed
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