TeamGraphix / graphix

measurement-based quantum computing (MBQC) compiler and simulator
https://graphix.readthedocs.io
Apache License 2.0
55 stars 20 forks source link

Support Python3.12 #127

Closed masa10-f closed 2 weeks ago

masa10-f commented 3 months ago

Describe the feature you'd like

Graphix currently supports Python 3.8 through 3.11. Python 3.12 was released last October, so It would be beneficial to support 3.12.

Additional context

I would like to have criteria for when to add new Python versions and when to drop older ones. It seems reasonable to me to follow the status of Python versions. Following this, we will drop the oldest next October and add the latest once released. If anyone has opinions or suggestions, please share them in this issue.

shinich1 commented 2 months ago

@masa10-f thanks, I think it might also make sense to discontinue 3.9 as well which will be end-of-life in a year or so (and according to @thierry-martinez we can have more organized code writing by restricting to 3.10+)

EarlMilktea commented 1 month ago

Can I work on this?

we can have more organized code

I suspect it's based on the match syntax. Actually it's possible to switch implementation based on version like this: (memo: it may cause black to fail, since now it's based on py38 profile.)

if sys.version_info >= (3, 9):
    TestCaseType = dict[str, dict[str, tuple[bool, dict[int, set[int]]]]]
else:
    TestCaseType = Dict[str, Dict[str, Tuple[bool, Dict[int, Set[int]]]]]
masa10-f commented 1 month ago

@EarlMilktea Thanks for you comment! I didn't know that

@shinich1 Dropping support for 3.9 seems a bit excessive because physicists do not update python versions frequently. I think updating python version is not so convinient as with other languages. Looking at other quantum software, it seems reasonable to support the latest 4 versions, and I agree with that. What do you think about?

shinich1 commented 1 month ago

@EarlMilktea Thanks for you comment! I didn't know that

@shinich1 Dropping support for 3.9 seems a bit excessive because physicists do not update python versions frequently. I think updating python version is not so convinient as with other languages. Looking at other quantum software, it seems reasonable to support the latest 4 versions, and I agree with that. What do you think about?

that sounds good, yeah if we have good way around switch syntax, dropping only 3.8 seems reasonable.

EarlMilktea commented 1 month ago

support the latest 4 versions

Let me point out that this is due to the EOL policy of Python, which guarantees security supports for 5 years. So I recommend to deprecate 3.8 after 31 Oct 2024.

MEMO: https://endoflife.date/python

EarlMilktea commented 3 weeks ago

I managed to pass the tests with looser numpy version requirement.