Skip to content

Commit f67b926

Browse files
fix: improved ctrl+c on windows
the rest will hopefully come from the next release of pick with some work of mine
1 parent 36a8418 commit f67b926

File tree

4 files changed

+26
-17
lines changed

4 files changed

+26
-17
lines changed

docs/execution-extras.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ __________
6464
Connection setup script
6565
-----------------------
6666

67-
.. automodule:: mpqp.execution.connection.setup_connections
67+
.. automodule:: mpqp_scripts.setup_connections
6868

6969
On disk configuration manager
7070
-----------------------------

mpqp/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# pyright: reportUnusedImport=false
22
from mpqp.core.circuit import QCircuit
3+
from mpqp.core.instruction import Instruction
34
from mpqp.core.instruction.barrier import Barrier
45
from mpqp.core.languages import Language
5-
from mpqp.core.instruction import Instruction

mpqp/execution/connection/setup_connections.py mpqp_scripts/setup_connections.py

+22-13
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
#! /usr/bin/env python3
2-
"""This script helps you configuring the connections for all the supported
3-
remote backends. In time, it will also guide you to retrieve the tokens,
4-
passwords, etc... but for now, it is a prerequisite that you already have these
5-
credentials to use this script.
2+
"""The ``setup_connections`` script helps you configuring the connections for
3+
all the supported remote backends. In time, it will also guide you to retrieve
4+
the tokens, passwords, etc... but for now, it is a prerequisite that you already
5+
have these credentials to use this script.
66
7-
Information concerning which provider is configured and related
8-
credentials are stored in the ``~/.mpqp`` file."""
7+
Information concerning which provider is configured and related credentials are
8+
stored in the ``~/.mpqp`` file."""
99

10-
import mpqp.execution.connection.aws_connection as awsc
11-
import mpqp.execution.connection.env_manager as env_m
12-
import mpqp.execution.connection.ibm_connection as ibmqc
13-
import mpqp.execution.connection.qlm_connection as qlmc
14-
from mpqp.tools.choice_tree import AnswerNode, QuestionNode, run_choice_tree
15-
from mpqp.tools.errors import IBMRemoteExecutionError
10+
import os
11+
12+
os.environ["FOR_DISABLE_CONSOLE_CTRL_HANDLER"] = "1"
1613

1714

1815
def print_config_info():
16+
import mpqp.execution.connection.aws_connection as awsc
17+
import mpqp.execution.connection.env_manager as env_m
18+
import mpqp.execution.connection.ibm_connection as ibmqc
19+
from mpqp.tools.errors import IBMRemoteExecutionError
20+
1921
"""Prints the info concerning each provider's registered account."""
2022
print("===== IBM Quantum info : ===== ")
2123
try:
@@ -45,6 +47,10 @@ def print_config_info():
4547
def main_setup():
4648
"""Function called by the script bellow to setup all connections or to get
4749
information about the existing ones."""
50+
import mpqp.execution.connection.aws_connection as awsc
51+
import mpqp.execution.connection.ibm_connection as ibmqc
52+
import mpqp.execution.connection.qlm_connection as qlmc
53+
from mpqp.tools.choice_tree import AnswerNode, QuestionNode, run_choice_tree
4854

4955
setup_tree = QuestionNode(
5056
"~~~~~ MPQP REMOTE CONFIGURATION ~~~~~",
@@ -63,4 +69,7 @@ def main_setup():
6369

6470

6571
if __name__ == "__main__":
66-
main_setup()
72+
try:
73+
main_setup()
74+
except KeyboardInterrupt:
75+
exit()

setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from setuptools import setup, find_packages
1+
from setuptools import find_packages, setup
22

33
with open("README.md", "r", encoding="utf-8") as f:
44
long_description = f.read()
@@ -32,7 +32,7 @@
3232
packages=find_packages(include=["mpqp*"]),
3333
entry_points={
3434
"console_scripts": [
35-
"setup_connections = mpqp.execution.connection.setup_connections:main_setup",
35+
"setup_connections = mpqp_scripts.setup_connections:main_setup",
3636
]
3737
},
3838
project_urls={

0 commit comments

Comments
 (0)