QuTech-Delft / OpenSquirrel

A flexible (Python-based) quantum program compiler
Apache License 2.0
5 stars 2 forks source link

166 type hinting #173

Closed S-Linde closed 3 months ago

S-Linde commented 4 months ago

This pull request contains:

closes #166 and #199

S-Linde commented 3 months ago

Great work, Stan!

Just a comment: maybe better to use List and Tuple from typing? Than list and tuple.

I've got errors with Python 3.8 this afternoon because of using list.

I specifically used list over List from typing as that version is depricated (see).

This indeed is not immediately compatible with python3.8. However, in 99% of the cases this can be solved by adding from __future__ import annotations at the top of the file. I though I put this on the top of all relevant files, but I might have missed some. I'll take a closer look later this week.

rturrado commented 3 months ago

Great work, Stan! Just a comment: maybe better to use List and Tuple from typing? Than list and tuple. I've got errors with Python 3.8 this afternoon because of using list.

I specifically used list over List from typing as that version is depricated (see).

This indeed is not immediately compatible with python3.8. However, in 99% of the cases this can be solved by adding from __future__ import annotations at the top of the file. I though I put this on the top of all relevant files, but I might have missed some. I'll take a closer look later this week.

Oh wow, good catch. I am gonna file the replacement of List to list as a new issue. Thanks!

S-Linde commented 3 months ago

Hi Stan,

Is this ready to go?

I don't know why I still see refrences to squirrel_ir, and a parser/libqasm/libqasm_ir_creator.py file in the Files changed section.

Thanks!

It's almost ready. I'm trying to add a github action for mypy as well. If I get that to work, than it's done

S-Linde commented 3 months ago

Hi Stan, Is this ready to go? I don't know why I still see refrences to squirrel_ir, and a parser/libqasm/libqasm_ir_creator.py file in the Files changed section. Thanks!

It's almost ready. I'm trying to add a github action for mypy as well. If I get that to work, than it's done

Done