Skip to content

Conversation

machshev
Copy link
Collaborator

Types added to make it clearer what is going on with the job scheduling. This means the pyright/ruff LSP have more information to be able to jump to definitions and show documentation.

Copy link
Contributor

@rswarbrick rswarbrick left a comment

Choose a reason for hiding this comment

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

Lots of nitty comments, but I love the way types are getting into the core code.

item._create_deploy_objects()

def deploy_objects(self):
def deploy_objects(self) -> Mapping[Deploy, str]:
Copy link
Contributor

Choose a reason for hiding this comment

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

Definitely not for this PR (but I was reading this file...) I wonder whether this function name needs to be changed to something like get_deploy_objects or maybe whether it should be turned into a property?

At the moment, it's a bit sad that "deploy" is a verb as well as an adjective.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes makes sense, I'd like to eventually refactor the whole thing with tests.

Comment on lines 251 to 252
msg = f"Scheduler does not contain target {curr_target}"
raise KeyError(msg)
Copy link
Contributor

Choose a reason for hiding this comment

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

No big deal, but why not stick the string literal directly into the KeyError call?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because of the lint rule that complains about having f-string directly in an Exception. I've disabled the one that prevents string literals, so if it wasn't a f-string then it would not complain about it.

I don't have a strong opinion either way really. It does slightly clean up the stack trace to have the intermediate variable. But makes the code base slightly more messy.

Copy link

@hcallahan-lowrisc hcallahan-lowrisc left a comment

Choose a reason for hiding this comment

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

LGTM! Great progress so far.

Types added to make it clearer what is going on with
the job scheduling. This means the pyright/ruff LSP
have more information to be able to jump to definitions
and show documentation.

Signed-off-by: James McCorrie <[email protected]>
@machshev machshev merged commit b796d3c into lowRISC:master Oct 2, 2025
6 checks passed
@machshev machshev deleted the typing branch October 2, 2025 13:15
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.

3 participants