Name | pytket-iqm JSON |
Version |
0.15.0
JSON |
| download |
home_page | None |
Summary | Extension for pytket, providing access to IQM backends |
upload_time | 2024-10-04 08:18:29 |
maintainer | None |
docs_url | None |
author | TKET development team |
requires_python | >=3.10 |
license | Apache 2 |
keywords |
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# pytket-iqm
[](https://tketusers.slack.com/join/shared_invite/zt-18qmsamj9-UqQFVdkRzxnXCcKtcarLRA#)
[](https://quantumcomputing.stackexchange.com/tags/pytket)
[Pytket](https://tket.quantinuum.com/api-docs/index.html) is a python module
providing an extensive set of tools for compiling and executing quantum circuits.
`pytket-iqm` is an extension to `pytket` that allows `pytket` circuits to be
executed on [IQM](https://meetiqm.com/)'s quantum devices and simulators.
Some useful links:
- [API Documentation](https://tket.quantinuum.com/extensions/pytket-iqm/)
## Getting started
`pytket-iqm` is available for Python 3.10, 3.11 and 3.12, on Linux, macOS
and Windows. To install, run:
```shell
pip install pytket-iqm
```
This will install `pytket` if it isn't already installed, and add new classes
and methods into the `pytket.extensions` namespace.
API documentation is available
[here](https://tket.quantinuum.com/extensions/pytket-iqm/).
Under the hood, `pytket-iqm` uses `iqm-client` to interact with the devices. See
the IQM Client [documentation](https://iqm-finland.github.io/iqm-client/) and
Pytket [documentation](https://tket.quantinuum.com/api-docs/) for more info.
To use the integration, initialise an `IQMBackend`, construct a Pytket circuit,
compile it and run. Here is a small example of running a GHZ state circuit:
```python
from pytket.extensions.iqm import IQMBackend
from pytket.circuit import Circuit
backend = IQMBackend(
url="https://demo.qc.iqm.fi/cocos",
auth_server_url="https://demo.qc.iqm.fi/auth",
username="USERNAME",
password="PASSWORD",
)
circuit = Circuit(3, 3)
circuit.H(0)
circuit.CX(0, 1)
circuit.CX(0, 2)
circuit.measure_all()
compiled_circuit = backend.get_compiled_circuit(circuit)
result = backend.run_circuit(compiled_circuit, n_shots=100)
print(result.get_shots())
```
The IQM Client documentation includes the [set of currently supported
instructions]
(https://iqm-finland.github.io/iqm-client/api/iqm_client.iqm_client.html).
`pytket-iqm` retrieves the set from the IQM backend during the initialisation;
then `get_compiled_circuit()` takes care of compiling the circuit into the
form suitable to run on the backend.
During the backend initialisation, `pytket-iqm` also retrieves the names of
physical qubits and qubit connectivity. You can override the qubit connectivity
by providing the `arch` parameter to the `IQMBackend` constructor, but it generally
does not make sense, since the IQM server reports the valid quantum architecture
relevant to the given backend URL.
(Note: At the moment IQM does not provide a quantum computing service open to the
general public. Please contact our [sales team](https://www.meetiqm.com/contact/)
to set up your access to an IQM quantum computer.)
## Bugs and feature requests
Please file bugs and feature requests on the GitHub
[issue tracker](https://github.com/CQCL/pytket-iqm/issues).
## Development
To install an extension in editable mode, simply change to its subdirectory
within the `modules` directory, and run:
```shell
pip install -e .
```
## Contributing
Pull requests are welcome. To make a PR, first fork the repo, make your proposed
changes on the `main` branch, and open a PR from your fork. If it passes
tests and is accepted after review, it will be merged in.
### Code style
#### Formatting
All code should be formatted using
[black](https://black.readthedocs.io/en/stable/), with default options. This is
checked on the CI.
#### Type annotation
On the CI, [mypy](https://mypy.readthedocs.io/en/stable/) is used as a static
type checker and all submissions must pass its checks. You should therefore run
`mypy` locally on any changed files before submitting a PR. Because of the way
extension modules embed themselves into the `pytket` namespace this is a little
complicated, but it should be sufficient to run the script `modules/mypy-check`
(passing as a single argument the root directory of the module to test). The
script requires `mypy` 0.800 or above.
#### Linting
We use [pylint](https://pypi.org/project/pylint/) on the CI to check compliance
with a set of style requirements (listed in `.pylintrc`). You should run
`pylint` over any changed files before submitting a PR, to catch any issues.
### Tests
To run the tests:
```shell
cd tests
pip install -r test-requirements.txt
pytest
```
By default, the remote tests, which run against the real backend server, are
skipped. To enable them, set the following environment variables:
```shell
export PYTKET_RUN_REMOTE_TESTS=1
export PYTKET_REMOTE_IQM_AUTH_SERVER_URL=https://demo.qc.iqm.fi/auth
export PYTKET_REMOTE_IQM_USERNAME=YOUR_USERNAME
export PYTKET_REMOTE_IQM_PASSWORD=YOUR_PASSWORD
```
When adding a new feature, please add a test for it. When fixing a bug, please
add a test that demonstrates the fix.
Raw data
{
"_id": null,
"home_page": null,
"name": "pytket-iqm",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": null,
"author": "TKET development team",
"author_email": "tket-support@quantinuum.com",
"download_url": null,
"platform": null,
"description": "# pytket-iqm\r\n\r\n[](https://tketusers.slack.com/join/shared_invite/zt-18qmsamj9-UqQFVdkRzxnXCcKtcarLRA#)\r\n[](https://quantumcomputing.stackexchange.com/tags/pytket)\r\n\r\n[Pytket](https://tket.quantinuum.com/api-docs/index.html) is a python module\r\nproviding an extensive set of tools for compiling and executing quantum circuits.\r\n\r\n`pytket-iqm` is an extension to `pytket` that allows `pytket` circuits to be\r\nexecuted on [IQM](https://meetiqm.com/)'s quantum devices and simulators.\r\n\r\nSome useful links:\r\n- [API Documentation](https://tket.quantinuum.com/extensions/pytket-iqm/)\r\n\r\n## Getting started\r\n\r\n`pytket-iqm` is available for Python 3.10, 3.11 and 3.12, on Linux, macOS\r\nand Windows. To install, run:\r\n\r\n```shell\r\npip install pytket-iqm\r\n```\r\n\r\nThis will install `pytket` if it isn't already installed, and add new classes\r\nand methods into the `pytket.extensions` namespace.\r\n\r\nAPI documentation is available\r\n[here](https://tket.quantinuum.com/extensions/pytket-iqm/).\r\n\r\nUnder the hood, `pytket-iqm` uses `iqm-client` to interact with the devices. See\r\nthe IQM Client [documentation](https://iqm-finland.github.io/iqm-client/) and\r\nPytket [documentation](https://tket.quantinuum.com/api-docs/) for more info.\r\n\r\nTo use the integration, initialise an `IQMBackend`, construct a Pytket circuit,\r\ncompile it and run. Here is a small example of running a GHZ state circuit:\r\n\r\n```python\r\nfrom pytket.extensions.iqm import IQMBackend\r\nfrom pytket.circuit import Circuit\r\n\r\nbackend = IQMBackend(\r\n\turl=\"https://demo.qc.iqm.fi/cocos\",\r\n\tauth_server_url=\"https://demo.qc.iqm.fi/auth\",\r\n\tusername=\"USERNAME\",\r\n\tpassword=\"PASSWORD\",\r\n)\r\n\r\ncircuit = Circuit(3, 3)\r\ncircuit.H(0)\r\ncircuit.CX(0, 1)\r\ncircuit.CX(0, 2)\r\ncircuit.measure_all()\r\ncompiled_circuit = backend.get_compiled_circuit(circuit)\r\n\r\nresult = backend.run_circuit(compiled_circuit, n_shots=100)\r\nprint(result.get_shots())\r\n```\r\n\r\nThe IQM Client documentation includes the [set of currently supported\r\ninstructions]\r\n(https://iqm-finland.github.io/iqm-client/api/iqm_client.iqm_client.html).\r\n`pytket-iqm` retrieves the set from the IQM backend during the initialisation;\r\nthen `get_compiled_circuit()` takes care of compiling the circuit into the\r\nform suitable to run on the backend.\r\n\r\nDuring the backend initialisation, `pytket-iqm` also retrieves the names of\r\nphysical qubits and qubit connectivity. You can override the qubit connectivity\r\nby providing the `arch` parameter to the `IQMBackend` constructor, but it generally\r\ndoes not make sense, since the IQM server reports the valid quantum architecture\r\nrelevant to the given backend URL.\r\n\r\n(Note: At the moment IQM does not provide a quantum computing service open to the \r\ngeneral public. Please contact our [sales team](https://www.meetiqm.com/contact/) \r\nto set up your access to an IQM quantum computer.)\r\n\r\n## Bugs and feature requests\r\n\r\nPlease file bugs and feature requests on the GitHub\r\n[issue tracker](https://github.com/CQCL/pytket-iqm/issues).\r\n\r\n## Development\r\n\r\nTo install an extension in editable mode, simply change to its subdirectory\r\nwithin the `modules` directory, and run:\r\n\r\n```shell\r\npip install -e .\r\n```\r\n\r\n## Contributing\r\n\r\nPull requests are welcome. To make a PR, first fork the repo, make your proposed\r\nchanges on the `main` branch, and open a PR from your fork. If it passes\r\ntests and is accepted after review, it will be merged in.\r\n\r\n### Code style\r\n\r\n#### Formatting\r\n\r\nAll code should be formatted using\r\n[black](https://black.readthedocs.io/en/stable/), with default options. This is\r\nchecked on the CI.\r\n\r\n#### Type annotation\r\n\r\nOn the CI, [mypy](https://mypy.readthedocs.io/en/stable/) is used as a static\r\ntype checker and all submissions must pass its checks. You should therefore run\r\n`mypy` locally on any changed files before submitting a PR. Because of the way\r\nextension modules embed themselves into the `pytket` namespace this is a little\r\ncomplicated, but it should be sufficient to run the script `modules/mypy-check`\r\n(passing as a single argument the root directory of the module to test). The\r\nscript requires `mypy` 0.800 or above.\r\n\r\n#### Linting\r\n\r\nWe use [pylint](https://pypi.org/project/pylint/) on the CI to check compliance\r\nwith a set of style requirements (listed in `.pylintrc`). You should run\r\n`pylint` over any changed files before submitting a PR, to catch any issues.\r\n\r\n### Tests\r\n\r\nTo run the tests:\r\n\r\n```shell\r\ncd tests\r\npip install -r test-requirements.txt\r\npytest\r\n```\r\n\r\nBy default, the remote tests, which run against the real backend server, are \r\nskipped. To enable them, set the following environment variables:\r\n\r\n```shell\r\nexport PYTKET_RUN_REMOTE_TESTS=1\r\nexport PYTKET_REMOTE_IQM_AUTH_SERVER_URL=https://demo.qc.iqm.fi/auth\r\nexport PYTKET_REMOTE_IQM_USERNAME=YOUR_USERNAME\r\nexport PYTKET_REMOTE_IQM_PASSWORD=YOUR_PASSWORD\r\n```\r\n\r\nWhen adding a new feature, please add a test for it. When fixing a bug, please\r\nadd a test that demonstrates the fix.\r\n",
"bugtrack_url": null,
"license": "Apache 2",
"summary": "Extension for pytket, providing access to IQM backends",
"version": "0.15.0",
"project_urls": {
"Documentation": "https://tket.quantinuum.com/extensions/pytket-iqm/index.html",
"Source": "https://github.com/CQCL/pytket-iqm",
"Tracker": "https://github.com/CQCL/pytket-iqm/issues"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "32f452d5ff14775315b3b3be0de1e8aca2af27124a7ec704edbc7ebcb7d842ab",
"md5": "879dbf7dd1baa1662ee59040615338fb",
"sha256": "acacbc82d5b36443297d9475f3954d6cdc76041a8ac48c75ea376e21d05b90a8"
},
"downloads": -1,
"filename": "pytket_iqm-0.15.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "879dbf7dd1baa1662ee59040615338fb",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 15287,
"upload_time": "2024-10-04T08:18:29",
"upload_time_iso_8601": "2024-10-04T08:18:29.040736Z",
"url": "https://files.pythonhosted.org/packages/32/f4/52d5ff14775315b3b3be0de1e8aca2af27124a7ec704edbc7ebcb7d842ab/pytket_iqm-0.15.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-04 08:18:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "CQCL",
"github_project": "pytket-iqm",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pytket-iqm"
}