Skip to content

Commit 0dd4747

Browse files
Deprecate auth parameter and add new channel parameter (#226)
* Add channel parameter * Fix unit tests * Add mising space * Save account with new channel parameter even when auth is passed * Fix delete_account for auth parameter * Fix style * Make auth parameter work with saved_accounts * Support auth parameter when enabling account * Revert temporarily to fix doc builds on fork * Add some tests for overwriting saved auth accounts with channel accounts * Add couple more scenarios for testing overwriting named auth accounts with named channel accounts * Add couple more tests for saving named legacy accounts * Test to list existing auth accounts in channel format * Fix lint * Add test for filtering auth accounts * Fix lint * Fix failing integration tests * Add tests for deleting existing auth accounts using channel * Remove channel IDs to address confusion * Update docs/tutorials/04_account_management.ipynb Co-authored-by: Daniel Kaulen <[email protected]> * Refactor and add functions for duplicated logic * Use strings for now since enums don't play well with literals * Ban latest released click version to temp fix make style build https://github.com/Qiskit/qiskit-ibm-runtime/runs/5725271694?check_suite_focus=true#step:5:13 * Add update account function * Update black * Fix docs build * Call migrate function to update config file automatically vs have the user do it * Add release note Co-authored-by: Daniel Kaulen <[email protected]>
1 parent 69b179e commit 0dd4747

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+950
-532
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ jobs:
111111
matrix:
112112
python-version: [ 3.9 ]
113113
os: [ "ubuntu-latest" ]
114-
environment: [ "legacy-production", "cloud-production" ]
114+
environment: [ "ibm-quantum-production", "ibm-cloud-production" ]
115115
environment: ${{ matrix.environment }}
116116
env:
117117
QISKIT_IBM_TOKEN: ${{ secrets.QISKIT_IBM_TOKEN }}

.github/workflows/e2e-tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
matrix:
2727
python-version: [ 3.9 ]
2828
os: [ "ubuntu-latest" ]
29-
environment: [ "legacy-production", "legacy-staging", "cloud-production", "cloud-staging" ]
29+
environment: [ "ibm-quantum-production", "ibm-quantum-staging", "ibm-cloud-production", "ibm-cloud-staging" ]
3030
environment: ${{ matrix.environment }}
3131
env:
3232
QISKIT_IBM_TOKEN: ${{ secrets.QISKIT_IBM_TOKEN }}

.github/workflows/integration-tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
matrix:
2727
python-version: [ 3.9 ]
2828
os: [ "ubuntu-latest" ]
29-
environment: [ "legacy-production", "legacy-staging", "cloud-production", "cloud-staging" ]
29+
environment: [ "ibm-quantum-production", "ibm-quantum-staging", "ibm-cloud-production", "ibm-cloud-staging" ]
3030
environment: ${{ matrix.environment }}
3131
env:
3232
QISKIT_IBM_TOKEN: ${{ secrets.QISKIT_IBM_TOKEN }}

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ $ make e2e-test
227227

228228
#### Configuration
229229

230-
Integration and E2E tests require an environment configuration and can either be run against IBM Quantum APIs ("Legacy") or IBM Cloud Quantum Service APIs.
230+
Integration and E2E tests require an environment configuration and can either be run against IBM Quantum APIs ("ibm_quantum") or IBM Cloud ("ibm_cloud") Quantum Service APIs.
231231

232232

233233
Sample configuration for IBM Quantum

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ IBM Cloud API key and Cloud Resource Name (CRN), which you will need for authent
4444
### Qiskit Runtime on IBM Quantum
4545

4646
Prior to becoming an IBM Cloud service, Qiskit Runtime was offered on IBM Quantum. If you have an
47-
existing IBM Quantum account, you can continue using Qiskit Runtime on IBM Quantum, which is referred to as legacy runtime.
47+
existing IBM Quantum account, you can continue using Qiskit Runtime on IBM Quantum.
4848

4949
You will need your IBM Quantum API token to authenticate with the Qiskit Runtime service:
5050

@@ -65,10 +65,10 @@ them each time. The credentials are saved in the `$HOME/.qiskit/qiskit-ibm.json`
6565
from qiskit_ibm_runtime import IBMRuntimeService
6666

6767
# Save an IBM Cloud account.
68-
IBMRuntimeService.save_account(auth="cloud", token="MY_IBM_CLOUD_API_KEY", instance="MY_IBM_CLOUD_CRN")
68+
IBMRuntimeService.save_account(channel="ibm_cloud", token="MY_IBM_CLOUD_API_KEY", instance="MY_IBM_CLOUD_CRN")
6969

7070
# Save an IBM Quantum account.
71-
IBMRuntimeService.save_account(auth="legacy", token="MY_IBM_QUANTUM_TOKEN")
71+
IBMRuntimeService.save_account(channel="ibm_quantum", token="MY_IBM_QUANTUM_TOKEN")
7272
```
7373

7474
Once the account is saved on disk, you can instantiate the service without any arguments:
@@ -101,10 +101,10 @@ service with your credentials.
101101
from qiskit_ibm_runtime import IBMRuntimeService
102102

103103
# For an IBM Cloud account.
104-
cloud_service = IBMRuntimeService(auth="cloud", token="MY_IBM_CLOUD_API_KEY", instance="MY_IBM_CLOUD_CRN")
104+
ibm_cloud_service = IBMRuntimeService(channel="ibm_cloud", token="MY_IBM_CLOUD_API_KEY", instance="MY_IBM_CLOUD_CRN")
105105

106106
# For an IBM Quantum account.
107-
legacy_service = IBMRuntimeService(auth="legacy", token="MY_IBM_QUANTUM_TOKEN")
107+
ibm_quantum_service = IBMRuntimeService(channel="ibm_quantum", token="MY_IBM_QUANTUM_TOKEN")
108108
```
109109

110110
## Accessing Qiskit Runtime Programs

constraints.txt

-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +0,0 @@
1-
# 3.1.0 is buggy
2-
Jinja2!=3.1.0

docs/max_time.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Qiskit Runtime on IBM Cloud
1616
The system limit on the job execution time is 3 hours for a job running on a simulator
1717
and 8 hours for a job running on a physical system.
1818

19-
Qiskit Runtime on IBM Quantum (legacy)
20-
--------------------------------------
19+
Qiskit Runtime on IBM Quantum
20+
-----------------------------
2121

2222
The system limit on the job execution time is
2323

docs/release_notes.rst

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
.. release-notes:: Release Notes
2-
:version: 0.2.0, 0.1.0, 0.1.0rc2, 0.1.0rc1

docs/tutorials/01_introduction_cloud_runtime.ipynb docs/tutorials/01_introduction_ibm_cloud_runtime.ipynb

+3-3
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
"from qiskit_ibm_runtime import IBMRuntimeService\n",
108108
"\n",
109109
"# Save account on disk.\n",
110-
"# IBMRuntimeService.save_account(auth=\"cloud\", token=<IBM Cloud API key>, instance=<IBM Cloud CRN> or <IBM Cloud service name>)\n",
110+
"# IBMRuntimeService.save_account(channel=\"ibm_cloud\", token=<IBM Cloud API key>, instance=<IBM Cloud CRN> or <IBM Cloud service name>)\n",
111111
"\n",
112112
"service = IBMRuntimeService()"
113113
]
@@ -689,11 +689,11 @@
689689
"source": [
690690
"There are additional tutorials in this directory:\n",
691691
"\n",
692-
"- [02_introduction_legacy_runtime.ipynb](02_introduction_legacy_runtime.ipynb) is the corresponding tutorial on using legacy Qiskit Runtime. You can skip this tutorial if you don't plan on using legacy runtime.\n",
692+
"- [02_introduction_ibm_quantum_runtime.ipynb](02_introduction_ibm_quantum_runtime.ipynb) is the corresponding tutorial on using Qiskit Runtime on IBM Quantum. You can skip this tutorial if you don't plan on using Qiskit Runtime on IBM Quantum.\n",
693693
"- [03_backends.ipynb](03_backends.ipynb) describes how to find a target backend for the Qiskit Runtime program you want to invoke. \n",
694694
"- [04_account_management.ipynb](04_account_management.ipynb) describes how to save, load, and delete your account credentials on disk.\n",
695695
"- [qiskit_runtime_vqe_program.ipynb](sample_vqe_program/qiskit_runtime_vqe_program.ipynb) goes into more details on uploading a real-world program (VQE). \n",
696-
"- [qka.ipynb](qka.ipynb), [vqe.ipynb](vqe.ipynb), and [qiskit_runtime_expval_program.ipynb](sample_expval_program/qiskit_runtime_expval_program.ipynb) describe how to use the public programs `qka`, `vqe`, and `sample-expval`, respectively. These programs are currently only available on legacy Qiskit Runtime."
696+
"- [qka.ipynb](qka.ipynb), [vqe.ipynb](vqe.ipynb), and [qiskit_runtime_expval_program.ipynb](sample_expval_program/qiskit_runtime_expval_program.ipynb) describe how to use the public programs `qka`, `vqe`, and `sample-expval`, respectively. These programs are currently only available in Qiskit Runtime on IBM Quantum."
697697
]
698698
},
699699
{

docs/tutorials/02_introduction_legacy_runtime.ipynb docs/tutorials/02_introduction_ibm_quantum_runtime.ipynb

+8-8
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
"id": "1de4634b",
1919
"metadata": {},
2020
"source": [
21-
"# Legacy Qiskit Runtime"
21+
"# Qiskit Runtime on IBM Quantum"
2222
]
2323
},
2424
{
2525
"cell_type": "markdown",
2626
"id": "5affe56b",
2727
"metadata": {},
2828
"source": [
29-
"Prior to becoming an IBM Cloud service, Qiskit Runtime was offered on IBM Quantum. If you have an existing IBM Quantum account, you can continue using Qiskit Runtime on IBM Quantum, which is referred to as _legacy runtime_. \n"
29+
"Prior to becoming an IBM Cloud service, Qiskit Runtime was offered on IBM Quantum. If you have an existing IBM Quantum account, you can continue using Qiskit Runtime on IBM Quantum. \n"
3030
]
3131
},
3232
{
@@ -80,7 +80,7 @@
8080
"source": [
8181
"Before you can start using Qiskit Runtime, you need to initialize your account. You can do this by calling `IBMRuntimeService` with your IBM Quantum API token, which can be found on the [IBM Quantum accounts page](https://quantum-computing.ibm.com/account).\n",
8282
"\n",
83-
"You can also choose to save your credentials on disk (in the `$HOME/.qiskit/qiskit-ibm.json` file). By doing so, you only need to use `IBMRuntimeService(auth=\"legacy\")` in the future to initialize your account.\n",
83+
"You can also choose to save your credentials on disk (in the `$HOME/.qiskit/qiskit-ibm.json` file). By doing so, you only need to use `IBMRuntimeService(channel=\"ibm_quantum\")` in the future to initialize your account.\n",
8484
"\n",
8585
"For more information about account management, such as how to delete or view an account, see [04_account_management.ipynb](04_account_management.ipynb)."
8686
]
@@ -95,10 +95,10 @@
9595
"from qiskit_ibm_runtime import IBMRuntimeService\n",
9696
"\n",
9797
"# Save account on disk.\n",
98-
"# IBMRuntimeService.save_account(auth=\"legacy\", token=<IBM Quantun API token>)\n",
98+
"# IBMRuntimeService.save_account(channel=\"ibm_quantum\", token=<IBM Quantun API token>)\n",
9999
"\n",
100-
"# The \"auth\" keyword is not needed if you have only 1 type (legacy or cloud) of account saved.\n",
101-
"service = IBMRuntimeService(auth=\"legacy\")"
100+
"# The \"channel\" keyword is not needed if you have only 1 type (ibm_quantum or ibm_cloud) of account saved.\n",
101+
"service = IBMRuntimeService(channel=\"ibm_quantum\")"
102102
]
103103
},
104104
{
@@ -417,7 +417,7 @@
417417
"metadata": {},
418418
"source": [
419419
"<div class=\"alert alert-block alert-info\">\n",
420-
"<b>Note:</b> To ensure fairness, there is a maximum execution time for each Qiskit Runtime job. Refer to <a href=\"https://qiskit.org/documentation/partners/qiskit_ibm_runtime/max_time.html#qiskit-runtime-on-ibm-quantum-legacy\">this documentation</a> on what the time limit is.\n",
420+
"<b>Note:</b> To ensure fairness, there is a maximum execution time for each Qiskit Runtime job. Refer to <a href=\"https://qiskit.org/documentation/partners/qiskit_ibm_runtime/max_time.html#qiskit-runtime-on-ibm-quantum-ibm-quantum\">this documentation</a> on what the time limit is.\n",
421421
"</div>"
422422
]
423423
},
@@ -535,7 +535,7 @@
535535
"- [04_account_management.ipynb](04_account_management.ipynb) describes how to save, load, and delete your account credentials on disk.\n",
536536
"- [05_uploading_program.ipynb](05_uploading_program.ipynb) is an introduction on uploading your custom Qiskit Runtime program.\n",
537537
"- [qiskit_runtime_vqe_program.ipynb](sample_vqe_program/qiskit_runtime_vqe_program.ipynb) goes into more details on uploading a real-world program (VQE). \n",
538-
"- [qka.ipynb](qka.ipynb), [vqe.ipynb](vqe.ipynb), and [qiskit_runtime_expval_program.ipynb](sample_expval_program/qiskit_runtime_expval_program.ipynb) describe how to use the public programs `qka`, `vqe`, and `sample-expval`, respectively. These programs are currently only available on legacy Qiskit Runtime."
538+
"- [qka.ipynb](qka.ipynb), [vqe.ipynb](vqe.ipynb), and [qiskit_runtime_expval_program.ipynb](sample_expval_program/qiskit_runtime_expval_program.ipynb) describe how to use the public programs `qka`, `vqe`, and `sample-expval`, respectively. These programs are currently only available on Qiskit Runtime on IBM Quantum."
539539
]
540540
},
541541
{

docs/tutorials/03_backends.ipynb

+3-4
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,8 @@
227227
}
228228
],
229229
"source": [
230-
"# This program currently is only available on legacy Qiskit Runtime.\n",
231-
"legacy_service = IBMRuntimeService(auth=\"legacy\")\n",
232-
"program = legacy_service.program(\"hello-world\")\n",
230+
"ibm_quantum_service = IBMRuntimeService(channel=\"ibm_quantum\")\n",
231+
"program = ibm_quantum_service.program(\"hello-world\")\n",
233232
"print(program.backend_requirements)"
234233
]
235234
},
@@ -269,7 +268,7 @@
269268
}
270269
],
271270
"source": [
272-
"legacy_service.backends(min_num_qubits=5)"
271+
"ibm_quantum_service.backends(min_num_qubits=5)"
273272
]
274273
},
275274
{

docs/tutorials/04_account_management.ipynb

+7-7
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"id": "c22a29f4",
2727
"metadata": {},
2828
"source": [
29-
"Qiskit Runtime is available on both IBM Cloud and IBM Quantum. The former requires an IBM Cloud account and the latter an IBM Quantum account. If you don't have these accounts, please refer to [01_introduction_cloud_runtime.ipynb](01_introduction_cloud_runtime.ipynb) or [02_introduction_legacy_runtime.ipynb](02_introduction_legacy_runtime.ipynb) on how to set one up.\n",
29+
"Qiskit Runtime is available on both IBM Cloud and IBM Quantum. The former requires an IBM Cloud account and the latter an IBM Quantum account. If you don't have these accounts, please refer to [01_introduction_ibm_cloud_runtime.ipynb](01_introduction_ibm_cloud_runtime.ipynb) or [02_introduction_ibm_quantum_runtime.ipynb](02_introduction_ibm_quantum_runtime.ipynb) on how to set one up.\n",
3030
"\n"
3131
]
3232
},
@@ -74,7 +74,7 @@
7474
"id": "bfb828ec",
7575
"metadata": {},
7676
"source": [
77-
"Below are examples of saving an IBM Cloud and an IBM Quantum accounts. The `auth` parameter indicates the authentication type of the account. If you are saving multiple account, consider using the `name` parameter to differentiate them.\n"
77+
"Below are examples of saving an IBM Cloud and an IBM Quantum accounts. The `channel` parameter allows to distinguish between different account types. If you are saving multiple accounts per channel, consider using the `name` parameter to differentiate them.\n"
7878
]
7979
},
8080
{
@@ -87,10 +87,10 @@
8787
"from qiskit_ibm_runtime import IBMRuntimeService\n",
8888
"\n",
8989
"# Save an IBM Cloud account on disk.\n",
90-
"# IBMRuntimeService.save_account(auth=\"cloud\", token=<IBM Cloud API key>, instance=<IBM Cloud CRN> or <IBM Cloud service name>)\n",
90+
"# IBMRuntimeService.save_account(channel=\"ibm_cloud\", token=<IBM Cloud API key>, instance=<IBM Cloud CRN> or <IBM Cloud service name>)\n",
9191
"\n",
9292
"# Save an IBM Quantum account on disk.\n",
93-
"# IBMRuntimeService.save_account(auth=\"legacy\", token=<IBM Quantum API token>)"
93+
"# IBMRuntimeService.save_account(channel=\"ibm_quantum\", token=<IBM Quantum API token>)"
9494
]
9595
},
9696
{
@@ -125,7 +125,7 @@
125125
"id": "9a4504f8",
126126
"metadata": {},
127127
"source": [
128-
"If you have both an IBM Cloud and an IBM Quantum accounts saved, `IBMRuntimeService()` by default will load the IBM Cloud account. To load the IBM Quantum account, you can specify `IBMRuntimeService(auth=\"legacy\")` instead.\n",
128+
"If you have both an IBM Cloud and an IBM Quantum accounts saved, `IBMRuntimeService()` by default will load the IBM Cloud account. To load the IBM Quantum account, you can specify `IBMRuntimeService(channel=\"ibm_quantum\")` instead.\n",
129129
"\n",
130130
"Alternatively, if you specified a `name` for your account when saving it, you can also specify the name of the account to load."
131131
]
@@ -138,7 +138,7 @@
138138
"outputs": [],
139139
"source": [
140140
"# Save an IBM Cloud account on disk and give it a name.\n",
141-
"# IBMRuntimeService.save_account(auth=\"cloud\", token=<IBM Cloud API key>, instance=<IBM Cloud CRN>, name=\"prod\")\n",
141+
"# IBMRuntimeService.save_account(channel=\"ibm_cloud\", token=<IBM Cloud API key>, instance=<IBM Cloud CRN>, name=\"prod\")\n",
142142
"\n",
143143
"# service = IBMRuntimeService(name=\"prod\")"
144144
]
@@ -159,7 +159,7 @@
159159
"outputs": [],
160160
"source": [
161161
"# Initialize an IBM Cloud account without saving it.\n",
162-
"# service = IBMRuntimeService(auth=\"cloud\", token=<IBM Cloud API key>, instance=<IBM Cloud CRN>)"
162+
"# service = IBMRuntimeService(channel=\"ibm_cloud\", token=<IBM Cloud API key>, instance=<IBM Cloud CRN>)"
163163
]
164164
},
165165
{

docs/tutorials/qka.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
"source": [
8686
"# Load your account and get the quantum backend\n",
8787
"\n",
88-
"We'll be using the 27-qubit device `ibmq_montreal` for this tutorial on legacy Qiskit Runtime."
88+
"We'll be using the 27-qubit device `ibmq_montreal` for this tutorial in Qiskit Runtime on IBM Quantum."
8989
]
9090
},
9191
{
@@ -104,7 +104,7 @@
104104
"\n",
105105
"from qiskit_ibm_runtime import IBMRuntimeService\n",
106106
"\n",
107-
"service = IBMRuntimeService(auth=\"legacy\")\n",
107+
"service = IBMRuntimeService(channel=\"ibm_quantum\")\n",
108108
"backend = service.backend(\"ibmq_montreal\")"
109109
]
110110
},

