Add the proxystore.mypy mypy plugin for resolving Proxy[T] types
#545
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.
Description
Adds the
proxystore.mypy_pluginmypy plugin that helps mypy determine the types of attributes and methods accessed on aProxy[T].The plugin can be enabled within the mypy config. For example, in
pyproject.toml:I used a lot of resources to figure this out that may be helpful to later attempts at similar plugins:
Fixes
Type of Change
Testing
Testing is a bit different here. Because mypy is a static analysis tool, I've added tests which check types using
assert_typefor "good" andtype: ignore[...]for "bad".This means that the tests when run with pytest are essentially no-ops and will always pass even if the mypy plugin is altered. By running mypy/pre-commit should catch the errors. Additionally, the
proxystore.mypy_pluginmodule is excluded from coverage. This could be fixed in the future but would require the test suite to measure coverage over multiple tests.Pull Request Checklist
Please confirm the PR meets the following requirements.
pre-commit(e.g., mypy, ruff, etc.).