feat(Python): add ruff + pyright and complete type annotations#1366
Merged
Conversation
…otations Add [tool.ruff] (E/F/I/UP/B, line-length 120) and [tool.pyright] (strict) to the maafw Python binding and finish the package's type annotations so both pass clean (pyright strict: 735 -> 0 errors; ruff: clean). This lets projects depending on maafw run pyright in strict mode with no errors leaking from the binding's public API. Notable changes: - define.py: add __all__; typed empty-literal default_factory - job.py: Job/JobWithResult are now Generic[TResult], so Tasker.post_task(...).get() returns Optional[TaskDetail] precisely (the key fix enabling downstream strict) - parameterize bare dict/list; type ctypes callbacks, holders, decorators - pipeline.py: cast() at the JSON-deserialization boundary - ctypes c_char_p callback params -> bytes; FUNCTYPE annotations -> Any - .vscode/settings.json: Python formatter switched to Ruff (matches pyproject) - .gitignore: ignore .venv/ and .ruff_cache/ Documented relaxations in pyproject.toml: reportPrivateUsage=none for the intentional cross-module _handle FFI coupling; per-file F403/F405 ignore for the define.py aggregation hub (consumed via `from .define import *`).
Contributor
There was a problem hiding this comment.
Sorry @Windsland52, your pull request is larger than the review limit of 150000 diff characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add [tool.ruff] (E/F/I/UP/B, line-length 120) and [tool.pyright] (strict) to the maafw Python binding and finish the package's type annotations so both pass clean (pyright strict: 735 -> 0 errors; ruff: clean). This lets projects depending on maafw run pyright in strict mode with no errors leaking from the binding's public API.
Notable changes:
Documented relaxations in pyproject.toml: reportPrivateUsage=none for the intentional cross-module _handle FFI coupling; per-file F403/F405 ignore for the define.py aggregation hub (consumed via
from .define import *).