-
Notifications
You must be signed in to change notification settings - Fork 512
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
Add more type annotations in PKB #5236
Comments
@jellyfishcake Could you please assign me this issue? I'd also appreciate any insights or suggestions on where I should start |
Assigned. I just start with the /linux_benchmark files or /linux_packages files. |
@jellyfishcake I am currently working on adding type annotations for the |
@jellyfishcake How do i build the intuition that this |
|
well i got this from the same |
@jellyfishcake I had the file |
Add more type annotations to almost any file in PKB. Python is by default untyped, but optional type annotations add clarity & help detect errors.
Some files like https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/providers/gcp/vertex_ai.py already have type annotations. Many have some annotations but are also missing some.
See https://docs.python.org/3/library/typing.html for more information & examples of type annotations.
After adding type annotations, use pytype to check if annotations are correct or break anything. See here for install instructions:
https://github.com/google/pytype
But the short version is
pip install pytype
pytype _file.py
will output if the file has any errors after adding the type annotations
Some classes could also use attribute lists like:
class VertexAiModelSpec(managed_ai_model_spec.BaseManagedAiModelSpec):
"""Spec for a Vertex AI model.
Attributes:
env_vars: Environment variables set on the node.
serving_container_command: Command run on container to start the model.
serving_container_args: The arguments passed to container create.
"""
def init():
self.container_image_uri: str
self.model_bucket_suffix: str
self.serving_container_command: list[str]
The text was updated successfully, but these errors were encountered: