Skip to content

Explicitly add proj_root to FlowCfg#150

Open
rswarbrick wants to merge 1 commit intolowRISC:masterfrom
rswarbrick:proj-root-in-flow-cfg
Open

Explicitly add proj_root to FlowCfg#150
rswarbrick wants to merge 1 commit intolowRISC:masterfrom
rswarbrick:proj-root-in-flow-cfg

Conversation

@rswarbrick
Copy link
Copy Markdown
Contributor

This gets loaded up from the hjson file (and nothing will work if it's missing). Eventually, we need to do that more carefully, but this change is helpful because it tells pyright about the existence and type of FlowCfg.proj_root.

This will always have type str (because it gets loaded directly from an hjson file). Add an explicit cast to Path when calling the WorkspaceConfig constructor.

This gets loaded up from the hjson file (and nothing will work if it's
missing). Eventually, we need to do that more carefully, but this
change is helpful because it tells pyright about the existence and
type of FlowCfg.proj_root.

This will always have type str (because it gets loaded directly from
an hjson file). Add an explicit cast to Path when calling the
WorkspaceConfig constructor.

Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
@rswarbrick rswarbrick marked this pull request as ready for review April 2, 2026 18:42
AlexJones0
AlexJones0 previously approved these changes Apr 2, 2026
Copy link
Copy Markdown
Contributor

@AlexJones0 AlexJones0 left a comment

Choose a reason for hiding this comment

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

This looks reasonable to me, but it's kind of a change to please the type checker instead of a change to fix the issue the type checker is telling us about. The useful aspect of the previous behaviour that is now gone is that a missing proj_root would not give cryptic errors. Perhaps whilst everything is still not cleanly defined we should add an if not self.proj_root: raise ValueError(...) statement right after calling self._expand in FlowCfg.__init__ just to avoid this potential head-scratcher?

Note also that in #139 (merged earlier today), I made an explicit reference to self.proj_root on the base flow anyway, right at the point I am mentioning.

@AlexJones0 AlexJones0 self-requested a review April 2, 2026 21:17
@AlexJones0 AlexJones0 dismissed their stale review April 2, 2026 21:18

Hit the wrong button, meant to be a comment.

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.

2 participants