pytket-iqm


Namepytket-iqm JSON
Version 0.17.0 PyPI version JSON
download
home_pageNone
SummaryExtension for pytket, providing access to IQM backends
upload_time2025-10-27 16:34:05
maintainerNone
docs_urlNone
authorTKET development team
requires_python>=3.10
licenseApache 2
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pytket-iqm

[![Slack](https://img.shields.io/badge/Slack-4A154B?style=for-the-badge&logo=slack&logoColor=white)](https://tketusers.slack.com/join/shared_invite/zt-18qmsamj9-UqQFVdkRzxnXCcKtcarLRA#)
[![Stack Exchange](https://img.shields.io/badge/StackExchange-%23ffffff.svg?style=for-the-badge&logo=StackExchange)](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(device="garnet", api_token="API_TOKEN")

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())
```

Note that the API token can be provided explicitly as an argument when
constructing the backend; alternatively it can be stored in pytket config (see
`IQMConfig.set_iqm_config()`); or it can be stored in a file whose location is
given by the environment variable `IQM_TOKENS_FILE`.

The IQM Client documentation includes the [set of currently supported
instructions]
(https://iqm-finland.github.io/iqm-client/api/iqm.iqm_client.models.Instruction.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.

(Note: At the moment IQM does not provide a quantum computing service open to the 
general public. Please contact their [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 environment variable
`PYTKET_RUN_REMOTE_TESTS=1` and make sure you have your API token stored either
in pytket config or in a file whose location is given by the environment
variable `IQM_TOKENS_FILE`.

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\n\n[![Slack](https://img.shields.io/badge/Slack-4A154B?style=for-the-badge&logo=slack&logoColor=white)](https://tketusers.slack.com/join/shared_invite/zt-18qmsamj9-UqQFVdkRzxnXCcKtcarLRA#)\n[![Stack Exchange](https://img.shields.io/badge/StackExchange-%23ffffff.svg?style=for-the-badge&logo=StackExchange)](https://quantumcomputing.stackexchange.com/tags/pytket)\n\n[Pytket](https://tket.quantinuum.com/api-docs/index.html) is a python module\nproviding an extensive set of tools for compiling and executing quantum circuits.\n\n`pytket-iqm` is an extension to `pytket` that allows `pytket` circuits to be\nexecuted on [IQM](https://meetiqm.com/)'s quantum devices and simulators.\n\nSome useful links:\n- [API Documentation](https://tket.quantinuum.com/extensions/pytket-iqm/)\n\n## Getting started\n\n`pytket-iqm` is available for Python 3.10, 3.11 and 3.12, on Linux, macOS\nand Windows. To install, run:\n\n```shell\npip install pytket-iqm\n```\n\nThis will install `pytket` if it isn't already installed, and add new classes\nand methods into the `pytket.extensions` namespace.\n\nAPI documentation is available\n[here](https://tket.quantinuum.com/extensions/pytket-iqm/).\n\nUnder the hood, `pytket-iqm` uses `iqm-client` to interact with the devices. See\nthe IQM Client [documentation](https://iqm-finland.github.io/iqm-client/) and\nPytket [documentation](https://tket.quantinuum.com/api-docs/) for more info.\n\nTo use the integration, initialise an `IQMBackend`, construct a Pytket circuit,\ncompile it and run. Here is a small example of running a GHZ state circuit:\n\n```python\nfrom pytket.extensions.iqm import IQMBackend\nfrom pytket.circuit import Circuit\n\nbackend = IQMBackend(device=\"garnet\", api_token=\"API_TOKEN\")\n\ncircuit = Circuit(3, 3)\ncircuit.H(0)\ncircuit.CX(0, 1)\ncircuit.CX(0, 2)\ncircuit.measure_all()\ncompiled_circuit = backend.get_compiled_circuit(circuit)\n\nresult = backend.run_circuit(compiled_circuit, n_shots=100)\nprint(result.get_shots())\n```\n\nNote that the API token can be provided explicitly as an argument when\nconstructing the backend; alternatively it can be stored in pytket config (see\n`IQMConfig.set_iqm_config()`); or it can be stored in a file whose location is\ngiven by the environment variable `IQM_TOKENS_FILE`.\n\nThe IQM Client documentation includes the [set of currently supported\ninstructions]\n(https://iqm-finland.github.io/iqm-client/api/iqm.iqm_client.models.Instruction.html).\n`pytket-iqm` retrieves the set from the IQM backend during the initialisation;\nthen `get_compiled_circuit()` takes care of compiling the circuit into the\nform suitable to run on the backend.\n\nDuring the backend initialisation, `pytket-iqm` also retrieves the names of\nphysical qubits and qubit connectivity.\n\n(Note: At the moment IQM does not provide a quantum computing service open to the \ngeneral public. Please contact their [sales team](https://www.meetiqm.com/contact/)\nto set up your access to an IQM quantum computer.)\n\n## Bugs and feature requests\n\nPlease file bugs and feature requests on the GitHub\n[issue tracker](https://github.com/CQCL/pytket-iqm/issues).\n\n## Development\n\nTo install an extension in editable mode, simply change to its subdirectory\nwithin the `modules` directory, and run:\n\n```shell\npip install -e .\n```\n\n## Contributing\n\nPull requests are welcome. To make a PR, first fork the repo, make your proposed\nchanges on the `main` branch, and open a PR from your fork. If it passes\ntests and is accepted after review, it will be merged in.\n\n### Code style\n\n#### Formatting\n\nAll code should be formatted using\n[black](https://black.readthedocs.io/en/stable/), with default options. This is\nchecked on the CI.\n\n#### Type annotation\n\nOn the CI, [mypy](https://mypy.readthedocs.io/en/stable/) is used as a static\ntype checker and all submissions must pass its checks. You should therefore run\n`mypy` locally on any changed files before submitting a PR. Because of the way\nextension modules embed themselves into the `pytket` namespace this is a little\ncomplicated, but it should be sufficient to run the script `modules/mypy-check`\n(passing as a single argument the root directory of the module to test). The\nscript requires `mypy` 0.800 or above.\n\n#### Linting\n\nWe use [pylint](https://pypi.org/project/pylint/) on the CI to check compliance\nwith a set of style requirements (listed in `.pylintrc`). You should run\n`pylint` over any changed files before submitting a PR, to catch any issues.\n\n### Tests\n\nTo run the tests:\n\n```shell\ncd tests\npip install -r test-requirements.txt\npytest\n```\n\nBy default, the remote tests, which run against the real backend server, are \nskipped. To enable them, set the environment variable\n`PYTKET_RUN_REMOTE_TESTS=1` and make sure you have your API token stored either\nin pytket config or in a file whose location is given by the environment\nvariable `IQM_TOKENS_FILE`.\n\nWhen adding a new feature, please add a test for it. When fixing a bug, please\nadd a test that demonstrates the fix.\n",
    "bugtrack_url": null,
    "license": "Apache 2",
    "summary": "Extension for pytket, providing access to IQM backends",
    "version": "0.17.0",
    "project_urls": {
        "Documentation": "https://docs.quantinuum.com/tket/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": null,
            "digests": {
                "blake2b_256": "7df41f3cf236c4461d21eee4aca373cf66bfdb7db4c6461de4f67bbd7f0796ba",
                "md5": "7a9467017e0304600aec356e3ee5cc33",
                "sha256": "8593d84d1f719a2aa5236d4fa0aa1be320a9518ab8fbc0230b5f3059a648c7bd"
            },
            "downloads": -1,
            "filename": "pytket_iqm-0.17.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7a9467017e0304600aec356e3ee5cc33",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 15200,
            "upload_time": "2025-10-27T16:34:05",
            "upload_time_iso_8601": "2025-10-27T16:34:05.345108Z",
            "url": "https://files.pythonhosted.org/packages/7d/f4/1f3cf236c4461d21eee4aca373cf66bfdb7db4c6461de4f67bbd7f0796ba/pytket_iqm-0.17.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-27 16:34:05",
    "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"
}
        
Elapsed time: 0.76426s