-
Notifications
You must be signed in to change notification settings - Fork 553
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
rptest: more typing 1 #15993
rptest: more typing 1 #15993
Conversation
No runtime changes here, only additional type hints or modifications of existing type hints so it should be completely safe. |
@@ -4240,10 +4240,10 @@ def estimate_bytes_written(self): | |||
def make_redpanda_service(context: TestContext, | |||
num_brokers: Optional[int], | |||
*, | |||
cloud_tier: Optional[str] = None, | |||
cloud_tier: CloudTierName | None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PEP-484 recommended approach is Type | None
instead of Optional[Type]
.
new failures in https://buildkite.com/redpanda/redpanda/builds/43562#018cea0a-f34a-4b31-857b-7aac95e23c5c:
new failures in https://buildkite.com/redpanda/redpanda/builds/43562#018cea0a-f350-4899-bdfe-d6ce76ad1472:
|
Add more typing to some rptest infra. The start of a long journey.
ca5c01e
to
227f6cf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM on green
@travisdowns is this PR part of a desire to be more strict on python type hinting for all python in the repo? if so, perhaps we should have a gha to run mypy:
|
@andrewhsu wrote:
Yes, sort of, but focused on DT. I think types are very useful for a relatively large thing like our DT suite. It has the highest value for the "frameworky" parts like the service classes and helper methods, since they are widely used and once types are added in there they tend to propagate around to the calling code and make more analysis possible.
Absolutely, that would be my longer-term desired if everyone is on board. A ways to go before most files run clean in mypy. In the meantime it still provides a fair amount of value in IDEs etc. In parallel I'm typing ducktape package code itself using stubs (pyi files) which is needed to get good results here since we use so many ducktape methods. I'll send some of that up in a PR at some point too. |
Add more PEP-484 typing to some rptest infra.
The start of a long journey.
Backports Required
Release Notes