Skip to content

Commit

Permalink
Merge pull request Qiskit#1000 from ajavadia/ibmq-admin
Browse files Browse the repository at this point in the history
rework IBMQ account adminstration
  • Loading branch information
jaygambetta authored Oct 2, 2018
2 parents 6a9805c + 8f6b27b commit cbc5246
Show file tree
Hide file tree
Showing 23 changed files with 259 additions and 216 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Added
- Added decorator to check for C++ simulator availability (#662)
- It is possible to cancel jobs in non comercial backends (#687)
- Introduced new `qiskit.IBMQ` provider, with centralized handling of IBMQ
credentials (qiskitrc file, environment variables). (#547, #948)
credentials (qiskitrc file, environment variables). (#547, #948, #1000)
- Add OpenMP parallelization for Apple builds of the cpp simulator (#698).
- Add parallelization utilities (#701)
- Parallelize transpilation (#701)
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ COMPLETED
This script is available [here](examples/python/hello_quantum.py), where we also show how to
run the same program on a real quantum computer.

### Executing your code on a real Quantum chip
### Executing your code on a real quantum chip

You can also use Qiskit to execute your code on a
[real quantum chip](https://github.com/Qiskit/ibmqx-backend-information).
Expand All @@ -129,22 +129,22 @@ your IBM Q Experience account:

2. Get an API token from the IBM Q Experience website under _My Account > Advanced > API Token_. This API token allows you to execute your programs with the IBM Q Experience backends. See: [Example](doc/example_real_backend.rst).

3. We are now going to add the necessary credentials to QISKit. Take your token
3. We are now going to add the necessary credentials to Qiskit. Take your token
from step 2, here called `MY_API_TOKEN`, and pass it to the
`IBMQ.add_account()` function:
`IBMQ.save_account()` function:

```python
from qiskit import IBMQ

IBMQ.add_account('MY_API_TOKEN')
IBMQ.save_account('MY_API_TOKEN')
```

4. If you have access to the IBM Q Network features, you also need to pass the
url listed on your IBM Q account page to `store_credentials`.
url listed on your IBM Q account page to `save_account`.

After calling `IBMQ.add_account()`, your credentials will be stored into disk.
Once they are stored, Qiskit will automatically load and use them in your program
via:
After calling `IBMQ.save_account()`, your credentials will be stored into disk.
Once they are stored, at any point in the future you can load and use them
in your program simply via:

```python
from qiskit import IBMQ
Expand Down Expand Up @@ -185,7 +185,7 @@ at these resources:
for additional information and examples of QASM code
* **[IBM Quantum Experience Composer](https://quantumexperience.ng.bluemix.net/qx/editor)**,
a GUI for interacting with real and simulated quantum computers
* **[QISkit Python API](https://github.com/Qiskit/qiskit-api-py)**, an API to use the IBM Quantum
* **[Qiskit Python API](https://github.com/Qiskit/qiskit-api-py)**, an API to use the IBM Quantum
Experience in Python

Qiskit was originally developed by researchers and developers on the
Expand Down
10 changes: 5 additions & 5 deletions doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,19 @@ To store your information, simply run:
from qiskit import IBMQ
IBMQ.add_account('MY_API_TOKEN')
IBMQ.save_account('MY_API_TOKEN')
where `MY_API_TOKEN` should be replaced with your token.

If you are on the IBM Q network, you must also pass the `url`
argument found on your q-console account page to `IBMQ.add_account()`:
argument found on your q-console account page to `IBMQ.save_account()`:

.. code:: python
from qiskit import IBMQ
IBMQ.add_account('MY_API_TOKEN', url='https://...')
IBMQ.save_account('MY_API_TOKEN', url='https://...')
3.1.2 Load API credentials from environment variables
Expand Down Expand Up @@ -177,14 +177,14 @@ precedence over the environment variables or the credentials stored in disk.

In more complex scenarios or for users that need finer control over multiple
accounts, please note that you can pass the API token and the other parameters
directly to the ``IBMQ.use_account()`` function, which will ignore the automatic
directly to the ``IBMQ.enable_account()`` function, which will ignore the automatic
loading of the credentials and use the arguments directly. For example:

.. code:: python
from qiskit import IBMQ
IBMQ.use_account('MY_API_TOKEN', url='https://my.url')
IBMQ.enable_account('MY_API_TOKEN', url='https://my.url')
will try to authenticate using ``MY_API_TOKEN`` and the specified URL,
regardless of the configuration stored in the config file, the environment
Expand Down
14 changes: 9 additions & 5 deletions doc/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,25 @@ Please check the :ref:`0.5 release notes <quantum-program-0-5>` and the
IBM Q Authentication and ``Qconfig.py``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The managing of credentials for authenticating when using the QE backends has
The managing of credentials for authenticating when using the QX backends has
been expanded, and there are new options that can be used for convenience:

1. store your credentials in disk once, and automatically load them in future
1. save your credentials in disk once, and automatically load them in future
sessions. This provides a one-off mechanism::

from qiskit import IBMQ
IBQM.add_account('MY_API_TOKEN')
IBQM.save_account('MY_API_TOKEN', 'MY_API_URL')

afterwards, your credentials can be automatically read from disk by invoking
afterwards, your credentials can be automatically loaded from disk by invoking
:meth:`~qiskit.backends.ibmq.IBMQ.load_accounts`::

from qiskit import IBMQ
IBMQ.load_accounts()

or you can load only specific accounts if you only want to use those in a session::
IBMQ.load_accounts(project='MY_PROJECT')

2. use environment variables. If ``QE_TOKEN`` and ``QE_URL`` is set, the
``IBMQ.load_accounts()`` call will automatically load the credentials from
them.
Expand Down Expand Up @@ -116,7 +120,7 @@ And for listing and using remote backends::

from qiskit import IBMQ

IBMQ.use_account('MY_API_TOKEN')
IBMQ.enable_account('MY_API_TOKEN')
5_qubit_devices = IBMQ.backends(simulator=True, n_qubits=5)
ibmqx4 = IBMQ.get_backend('ibmqx4')

Expand Down
2 changes: 1 addition & 1 deletion examples/python/ghz.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
###############################################################
try:
import Qconfig
IBMQ.use_account(Qconfig.APItoken, Qconfig.config['url'])
IBMQ.enable_account(Qconfig.APItoken, Qconfig.config['url'])
except:
print("""WARNING: There's no connection with the API for remote backends.
Have you initialized a Qconfig.py file with your personal token?
Expand Down
2 changes: 1 addition & 1 deletion examples/python/hello_quantum.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# Authenticate for access to remote backends
try:
import Qconfig
IBMQ.use_account(Qconfig.APItoken, Qconfig.config['url'])
IBMQ.enable_account(Qconfig.APItoken, Qconfig.config['url'])
except:
print("""WARNING: There's no connection with the API for remote backends.
Have you initialized a Qconfig.py file with your personal token?
Expand Down
2 changes: 1 addition & 1 deletion examples/python/qft.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def qft(circ, q, n):
###############################################################
try:
import Qconfig
IBMQ.use_account(Qconfig.APItoken, Qconfig.config['url'])
IBMQ.enable_account(Qconfig.APItoken, Qconfig.config['url'])
except:
print("""WARNING: There's no connection with the API for remote backends.
Have you initialized a Qconfig.py file with your personal token?
Expand Down
2 changes: 1 addition & 1 deletion examples/python/using_qiskit_terra_level_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

try:
import Qconfig
IBMQ.use_account(Qconfig.APItoken, Qconfig.config['url'])
IBMQ.enable_account(Qconfig.APItoken, Qconfig.config['url'])
except:
print("""WARNING: There's no connection with the API for remote backends.
Have you initialized a Qconfig.py file with your personal token?
Expand Down
2 changes: 1 addition & 1 deletion examples/python/using_qiskit_terra_level_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

try:
import Qconfig
IBMQ.use_account(Qconfig.APItoken, Qconfig.config['url'])
IBMQ.enable_account(Qconfig.APItoken, Qconfig.config['url'])
except:
print("""WARNING: There's no connection with the API for remote backends.
Have you initialized a Qconfig.py file with your personal token?
Expand Down
2 changes: 1 addition & 1 deletion examples/python/using_qiskit_terra_level_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

try:
import Qconfig
IBMQ.use_account(Qconfig.APItoken, Qconfig.config['url'])
IBMQ.enable_account(Qconfig.APItoken, Qconfig.config['url'])
except:
print("""WARNING: There's no connection with the API for remote backends.
Have you initialized a Qconfig.py file with your personal token?
Expand Down
Loading

0 comments on commit cbc5246

Please sign in to comment.