Metadata-Version: 2.4
Name: openqasm
Version: 2.0.0
Summary: Parser for OpenQASM 2.0
Author-email: Alex <alxmorais8@msn.com>
License: Apache-2.0
Project-URL: Homepage, https://github.com/qevedo/openqasm
Project-URL: Source, https://github.com/qevedo/openqasm/tree/v2
Keywords: openqasm,qasm,quantum,parser
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: ply>=3.11
Requires-Dist: numpy>=1.17
Provides-Extra: latex
Requires-Dist: pylatexenc>=1.4; extra == "latex"
Provides-Extra: test
Requires-Dist: pytest>=7; extra == "test"
Dynamic: license-file

# openqasm

[![PyPI Version][openqasm-pi]][openqasm-pu]
[![Build Status][openqasm-ti]][openqasm-tu]
[![Dependency Status][openqasm-di]][openqasm-du]
[![Python Version][python-vi]][python-vu]

An OpenQASM 2.0 parser for Python.

> This is the `v2` branch, which holds the **OpenQASM 2** parser
> (`openqasm` 2.x on PyPI). OpenQASM 3 lives on `master` (`openqasm` 3.x).

## Installation

```sh
pip install "openqasm<3"
```

To export expressions to LaTeX, install the optional extra:
`pip install "openqasm[latex]<3"`.

## Usage

```python
from openqasm import Qasm

file_path = '/path/to/file.qasm'

# Parse the QASM file
qasm = Qasm(file_path)

# Get AST
ast = qasm.parse()

# Print the parsed QASM with precision=15
print(ast.qasm(15))
```

The bundled `qelib1.inc` is the final version of the IBM/Qiskit standard
header. It contains every gate of the specification's `qelib1.inc` plus newer
gates (`sx`, `rxx`, `cu`, ...). Programs that define those newer gates
themselves keep working: their definition replaces the bundled one.

## Development

```sh
pip install -e ".[test,latex]"
pytest
```

See [CHANGELOG.md](CHANGELOG.md) for changes.

## License

Apache 2.0

[openqasm-pi]: https://img.shields.io/pypi/v/openqasm
[openqasm-pu]: https://pypi.org/project/openqasm
[openqasm-ti]: https://github.com/qevedo/openqasm/actions/workflows/ci.yml/badge.svg?branch=v2
[openqasm-tu]: https://github.com/qevedo/openqasm/actions/workflows/ci.yml
[openqasm-di]: https://img.shields.io/librariesio/github/qevedo/openqasm
[openqasm-du]: https://pypi.org/project/openqasm
[python-vi]: https://img.shields.io/pypi/pyversions/openqasm
[python-vu]: https://pypi.org/project/openqasm