docs/tutorials/sample_expval_program/qiskit_runtime_expval_program.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@
363363
"source": [
364364
"from qiskit_ibm_runtime import IBMRuntimeService\n",
365365
"\n",
366-
"service = IBMRuntimeService(auth=\"legacy\")"
366+
"service = IBMRuntimeService(channel=\"ibm_quantum\")"
367367
]
368368
},
369369
{

docs/tutorials/vqe.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@
275275
"source": [
276276
"from qiskit_ibm_runtime import IBMRuntimeService\n",
277277
"\n",
278-
"service = IBMRuntimeService(auth=\"legacy\")"
278+
"service = IBMRuntimeService(channel=\"ibm_quantum\")"
279279
]
280280
},
281281
{

qiskit_ibm_runtime/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
on disk.
4040
4141
Qiskit Runtime is available on both IBM Cloud and IBM Quantum, and you can specify
42-
``auth="cloud"`` for IBM Cloud and ``auth="legacy"`` for IBM Quantum. The default
42+
``channel="ibm_cloud"`` for IBM Cloud and ``channel="ibm_quantum"`` for IBM Quantum. The default
4343
is IBM Cloud.
4444
4545
Listing runtime programs

qiskit_ibm_runtime/accounts/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
Account management functionality related to the IBM Runtime Services.
1515
"""
1616

17-
from .account import Account, AccountType
17+
from .account import Account, AccountType, ChannelType
1818
from .management import AccountManager
1919
from .exceptions import (
2020
AccountNotFoundError,

0 commit comments

Comments
 (0)