Skip to content

feat: Add debug info metadata specification in hugr-py#2971

Open
tatiana-s wants to merge 2 commits intomainfrom
ts/py-debug-info
Open

feat: Add debug info metadata specification in hugr-py#2971
tatiana-s wants to merge 2 commits intomainfrom
ts/py-debug-info

Conversation

@tatiana-s
Copy link
Contributor

@tatiana-s tatiana-s commented Mar 19, 2026

@tatiana-s tatiana-s changed the title feat: Add debug info metadata specification feat: Add debug info metadata specification in hugr-py Mar 20, 2026
@codecov
Copy link

codecov bot commented Mar 20, 2026

Codecov Report

❌ Patch coverage is 77.27273% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.86%. Comparing base (0a5664d) to head (6b0358e).

Files with missing lines Patch % Lines
hugr-py/src/hugr/debug_info.py 74.02% 20 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2971      +/-   ##
==========================================
- Coverage   83.87%   83.86%   -0.02%     
==========================================
  Files         268      269       +1     
  Lines       52945    53031      +86     
  Branches    46857    46857              
==========================================
+ Hits        44410    44476      +66     
- Misses       6266     6286      +20     
  Partials     2269     2269              
Flag Coverage Δ
python 88.67% <77.27%> (-0.17%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cqc-alec
Copy link
Collaborator

Moved from Quantinuum/guppylang#1554

Can you explain what has been moved from that PR?

@cqc-alec
Copy link
Collaborator

Moved from Quantinuum/guppylang#1554

Can you explain what has been moved from that PR?

Ah nevermind, I just saw the comment.

@@ -0,0 +1,152 @@
"""Typed generator source debug information metadata for HUGR nodes."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

This docstring is hard for me to parse, can you reword?

return DICompileUnit(
directory=str(value["directory"]),
filename=int(value["filename"]),
file_table=list[str](value["file_table"]),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
file_table=list[str](value["file_table"]),
file_table=list[str](files),

}
# Declarations have no function body so could have no scope_line.
if self.scope_line is not None:
data["scope_line"] = str(self.scope_line)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
data["scope_line"] = str(self.scope_line)
data["scope_line"] = int(self.scope_line)

line_no: int # First line of the function definition.
scope_line: int | None = None # First line of the function body.

def to_json(self) -> dict[str, str]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should be dict[str, JsonType]?

column: int
line_no: int

def to_json(self) -> dict[str, str]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should be dict[str, JsonType]?

Comment on lines +139 to +140
"column": str(self.column),
"line_no": str(self.line_no),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"column": str(self.column),
"line_no": str(self.line_no),
"column": int(self.column),
"line_no": int(self.line_no),

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