Skip to content

refactor: Explicitly add proj_root to FlowCfg#150

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

refactor: 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

@rswarbrick rswarbrick commented Apr 2, 2026

This gets loaded up from the hjson file (and nothing will work if it's missing). This commit tweaks things so that we check the field has been loaded.

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.

@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.

This gets loaded up from the hjson file (and nothing will work if it's
missing). This commit tweaks things so that we check the field has
been loaded.

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 force-pushed the proj-root-in-flow-cfg branch from 0082fcd to 30814c6 Compare April 3, 2026 22:02
@rswarbrick rswarbrick changed the title Explicitly add proj_root to FlowCfg refactor: Explicitly add proj_root to FlowCfg Apr 3, 2026
@rswarbrick
Copy link
Copy Markdown
Contributor Author

Thanks for the review, @AlexJones0. Does the check look more reasonable now?

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