--- id: openqasm3 version: "1.0.1" license: Apache 2.0 Software License license_treatment: permissive maintenance: active --- # openqasm3 — Reference OpenQASM AST in Python License: permissive · Maintenance: active · Downloads: 483.3K/mo ## What it is and what it does openqasm3 is a reference implementation of the OpenQASM 3 abstract syntax tree in Python, designed to help developers write compiler passes and tools for quantum programs. It provides three main components: the AST node definitions, a parser that converts OpenQASM 3 text into the tree structure, and a visitor/transformer base for traversing and modifying the AST. The package deliberately minimizes dependencies for users who only consume the AST structure itself, with optional dependencies available for parsing functionality. It is maintained as part of the main OpenQASM project and actively developed alongside the OpenQASM 3 language specification itself, though the API is currently in early stages and not considered stable. Use it for: - Build compiler optimization passes that analyze and transform OpenQASM 3 quantum circuits - Parse OpenQASM 3 source files into an in-memory representation for analysis or code generation - Traverse and modify quantum program ASTs using visitor and transformer patterns - Develop quantum software tools that need to understand OpenQASM 3 program structure ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides a reference abstract syntax tree (AST) for OpenQASM 3 quantum programs, with parsing and AST manipulation tools for building compiler passes in Python. Yes, if you are working with OpenQASM 3 quantum programs and need to parse or manipulate them programmatically. The low install friction and active maintenance make it a practical choice. However, be aware that the API is explicitly unstable and subject to breaking changes as the OpenQASM 3 language itself evolves—pin your version carefully in production code. ## Install pip install openqasm3 uv add openqasm3 poetry add openqasm3 ## Installing openqasm3 Before you install: Low install friction with no runtime dependencies for basic AST consumption. Actively maintained with recent releases; note that the API is explicitly in early development and not yet stable. License in practice: Licensed under Apache 2.0 (permissive), allowing commercial and private use with minimal restrictions. Quickstart: pip install openqasm3 import openqasm3 # Parse OpenQASM 3 text into AST ast = openqasm3.parser.parse_file('program.qasm') Parser functionality requires the optional 'parser' extra; install with `pip install openqasm3[parser]` to use parsing features. Verify before relying: - Whether the AST API stability improves in future releases or remains subject to breaking changes - Performance characteristics when working with large or complex quantum programs ## Package facts - License: Apache 2.0 Software License (permissive) - Python support: unspecified - Install friction: low - Maintenance: active - Downloads: 483.3K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags openqasm 3 ast parser, quantum program abstract syntax tree, openqasm compiler tools, quantum circuit representation python, qasm3 ast manipulation, quantum language parsing, quantum-computing, compiler-tools [View on SkillFed](https://skillfed.io/packages/openqasm3) · [View on PyPI](https://pypi.org/project/openqasm3/)