Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pip install qiskit-ibm-catalog
```python
from qiskit_ibm_catalog import QiskitFunctionsCatalog

catalog = QiskitFunctionsCatalog(token=...)
catalog = QiskitFunctionsCatalog(token=..., instance=...)

catalog.list()
# [<QiskitFunction("ibm/...")>, ...]
Expand Down
7 changes: 5 additions & 2 deletions docs/tutorials/catalog.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand All @@ -27,12 +27,15 @@
],
"source": [
"\"\"\"Qiskit function catalog\"\"\"\n",
"\n",
"# pylint: disable=pointless-statement\n",
"\n",
"import os\n",
"from qiskit_ibm_catalog import QiskitFunctionsCatalog\n",
"\n",
"catalog = QiskitFunctionsCatalog(token=os.environ.get(\"TOKEN\"))\n",
"catalog = QiskitFunctionsCatalog(\n",
" token=os.environ.get(\"TOKEN\"), instance=os.environ.get(\"INSTANCE\")\n",
")\n",
"catalog"
]
},
Expand Down
7 changes: 5 additions & 2 deletions docs/tutorials/serverless.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand All @@ -28,12 +28,15 @@
],
"source": [
"\"\"\"QiskitServerless client\"\"\"\n",
"\n",
"# pylint: disable=pointless-statement\n",
"\n",
"import os\n",
"from qiskit_ibm_catalog import QiskitServerless, QiskitFunction\n",
"\n",
"serverless = QiskitServerless(token=os.environ.get(\"TOKEN\"))\n",
"serverless = QiskitServerless(\n",
" token=os.environ.get(\"TOKEN\"), instance=os.environ.get(\"INSTANCE\")\n",
")\n",
"serverless"
]
},
Expand Down
6 changes: 3 additions & 3 deletions qiskit_ibm_catalog/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ class QiskitFunctionsCatalog:
provider with the API token::

from qiskit_ibm_catalog import QiskitFunctionsCatalog
catalog = QiskitFunctionsCatalog(token=<INSERT_IBM_QUANTUM_TOKEN>)
catalog = QiskitFunctionsCatalog(token=<INSERT_IBM_QUANTUM_TOKEN>, instance=<INSERT_CRN>)
"""

PRE_FILTER_KEYWORD: str = "catalog"

def __init__(
self,
token: Optional[str] = None,
channel: str = Channel.IBM_QUANTUM.value,
channel: str = Channel.IBM_QUANTUM_PLATFORM.value,
instance: Optional[str] = None,
name: Optional[str] = None,
) -> None:
Expand Down Expand Up @@ -211,7 +211,7 @@ def __repr__(self) -> str:
@staticmethod
def save_account(
token: Optional[str] = None,
channel: str = Channel.IBM_QUANTUM.value,
channel: str = Channel.IBM_QUANTUM_PLATFORM.value,
instance: Optional[str] = None,
name: Optional[str] = None,
overwrite: Optional[bool] = False,
Expand Down
8 changes: 4 additions & 4 deletions qiskit_ibm_catalog/serverless.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class QiskitServerless:
Credentials can be saved to disk by calling the `save_account()` method::
from qiskit_ibm_catalog import QiskitServerless
QiskitServerless.save_account(token=<INSERT_IBM_QUANTUM_TOKEN>)
QiskitServerless.save_account(token=<INSERT_IBM_QUANTUM_TOKEN>, instance=<INSERT_CRN>)
Once the credentials are saved, you can simply instantiate the serverless with no
constructor args, as shown below.
Expand All @@ -49,15 +49,15 @@ class QiskitServerless:
serverless with the API token::
from qiskit_ibm_catalog import QiskitServerless
serverless = QiskitServerless(token=<INSERT_IBM_QUANTUM_TOKEN>)
serverless = QiskitServerless(token=<INSERT_IBM_QUANTUM_TOKEN>, instance=<INSERT_CRN>)
"""

PRE_FILTER_KEYWORD: str = "serverless"

def __init__(
self,
token: Optional[str] = None,
channel: str = Channel.IBM_QUANTUM.value,
channel: str = Channel.IBM_QUANTUM_PLATFORM.value,
instance: Optional[str] = None,
name: Optional[str] = None,
) -> None:
Expand Down Expand Up @@ -223,7 +223,7 @@ def __repr__(self) -> str:
@staticmethod
def save_account(
token: Optional[str] = None,
channel: str = Channel.IBM_QUANTUM.value,
channel: str = Channel.IBM_QUANTUM_PLATFORM.value,
instance: Optional[str] = None,
name: Optional[str] = None,
overwrite: Optional[bool] = False,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class TestCatalog(TestCase):
)
def test_basic_functions(self, _token_mock, jobs_mock, functions_list_mock):
"""Tests basic function of catalog."""
catalog = QiskitFunctionsCatalog("token")
catalog = QiskitFunctionsCatalog(token="token", instance="instance")
jobs = catalog.jobs(limit=10)
functions = catalog.list()

Expand All @@ -62,7 +62,7 @@ class TestServerless(TestCase):
)
def test_basic_functions(self, _token_mock, jobs_mock, functions_list_mock):
"""Tests basic function of serverless client."""
serverless = QiskitServerless("token")
serverless = QiskitServerless(token="token", instance="instance")
jobs = serverless.jobs(limit=10)
functions = serverless.list()

Expand Down
Loading