Metadata-Version: 2.4
Name: pytket-phir
Version: 0.10.1
Summary: A circuit analyzer and translator from pytket to PHIR
Author: Quantinuum
Maintainer-email: Kartik Singhal <Kartik.Singhal@quantinuum.com>
License: BSD 3-Clause License
        
        Copyright (c) 2023-2024, Quantinuum LLC
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        1. Redistributions of source code must retain the above copyright notice, this
           list of conditions and the following disclaimer.
        
        2. Redistributions in binary form must reproduce the above copyright notice,
           this list of conditions and the following disclaimer in the documentation
           and/or other materials provided with the distribution.
        
        3. Neither the name of the copyright holder nor the names of its
           contributors may be used to endorse or promote products derived from
           this software without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        
Project-URL: Changelog, https://github.com/quantinuum/pytket-phir/blob/main/CHANGELOG.md
Project-URL: Documentation, https://quantinuum.github.io/pytket-phir/
Project-URL: Repository, https://github.com/quantinuum/pytket-phir.git
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: <3.15,>=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: phir>=0.3.3
Requires-Dist: pytket>=2.0.0
Requires-Dist: wasmtime>=29.0.0
Provides-Extra: phirc
Requires-Dist: projectq>=0.8.0; extra == "phirc"
Requires-Dist: quantum-pecos>=0.6.0.dev2; extra == "phirc"
Dynamic: license-file

# pytket-phir

[![PyPI version](https://badge.fury.io/py/pytket-phir.svg)](https://badge.fury.io/py/pytket-phir)
[![Python versions](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12-blue.svg)](https://img.shields.io/badge/python-3.10%2C%203.11%20%7C%203.12-blue.svg)

PHIR stands for _[PECOS](https://github.com/PECOS-packages/PECOS) High-level Intermediate Representation_.
See [PHIR specification](https://github.com/quantinuum/phir/blob/main/spec.md) for more.

`pytket-phir` is a circuit analyzer and translator from [pytket](https://tket.quantinuum.com/api-docs/index.html) to PHIR.

Also included is the CLI tool `phirc` that takes QASM programs as input and emulates them using PECOS.

## Prerequisites

Python >=3.10

## Installation

Just issue `pip install pytket-phir` to obtain the latest stable release.

## phirc CLI

The package includes a tool for emulating QASM files from the command line using PECOS.

Install additional dependencies needed for the CLI using `pip install pytket-phir[phirc]`.

```sh
❯ phirc -h
usage: phirc [-h] [-w WASM_FILE] [-m {H1}] [-v] [--version] qasm_files [qasm_files ...]

Emulates QASM program execution via PECOS

positional arguments:
  qasm_files            One or more QASM files to emulate

options:
  -h, --help            show this help message and exit
  -w WASM_FILE, --wasm-file WASM_FILE
                        Optional WASM file for use by the QASM programs
  -m {H1}, --machine {H1}
                        Machine name, H1 by default
  -v, --verbose
  --version             show program's version number and exit
```

## Development

Clone the repository and run:

```sh
uv sync
uv run pre-commit install
```

See `Makefile` for other useful commands.

## Testing

Issue `make tests` from the root directory.
