Skip to content

docs: Add section to explain Guppy type checker errors and fixes#120

Merged
hsemenenko merged 2 commits into
mainfrom
hs/using-mypy
Jun 1, 2026
Merged

docs: Add section to explain Guppy type checker errors and fixes#120
hsemenenko merged 2 commits into
mainfrom
hs/using-mypy

Conversation

@hsemenenko
Copy link
Copy Markdown
Contributor

No description provided.

@hsemenenko hsemenenko requested a review from CalMacCQ as a code owner May 26, 2026 10:25
Copy link
Copy Markdown
Collaborator

@CalMacCQ CalMacCQ left a comment

Choose a reason for hiding this comment

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

Looks good to me. There's a C.I. error that should be easy enough to resolve by annotating cells as skip-execution] appropriately.

Also do you think this would make sense to include in the static compilation and type checking section rather than FAQs?

Comment thread sphinx/faqs.md
For example, using `@ owned` annotations in function signatures,

```{code-cell} ipython3
@guppy
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Seems this cell needs to import owned in order to excute.

If you don't want a specific cell to be executed you can add this skip-execution metadata like so.

```{code-cell} ipython3
---
tags: [skip-execution]
---

@guppy
def foo(q: qubit @owned) -> None: ...

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Strangely I cannot reproduce the C.I. error locally which is puzzling

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's strange, I tested locally and it was fine. I'll add the skip-execution tag as it's not necessary for these to run.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Change my mind and imported owned to be explicit.

Comment thread sphinx/faqs.md
N = guppy.nat_var("N")

@guppy
def foo(arr: array[qubit, N]) -> None:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Image

Is there something we should say about non-generic array sizes?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ah this is a pylance thing rather than mypy.

@hsemenenko hsemenenko requested a review from CalMacCQ June 1, 2026 11:27
@hsemenenko hsemenenko merged commit ae482ae into main Jun 1, 2026
3 checks passed
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